All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Ulrich Niedermann <hun@n-dimensional.de>
To: grub-devel@gnu.org
Subject: Re: Multiboot 2 Header Alignment: implementation contradicts specification
Date: Sat, 23 May 2020 22:26:46 +0200	[thread overview]
Message-ID: <20200523222646.212cef79@n-dimensional.de> (raw)
In-Reply-To: <bd23b60e-19ba-7020-4c26-a5203b02a843@64epicks.com>

On Sat, 23 May 2020 21:24:32 +0200
Jacob Paul via Grub-devel <grub-devel@gnu.org> wrote:

> 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.

See separate patch:

Subject: [PATCH] mb2 loader: Fix header size, alignment for Multiboot 2

> > 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.

And it could be the same code as is in use elsewhere, namely in the
Multiboot 1 loader.

I have put that into a separate RFC patch:

Subject: [PATCH RFC] mb2 loader: Use the same iteration code for MB2 as for MB1


      reply	other threads:[~2020-05-23 20:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-23 16:50 Multiboot 2 Header Alignment: implementation contradicts specification Jacob Paul
2020-05-23 18:33 ` Hans Ulrich Niedermann
2020-05-23 19:24   ` Jacob Paul
2020-05-23 20:26     ` Hans Ulrich Niedermann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200523222646.212cef79@n-dimensional.de \
    --to=hun@n-dimensional.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.