[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/8] x86/EFI: sections may not live at VA 0 in PE binaries


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 21 Apr 2021 14:57:01 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r0vcNzL+VYM82B5WynwoK4IUPy8Lo2fOWLelQ9gIPYA=; b=DNmDvBUobA2llnvrN+rdmtMyPDTlDo4P2ZTEDGiuAeU0PZAOH9INlwkyTZkewnjkrM40S2Iqc/LBUuYLBlJpCwzAUjEiMO4IHpXwsBw7MDmIgPFBBQu9dhEzkftnsVUJZVY+r+Pu83tFobNAdFFiR5K427joBV0c0vvq6GiEFQNplSDS6qkKts23cRmEev05Sb7o4igZeMN8446ErwWxBem5xL61+hZq8SHMiLbkt0Abp/C3la6w+/gQO8Qlmz0R0crOjhIC8MPpSuYviRaQEup5JxbKMAQBhaMlhfgkhezfzeH6/KtDew/du3xCIn6nPrpK5FGQKsfLXD3mIvQa0g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dNeuhuyT08ZFKurHSKQvBAmuaIUS9FAsGvRamhc7G+0yJ8yPBjAx+TIHbvdL/ZNeO5v6DgxZQArQLL8WjX1Yh7zmrjO2ErWgKP2qqxQofU5em5mqM51p3nv4EDJA09bIiAGSHl+1zF+w+I5kBHVR2Z9qY/lv9KqIVjJmxVZ4hz6pqIU9dep+ngDFAfgLqKz1KvuMgfAWUpjPf6dtNvzTFdrwRHlvNXck4FXkezgdHWj/yxy0qZrmS0jTymivYGquQsjesPKKQIrVeqcpMiGcGHI3jJLAJWlxryQICTNDmztEOMyma9yg9oPolaKhjOmJy0JK2FIWdV/GADIBWfx47Q==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 21 Apr 2021 12:57:17 +0000
  • Ironport-hdrordr: A9a23:T1KyRq2mmyNi2xOT7YhjCwqjBch2eYIsi2QD101hICF9Wvez0+ izgfUW0gL1gj4NWHcm3euNIrWEXGm0z+8X3aA4Bp3neAX9omOnIMVZ7YXkyyD9ACGWzI5g/I 9aWexFBNX0ZGIase/T6gO1Cstl5dGB/ryhi+u29QYScShBQchbnmFEIyycFVB7QxQDIJI/Go aV6MYvnUvQRV08aMOnCn4ZG9XSvtGjruOnXTcqJT4CrDOPgzSh9aLgH3GjtSs2fjtTzd4ZgB L4uiPj4KHLiYDe9jb90Cvp441SiJ/dzLJ4dbOxo+w0DhmptQqyfoRmXNS5zXMIicWi8kwjnt WJgzpIBbUP11rrcmu4oQTg1mDbuV5DhBGSqy78vVLZrcP0Xz48AcZa7LgpDifx0EY8oMp6lJ tCwmPxjesLMTr7gC//69LUPisa73acnHs4neYfy1xZXIcOAYUh1rA3wUJPHJ8MWB/98YAsed MedP302fA+SyL8U1np+kl1xtuUWG8vWj+4K3JphuWllxx5tDRi00AdxNYEnnEGnahRd7B0o8 D/doh4nrBHScEbKYhnAv0afMexAmvRBTrRLWO7Oz3cZeM6EkOIj6SyzKQ+5emsdpBN5oA1go 79XFRRsnN3U17yCPeJwIZA/nn2MSCAdAWo7vsby4lyu7X6SrauGzaEUkoSn8yppOhaJcHHRf CpOtZzD+X4JWXjXaZFtjeOH6V6GD07aok4q9w7U1WBrobgMYvxrNHWd/7VOf7jCjAh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cQC3dCrttNeN7caP32eWjZw2heapSoMOC gGU+humInGGQ6n4hRdilX86gQ72pJJmEkoSWun33KukR5pDBHYF1h7sIBBe3AQUkyoHbz+kJgJ +ln1sv6dMTGm25Ydg6At8patqjLwo0FkYBXrS8KZB58Z6cr0sBc5SdZ3aakzECfumR3blcPmIR pUBfr7w+9lLM9PPpIxKlDbeNZLaNmqmXJkNCi5h4X/AwhxbcsStun4XPJ8K/eWUeeTnShFAhRK cQ8=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Apr 21, 2021 at 12:32:42PM +0200, Jan Beulich wrote:
> On 21.04.2021 10:52, Roger Pau Monné wrote:
> > On Thu, Apr 01, 2021 at 11:44:45AM +0200, Jan Beulich wrote:
> >> PE binaries specify section addresses by (32-bit) RVA. GNU ld up to at
> >> least 2.36 would silently truncate the (negative) difference when a
> >> section is placed below the image base. Such sections would also be
> >> wrongly placed ahead of all "normal" ones. Since, for the time being,
> >> we build xen.efi with --strip-debug anyway, .stab* can't appear. And
> >> .comment has an entry in /DISCARD/ already anyway in the EFI case.
> >>
> >> Because of their unclear origin, keep the directives for the ELF case
> >> though.
> > 
> > It's my understadng thonse sections are only there for debug purposes,
> > and never part of the final xen binary as they are stripped?
> > 
> > Could we maybe remove the section load address of 0 and instead just
> > use the (NOLOAD) directive?
> 
> (NOLOAD) is meaningless for PE.
> 
> > Does it really matter to place them at address 0?
> 
> That's the convention for ELF, and also what ld defaults to for debugging
> sections.
> 
> > I also wonder, is this change fixing some existing bug, or it's just a
> > cleanup change?
> 
> If there were sections at 0, the resulting PE binary would end up broken.
> Prior to binutils 2.37 this brokenness is silent, i.e. the linker doesn't
> issue any form of diagnostic. The change therefore is addressing a latent
> issue - if any such section started being non-empty, we'd be in trouble.
> 
> > I also only see the .comment section in my binary output, so maybe
> > it's fine to just remove them from the script?
> 
> Which binary are you referring to - ELF or PE? In the former case, yes,
> that's what the statement is for. In the latter case I can't see how this
> would be, with .comment being explicitly part of /DISCARD/ in that case.

So from a bit of searching I just did it seems like stab sections
where used during the 90s with ELF, but that this has long been
superseded by DWARF 2 becoming the default in the late 90s, hence I
think it would be fine to just remove those sections even in the ELF
case?

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.