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

Re: [PATCH v2] libelf: improve PVH elfnote parsing


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 20 May 2021 11:27:20 +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=dkhkwhZQvzRV/SfNdKFoIZrmzPlqYdtF2VoACyZP/Dc=; b=TTVrkU06ei99FcwK/k2JPm+6mms98CLZtff9DD4ip8P25ewzb+fRWBRLGW9Ep1lBFXUr1vFybcDUdl7o/KwGR25ddbVuLvtvuP8MYUbCcmgaAD3F0oNWntw/o6lo2tbECaId+ExKaeogLuC/YZgPCH+Wa+Qys/Bg/fgGbfS22YV66PRArqv6w8SFiRHvTCKBsxgCCB7vetW012KsvKOttGwFKLPN78TgtQHOSKH+NyYR5rF7F/gpp2ggu9IcNW5XZR7LNOIF5nUY5OiGHQ6kojrqsrTyE7oWsyKQBrVMDuZdgGVSYADuD0s/0Dug1ycETSWq1Ze+wQKg02j3vbh/uQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SS/IO9rv6Rkxsr4jZZFpuqlMTDL+W09+O4btq7MoBBj7qyUvhkDV4lHsgxASTw5ZcudX84+Eesu2ztFS1N25kk4PeQrWIDK8ZZZ8+TuVOoNLTMq1LP0B14ysFtSllsZcKHUpVVqMOxp5q8DtRVtAm9qlp85Yt9DkU/dFgURXZXx63pm6pW7mdXOnnRYn+eIT/babiKdUHyk7zvjimzlDqqR8CBtsPfscoZu+B6RNUF2MD0yhTW4JSYdI6LAiWYOMEIPBL48x6fmtaTw06YmYTPI7Y0Rp0zNanjMXPepipaD3QgGXbMSQTZygxQGfQc6IfAShKtIvXwnCu5qFNpuqLA==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 20 May 2021 09:27:33 +0000
  • Ironport-data: A9a23:54Txo6AzJf+behVW/zTjw5YqxClBgxIJ4kV8jS/XYbTApG8i1DEGy mQWCjrTbqzcajbzetp2YIq18B4D6JeEzIQxQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMZiaH4EjratANlFEkvU2ybuOU5NXsZ2YhH2eIdA970Ug6w7Ng09Y26TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPh15 41mpMCaCj0FZKr2xeZFYTNUL3txaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM0DF3bveLLGTE4GAguw5K8bmJsUHs2xIxjDFF/c2B5vERs0m4PcEgGph2JEeQp4yY eIHUz9GUD3CTCZMEWtLM6NnoteXoX/wJmgwRFW9+vNsvjm7IBZK+KfpGMrYfJqNX8o9tkSFo mPL+UzpDxdcM8aQoRKe6W6ljOLLmSL9WaoRGae++/osh0ecrkQRAhALUVqwodGil1WzHdlYL iQ86ico6KQ/6kGvZt38RAGj5m6JuAYGXNhdGPF87xuCooLV/ASxFmUCViRGatEtqIkxXzN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QLGjIdLvJMlwGLRzLQnzh/3hS4nJ2GFKXAMAZOAkZ OlbNzxWv75vJ+FW8y8Py+DxKXdsPwMb+PLbEy+Eh4S3T/VV8hRcNgQQEeIgUXSFtkbWyzfmD2C n6QX3R7qKKqrShS4YJ5LmlB/loJnW3KNOmRDip8VevnEW7GTXpP43zEAHtJBHVCj1Ll/f3rNHz 5oY=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, May 19, 2021 at 12:34:19PM +0200, Jan Beulich wrote:
> On 18.05.2021 16:47, Roger Pau Monne wrote:
> > @@ -425,8 +425,11 @@ static elf_errorstatus elf_xen_addr_calc_check(struct 
> > elf_binary *elf,
> >          return -1;
> >      }
> >  
> > -    /* Initial guess for virt_base is 0 if it is not explicitly defined. */
> > -    if ( parms->virt_base == UNSET_ADDR )
> > +    /*
> > +     * Initial guess for virt_base is 0 if it is not explicitly defined in 
> > the
> > +     * PV case. For PVH virt_base is forced to 0 because paging is 
> > disabled.
> > +     */
> > +    if ( parms->virt_base == UNSET_ADDR || hvm )
> >      {
> >          parms->virt_base = 0;
> >          elf_msg(elf, "ELF: VIRT_BASE unset, using %#" PRIx64 "\n",
> 
> This message is wrong now if hvm is true but parms->virt_base != UNSET_ADDR.
> Best perhaps is to avoid emitting the message altogether when hvm is true.
> (Since you'll be touching it anyway, perhaps a good opportunity to do away
> with passing parms->virt_base to elf_msg(), and instead simply use a literal
> zero.)
> 
> > @@ -441,8 +444,10 @@ static elf_errorstatus elf_xen_addr_calc_check(struct 
> > elf_binary *elf,
> >       *
> >       * If we are using the modern ELF notes interface then the default
> >       * is 0.
> > +     *
> > +     * For PVH this is forced to 0, as it's already a legacy option for PV.
> >       */
> > -    if ( parms->elf_paddr_offset == UNSET_ADDR )
> > +    if ( parms->elf_paddr_offset == UNSET_ADDR || hvm )
> >      {
> >          if ( parms->elf_note_start )
> 
> Don't you want "|| hvm" here as well, or alternatively suppress the
> fallback to the __xen_guest section in the PVH case (near the end of
> elf_xen_parse())?

The legacy __xen_guest section doesn't support PHYS32_ENTRY, so yes,
that part could be completely skipped when called from an HVM
container.

I think I will fix that in another patch though if you are OK, as
it's not strictly related to the calculation fixes done here.

Thanks, Roger.



 


Rackspace

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