Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jcZl7-0005zR-UK for mharc-grub-devel@gnu.org; Sat, 23 May 2020 15:24:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcZl5-0005yo-Qg for grub-devel@gnu.org; Sat, 23 May 2020 15:24:35 -0400 Received: from 64epicks.com ([116.203.107.72]:55156) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcZl4-0001Zv-Fd for grub-devel@gnu.org; Sat, 23 May 2020 15:24:35 -0400 Received: from [85.224.11.194] (c-c20be055.019-252-73746f67.bbcust.telenor.se [85.224.11.194]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by 64epicks.com (Postfix) with ESMTPSA id C788931F417E for ; Sat, 23 May 2020 21:22:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=64epicks.com; s=mail; t=1590261748; bh=kuzX2okGqBwURK23MOTyAaomWm7gafOsmUU3mTmIO/k=; h=Subject:To:References:From:Date:In-Reply-To; b=JalsRfvuqrftWC/IEkQd4xQiYxvOKD3mspwa7eaimexDgwI0U23kX3eGTbjYwMCPW rF4L2neiC87OWiCKRqf+93BrO2PVm384AWRdaJrvyk6fwEOm1MSppnUYZrLSPSj9xp jc5js4WgUsUz92KLnUBY/uggoWvxoSFCOC5R1Q0TLLInjUVCUBI6Mi/F+HYLsjSdAc gAR7wiltqbXJfWKz0RfyRO3rTDGqRCwMloamQ6fmvPB4Zmq2PX8Twc/pSHJ6rtu0lh NE1OCyxXNkk0Ux3KSZuUiDitHeKl/xAYIsvKWSjBHQE7e4zHaNvNfKJuG28kxDRrH2 WOM+pEsuMwviQ== Subject: Re: Multiboot 2 Header Alignment: implementation contradicts specification To: grub-devel@gnu.org References: <20200523203317.491e85f8@n-dimensional.de> From: Jacob Paul Message-ID: Date: Sat, 23 May 2020 21:24:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200523203317.491e85f8@n-dimensional.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=116.203.107.72; envelope-from=jacob.paul@64epicks.com; helo=64epicks.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/23 15:24:33 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 May 2020 19:24:36 -0000 On 2020-05-23 20:33, Hans Ulrich Niedermann wrote: > The comment is valid for MB1, but not for MB2. Both regarding the > alignment and regarding the size. And regarding the size, this actually > means there is a bug in the code here: An MB2 header is at least 16 > bytes for the header magic plus at least 8 bytes for the mb2 header > termination tag. That adds up to 24 bytes for MB2, not 12 bytes as it > did for MB1. I see, so there is at least that. Might be a good idea to fix it. > I fear you have missed that bytes and grub_uint32_t array elements are > not the same size. I unfortunately did not notice the (grub_uint32_t *), I apologize for assuming that it increments by 2 bytes and not u32's. Wouldn't it be a lot cleaner if it just incremented it in bytes instead, since you could then also remove the division by 4 and the cast? It wouldn't make any difference runtime wise, just a bit easier to read. Jacob