All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Kiper <daniel.kiper@oracle.com>
To: "Vladimir 'phcoder' Serbinenko" <phcoder@gmail.com>
Cc: "jgross@suse.com" <jgross@suse.com>,
	"eric.snowberg@oracle.com" <eric.snowberg@oracle.com>,
	"grub-devel@gnu.org" <grub-devel@gnu.org>,
	Andrei Borzenkov <arvidjaar@gmail.com>,
	"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
	"cardoe@cardoe.com" <cardoe@cardoe.com>,
	"pgnet.dev@gmail.com" <pgnet.dev@gmail.com>,
	"roy.franz@linaro.org" <roy.franz@linaro.org>,
	"ning.sun@intel.com" <ning.sun@intel.com>,
	"david.vrabel@citrix.com" <david.vrabel@citrix.com>,
	"jbeulich@suse.com" <jbeulich@suse.com>,
	"stefano.stabellini@eu.citrix.com"
	<stefano.stabellini@eu.citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"qiaowei.ren@intel.com" <qiaowei.ren@intel.com>,
	"richard.l.maliszewski@intel.com"
	<richard.l.maliszewski@intel.com>,
	"gang.wei@intel.com" <gang.wei@intel.com>,
	"fu.wei@linaro.org" <fu.wei@linaro.org>,
	"seth.goldberg@oracle.com" <seth.goldberg@oracle.com>
Subject: Re: [GRUB2 PATCH v4 3/4 - FOR REVIEW ONLY] multiboot2: Do not pass memory maps to image if EFI boot services are enabled
Date: Tue, 15 Mar 2016 21:59:08 +0100	[thread overview]
Message-ID: <20160315205908.GD31771@olila.local.net-space.pl> (raw)
In-Reply-To: <CAEaD8JMgHphk31781sFpZVcT5+Q+Sj1LGpNfvhr3cbT=+sU1Lg@mail.gmail.com>

On Tue, Mar 15, 2016 at 06:10:48PM +0000, Vladimir 'phcoder' Serbinenko wrote:
> Le mar. 15 mars 2016 19:06, Andrei Borzenkov <arvidjaar@gmail.com> a écrit :
> > 15.03.2016 19:07, Vladimir 'phcoder' Serbinenko пишет:
> > > Looks good. Let's give a day for others to comment. Is the second email
> > the
> > > version for commit?
> > >
> > > On Tuesday, March 15, 2016, Daniel Kiper <daniel.kiper@oracle.com>
> > wrote:
> > >
> > >> Do not pass memory maps to image if it asked for EFI boot services.
> > >> Main reason for not providing maps is because they will likely be
> > >> invalid. We do a few allocations after filling them, e.g. for relocator
> > >> needs. Usually we do not care as we would already finish boot services.
> > >> If we keep boot services then it is easier to not provide maps. However,
> > >> if image needs memory maps and they are not provided by bootloader then
> > >> it should get them itself just before ExitBootServices() call.
> > >>
> >
> > Are there any existing users of it that rely on memory map provided by
> > bootloader? What if image explicitly requested non-optional memory map?
> > According to multiboot specification it is valid and bootloader must
> > either provide requested information or fail load.
> >
> I think you have a point. @Daniel, is current behavior a problem for you?

Do you think about MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST tag? If yes it
looks that multiboot2 doc is a bit imprecise and/or GRUB2 code is wrong.

multiboot2 doc says:

[...]

If this tag is present and ‘optional’ is set to ‘0’ information conveyed by
requested tag types must be present. If bootloader is unable to supply this
information it must fail with an error
Note: it doesn’t garantee that any tags of type ‘mbi_tag_types’ will actually
be present. E.g. on a videoless system even if you requested tag ‘8’ no tags
of type ‘8’ will be present in mbi.

[...]

However, grub_multiboot_load() just looks for MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST
tag. If it exists and if ‘optional’ is set to ‘0’ then grub_multiboot_load() verify
list of requested tags. If unknown value is found then multiboot2 command fails
with "grub_error (GRUB_ERR_UNKNOWN_OS, "unsupported information tag: 0x%x", ...".
I cannot find additional checks anywhere...

So, AIUI, "If bootloader is unable to supply..." should be read as "If bootloader
does not support..." or even "If bootloader do not understand..." or something
like that. This does not mean that bootloader must have requested data in hand
and provide it to image. It means that bootloader must understand what image ask for.
And in this term my patch does not violate spec implied by implementation (well,
multiboot2 doc makes some confusion; see below). Image may ask/request for any
memory map. However, if a given map (or set of maps) is not available or it could
be provided but could make confusion in some cases then it can/should not be provided.

Anyway, I think that maybe multiboot2 doc should be fixed and more precise
MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST tag description should be provided.
Or GRUB2 implementation is wrong then...

> Don't you just ignore the memory map in this case?

Yes to some extent. However, I think that loader should not provide
data which is known as (potentially) incorrect/faulty.

Daniel


  reply	other threads:[~2016-03-15 20:59 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15 15:25 [GRUB2 PATCH v4 0/4] multiboot2: Add two extensions Daniel Kiper
2016-03-15 15:25 ` Daniel Kiper
2016-03-15 15:25 ` [GRUB2 PATCH v4 1/4] i386/relocator: Add grub_relocator64_efi relocator Daniel Kiper
2016-03-15 15:25   ` Daniel Kiper
2016-03-15 16:00   ` Vladimir 'phcoder' Serbinenko
2016-03-15 19:59     ` Daniel Kiper
2016-03-15 19:59     ` Daniel Kiper
2016-03-15 16:00   ` Vladimir 'phcoder' Serbinenko
2016-03-15 15:25 ` [GRUB2 PATCH v4 2/4] multiboot2: Add tags used to pass ImageHandle to loaded image Daniel Kiper
2016-03-15 15:25   ` Daniel Kiper
2016-03-15 16:03   ` Vladimir 'phcoder' Serbinenko
2016-03-15 16:03   ` Vladimir 'phcoder' Serbinenko
2016-03-15 23:39   ` Konrad Rzeszutek Wilk
2016-03-15 23:39   ` Konrad Rzeszutek Wilk
2016-03-15 15:26 ` [GRUB2 PATCH v4 3/4 - FOR REVIEW ONLY] multiboot2: Do not pass memory maps to image if EFI boot services are enabled Daniel Kiper
2016-03-15 15:26   ` Daniel Kiper
2016-03-15 23:46   ` Konrad Rzeszutek Wilk
2016-03-15 23:46   ` Konrad Rzeszutek Wilk
2016-03-16 10:02     ` Daniel Kiper
2016-03-16 10:02     ` Daniel Kiper
2016-03-16 10:14       ` Toomas Soome
2016-03-16 10:14       ` Toomas Soome
2016-03-16 10:39         ` Vladimir 'phcoder' Serbinenko
2016-03-16 10:39           ` Vladimir 'phcoder' Serbinenko
2016-03-16 13:06           ` Konrad Rzeszutek Wilk
2016-03-16 13:06           ` Konrad Rzeszutek Wilk
2016-03-15 15:26 ` [GRUB2 PATCH v4 3/4 - FOR COMMIT] " Daniel Kiper
2016-03-15 15:26   ` Daniel Kiper
2016-03-15 16:07   ` [GRUB2 PATCH v4 3/4 - FOR REVIEW ONLY] " Vladimir 'phcoder' Serbinenko
2016-03-15 16:07   ` Vladimir 'phcoder' Serbinenko
2016-03-15 18:06     ` Andrei Borzenkov
2016-03-15 18:10       ` Vladimir 'phcoder' Serbinenko
2016-03-15 18:10       ` Vladimir 'phcoder' Serbinenko
2016-03-15 20:59         ` Daniel Kiper [this message]
2016-03-15 20:59         ` Daniel Kiper
2016-03-15 18:06     ` Andrei Borzenkov
2016-03-15 20:01     ` Daniel Kiper
2016-03-15 20:01     ` Daniel Kiper
2016-03-15 15:26 ` [GRUB2 PATCH v4 4/4] multiboot2: Add support for relocatable images Daniel Kiper
2016-03-15 15:26   ` Daniel Kiper
2016-03-15 16:27   ` Vladimir 'phcoder' Serbinenko
2016-03-15 16:30     ` Vladimir 'phcoder' Serbinenko
2016-03-15 21:42       ` Daniel Kiper
2016-03-15 23:54         ` Konrad Rzeszutek Wilk
2016-03-16 10:34           ` Daniel Kiper
2016-03-16 10:34           ` Daniel Kiper
2016-03-16 10:41         ` Vladimir 'phcoder' Serbinenko
2016-03-16 10:41           ` Vladimir 'phcoder' Serbinenko
2016-03-15 21:42       ` Daniel Kiper
2016-03-15 16:30     ` Vladimir 'phcoder' Serbinenko
2016-03-15 16:27   ` Vladimir 'phcoder' Serbinenko

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=20160315205908.GD31771@olila.local.net-space.pl \
    --to=daniel.kiper@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=arvidjaar@gmail.com \
    --cc=cardoe@cardoe.com \
    --cc=david.vrabel@citrix.com \
    --cc=eric.snowberg@oracle.com \
    --cc=fu.wei@linaro.org \
    --cc=gang.wei@intel.com \
    --cc=grub-devel@gnu.org \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=ning.sun@intel.com \
    --cc=pgnet.dev@gmail.com \
    --cc=phcoder@gmail.com \
    --cc=qiaowei.ren@intel.com \
    --cc=richard.l.maliszewski@intel.com \
    --cc=roy.franz@linaro.org \
    --cc=seth.goldberg@oracle.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.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.