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

Re: [PATCH] libelf: improve PVH elfnote parsing


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 18 May 2021 13:22:07 +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=OgOXpGvZRfLjobJD5KW4J7iqSCteow7nPWaKurE1NW8=; b=XypIPlp/U7kToJA4GqyEDKvoC6IAFdHYwY8A43fKxP/L2Boj1jRiu8z/BwgMV/TBtOVFKXJjoj2ioJYU+bzxZC9xD1s43ETPKOrAbWGuCMySraiqlkI7num1SuYmYL4qYgedOfvM1/DOIqhSbbdH2MhzK+QEImD+jvwgaVyFvjSWcf6MkYvmD8jDsHEesMtv5s3igeOwHOt2/XeJFrSDGgjuQ74vYdjmsP9nuJx4lqomGgV4T/2LOmVC86z8az2n36EW1wyAwQpCKyZ47Q4Djoh9oeI8hYTJ/byENrGrTU81SWLgd2yXAeaGHSyGXvy8ZxlSj5q1Vkdj5vPodoV58Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eMP8c6ipiwoFOKyECASbD7GFzNmiIDuucIMN/WPSFwnqlK5UEW+JRQM33ZZTswYr4kpD66wRXMhqSQqExdjBoqmJht4z0mIOU/yvRLU1UmjZ7yns3dn6tbHVVAKesUPPqeJHm6t+idQQobTZnkSJpfLFwusyClLpsk0RG5OSJRXMdybIaywGPJTDwweoo4XiRPMSiXuamfKjv+7Rby0VEqJEGsDHD9Xwj66g9Tw/IwqJhkWkfpRcGtO90HuA7kNiSwh6IaJRb+k4R6CDnQ2KoZE9bu3Sb+BWGGjDGqwTFt4qKj8pvTB1XXj8TgEgra5+D2H5nHi98BpwU3qzRoOuEQ==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: 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>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 18 May 2021 11:22:24 +0000
  • Ironport-hdrordr: A9a23:FB2zAaO1OFrpIsBcT8H155DYdb4zR+YMi2TDiHofdfUFSKClfp 6V8cjztSWUtN4QMEtQ/uxoHJPwO080lKQFmrX5WI3NYOCIghrLEGgP1/qG/9SkIVyCygc/79 YQT0EdMqyIMbESt6+Ti2PZYrVQs+VvsprY/ds2p00dMz2CAJsQiTuRZDzrdnGfE2J9dOUE/d enl4d6T1XKQwVaUu2LQl0+G8TTrdzCk5zrJTQcAQQ81QWIhTS0rJbnDhmxxH4lInJy6IZn1V KAvx3y562lvf3+4ATbzXXv45Nfn8ak4sdfBfaLltMeJlzX+0iVjbxaKv6/VQ0O0aOSAA5Aqq iIn/5gBbU915rpRBD0nfO3sDOQlArHghTZuC+laXiKm72weNt1MbsHuWr1GiGpnHbIh+sMpZ 6j6Vjp/qa/PSmw7hgV2OK4Iy2CtnDE6kbKwtRjxUC2b+MlGclsRNskjT9o+dE7bWTH1Lw=
  • Ironport-sdr: nsiFW6O9ZJAwvwkt3nImK2sH8ap24MFzq8HQjiDQFTDbZBqanxOSQK+RSIZuCX8OGDKjtbFkml CFbNR7lqukG0k16tAK4eAUv1GOM6md+uoWSLOP/X1MiLuB7VFOQxu0siWmZyR3v6V4+mPRpGHA wxTdmJY1J8FxGLju9zqQ0csPoXA8FQn023m06wWHqqxyIzk6ubN8vZQBvgysvVIlMJ6zuCMj0g gqN4MoZVxbS+dav4A/zff7ttiKAwATNt+U2hIJ13jHvga9GA54w5/qbrTcAxwrZ3qLYtLDeJ3H NDU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, May 17, 2021 at 01:09:11PM +0200, Jan Beulich wrote:
> On 14.05.2021 15:50, Roger Pau Monne wrote:
> > @@ -426,7 +426,7 @@ static elf_errorstatus elf_xen_addr_calc_check(struct 
> > elf_binary *elf,
> >      }
> >  
> >      /* Initial guess for virt_base is 0 if it is not explicitly defined. */
> > -    if ( parms->virt_base == UNSET_ADDR )
> > +    if ( parms->virt_base == UNSET_ADDR || hvm )
> >      {
> >          parms->virt_base = 0;
> >          elf_msg(elf, "ELF: VIRT_BASE unset, using %#" PRIx64 "\n",
> > @@ -442,7 +442,7 @@ 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.
> >       */
> > -    if ( parms->elf_paddr_offset == UNSET_ADDR )
> > +    if ( parms->elf_paddr_offset == UNSET_ADDR || hvm )
> >      {
> >          if ( parms->elf_note_start )
> >              parms->elf_paddr_offset = 0;
> 
> Both of these would want their respective comments also updated, I
> think: There's no defaulting or guessing really in PVH mode, is
> there?
> 
> > @@ -456,8 +456,13 @@ static elf_errorstatus elf_xen_addr_calc_check(struct 
> > elf_binary *elf,
> >      parms->virt_kstart = elf->pstart + virt_offset;
> >      parms->virt_kend   = elf->pend   + virt_offset;
> >  
> > -    if ( parms->virt_entry == UNSET_ADDR )
> > -        parms->virt_entry = elf_uval(elf, elf->ehdr, e_entry);
> > +    if ( parms->virt_entry == UNSET_ADDR || hvm )
> > +    {
> > +        if ( parms->phys_entry != UNSET_ADDR32 )
> 
> Don't you need "&& hvm" here to prevent ...
> 
> > +            parms->virt_entry = parms->phys_entry;
> 
> ... this taking effect for a kernel capable of running in both
> PV and PVH modes, instead of ...
> 
> > +        else
> > +            parms->virt_entry = elf_uval(elf, elf->ehdr, e_entry);
> 
> ... this (when actually in PV mode)?

Oh, I somehow assumed that PV guests _must_ provide the entry point in
XEN_ELFNOTE_ENTRY, but I don't think that's the case. Will update and
send a new version.

Thanks, Roger.



 


Rackspace

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