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

[Xen-changelog] [xen staging] libxc: elf_kernel loader: Remove check for shstrtab



commit 582a298b215088acb042793da91f0baa8ce34425
Author:     Anthony PERARD <anthony.perard@xxxxxxxxxx>
AuthorDate: Fri May 17 12:38:43 2019 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri May 17 16:14:04 2019 +0100

    libxc: elf_kernel loader: Remove check for shstrtab
    
    This was probably useful as a sanity check when the "__xen_guest"
    section were not legacy.  But now ELF notes are prefered and
    "should live in a PT_NOTE segment" (elfnote.h).
    
    This check is unnecessary as elf_xen_parse() from xen/common/libelf
    will do the right thing and look for ELFNOTEs in the different places
    in order of preference. elf_xen_parse() will still be able to also
    look for the legacy "__xen_guest" section without the check in libxc.
    
    This patch would allow to write a simpler ELF header for an OVMF blob
    (which isn't an ELF) and allow it to be loaded as a PVH kernel. The
    header only needs to declare two program segments:
    - one to tell an ELF loader where to put the blob,
    - one for a Xen ELFNOTE.
    
    The ELFNOTE is to comply to the pvh design which wants the
    XEN_ELFNOTE_PHYS32_ENTRY to declare a blob as compaptible with the PVH
    boot ABI.
    
    Note that without the ELFNOTE, libxc will load an ELF but with
    the plain ELF loader, which doesn't check for shstrtab.
    
    Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 tools/libxc/xc_dom_elfloader.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
index 82b5f2ee79..b327db219d 100644
--- a/tools/libxc/xc_dom_elfloader.c
+++ b/tools/libxc/xc_dom_elfloader.c
@@ -165,15 +165,6 @@ static elf_negerrnoval xc_dom_parse_elf_kernel(struct 
xc_dom_image *dom)
         return rc;
     }
 
-    /* Find the section-header strings table. */
-    if ( ELF_PTRVAL_INVALID(elf->sec_strtab) )
-    {
-        xc_dom_panic(dom->xch, XC_INVALID_KERNEL, "%s: ELF image"
-                     " has no shstrtab", __FUNCTION__);
-        rc = -EINVAL;
-        goto out;
-    }
-
     /* parse binary and get xen meta info */
     elf_parse_binary(elf);
     if ( elf_xen_parse(elf, &dom->parms) != 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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