Received: from list by lists.gnu.org with archive (Exim 4.71) id 1afw44-0003lb-KB for mharc-grub-devel@gnu.org; Tue, 15 Mar 2016 16:59:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afw3y-0003dt-SV for grub-devel@gnu.org; Tue, 15 Mar 2016 16:59:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afw3s-0005Ai-A8 for grub-devel@gnu.org; Tue, 15 Mar 2016 16:59:34 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:27127) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afw3r-00059o-VU for grub-devel@gnu.org; Tue, 15 Mar 2016 16:59:28 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u2FKxG1o022483 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 15 Mar 2016 20:59:17 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u2FKxGmw025792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 15 Mar 2016 20:59:16 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u2FKxFYp008280; Tue, 15 Mar 2016 20:59:16 GMT Received: from olila.local.net-space.pl (/10.175.228.51) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 15 Mar 2016 13:59:15 -0700 Date: Tue, 15 Mar 2016 21:59:08 +0100 From: Daniel Kiper To: "Vladimir 'phcoder' Serbinenko" Subject: Re: [GRUB2 PATCH v4 3/4 - FOR REVIEW ONLY] multiboot2: Do not pass memory maps to image if EFI boot services are enabled Message-ID: <20160315205908.GD31771@olila.local.net-space.pl> References: <1458055562-24950-1-git-send-email-daniel.kiper@oracle.com> <1458055562-24950-5-git-send-email-daniel.kiper@oracle.com> <56E84F10.5080804@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by userp1040.oracle.com id u2FKxG1o022483 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 Cc: "jgross@suse.com" , "eric.snowberg@oracle.com" , "grub-devel@gnu.org" , Andrei Borzenkov , "andrew.cooper3@citrix.com" , "cardoe@cardoe.com" , "pgnet.dev@gmail.com" , "roy.franz@linaro.org" , "ning.sun@intel.com" , "david.vrabel@citrix.com" , "jbeulich@suse.com" , "stefano.stabellini@eu.citrix.com" , "xen-devel@lists.xenproject.org" , "qiaowei.ren@intel.com" , "richard.l.maliszewski@intel.com" , "gang.wei@intel.com" , "fu.wei@linaro.org" , "seth.goldberg@oracle.com" X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2016 20:59:39 -0000 On Tue, Mar 15, 2016 at 06:10:48PM +0000, Vladimir 'phcoder' Serbinenko w= rote: > Le mar. 15 mars 2016 19:06, Andrei Borzenkov a =C3= =A9crit : > > 15.03.2016 19:07, Vladimir 'phcoder' Serbinenko =D0=BF=D0=B8=D1=88=D0= =B5=D1=82: > > > Looks good. Let's give a day for others to comment. Is the second e= mail > > the > > > version for commit? > > > > > > On Tuesday, March 15, 2016, Daniel Kiper > > 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 relo= cator > > >> needs. Usually we do not care as we would already finish boot serv= ices. > > >> If we keep boot services then it is easier to not provide maps. Ho= wever, > > >> 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 b= y > > bootloader? What if image explicitly requested non-optional memory ma= p? > > 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 yo= u? Do you think about MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST tag? If yes i= t looks that multiboot2 doc is a bit imprecise and/or GRUB2 code is wrong. multiboot2 doc says: [...] If this tag is present and =E2=80=98optional=E2=80=99 is set to =E2=80=98= 0=E2=80=99 information conveyed by requested tag types must be present. If bootloader is unable to supply th= is information it must fail with an error Note: it doesn=E2=80=99t garantee that any tags of type =E2=80=98mbi_tag_= types=E2=80=99 will actually be present. E.g. on a videoless system even if you requested tag =E2=80=98= 8=E2=80=99 no tags of type =E2=80=988=E2=80=99 will be present in mbi. [...] However, grub_multiboot_load() just looks for MULTIBOOT_HEADER_TAG_INFORM= ATION_REQUEST tag. If it exists and if =E2=80=98optional=E2=80=99 is set to =E2=80=980=E2= =80=99 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 bo= otloader does not support..." or even "If bootloader do not understand..." or some= thing 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 im= age 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 fo= r 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 precis= e MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST tag description should be provid= ed. 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