From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Anthony PERARD <anthony.perard@citrix.com>,
xen-devel@lists.xenproject.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH] libxc: elf_kernel loader: Remove check for shstrtab
Date: Wed, 15 May 2019 13:07:03 +0100 [thread overview]
Message-ID: <651154bc-9710-5e03-23a2-d04a894853cc@citrix.com> (raw)
In-Reply-To: <20190515114015.25492-1-anthony.perard@citrix.com>
On 15/05/2019 12:40, Anthony PERARD wrote:
> This was probably useful to load ELF Note, but now ELF notes
> "should live in a PT_NOTE segment" (elfnote.h).
>
> With notes living in segment, there are no need for sections, so there
> is nothing to be stored in the shstrtab.
>
> 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@citrix.com>
> ---
> 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;
> - }
This might be fine for newer binaries, but you'll break older ones.
Instead, you should skip searching for strtab if we've already located
the Xen notes.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Anthony PERARD <anthony.perard@citrix.com>,
<xen-devel@lists.xenproject.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wei.liu2@citrix.com>
Subject: Re: [Xen-devel] [PATCH] libxc: elf_kernel loader: Remove check for shstrtab
Date: Wed, 15 May 2019 13:07:03 +0100 [thread overview]
Message-ID: <651154bc-9710-5e03-23a2-d04a894853cc@citrix.com> (raw)
Message-ID: <20190515120703.UI_5dcO-5iisjoG5jSWqMc8HB3Ai2LqJOpd0ObKqnqs@z> (raw)
In-Reply-To: <20190515114015.25492-1-anthony.perard@citrix.com>
On 15/05/2019 12:40, Anthony PERARD wrote:
> This was probably useful to load ELF Note, but now ELF notes
> "should live in a PT_NOTE segment" (elfnote.h).
>
> With notes living in segment, there are no need for sections, so there
> is nothing to be stored in the shstrtab.
>
> 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@citrix.com>
> ---
> 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;
> - }
This might be fine for newer binaries, but you'll break older ones.
Instead, you should skip searching for strtab if we've already located
the Xen notes.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-05-15 12:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 11:40 [PATCH] libxc: elf_kernel loader: Remove check for shstrtab Anthony PERARD
2019-05-15 11:40 ` [Xen-devel] " Anthony PERARD
2019-05-15 12:02 ` Wei Liu
2019-05-15 12:02 ` [Xen-devel] " Wei Liu
2019-05-15 12:07 ` Andrew Cooper [this message]
2019-05-15 12:07 ` Andrew Cooper
2019-05-15 12:09 ` Wei Liu
2019-05-15 12:09 ` [Xen-devel] " Wei Liu
2019-05-15 12:55 ` Anthony PERARD
2019-05-15 12:55 ` [Xen-devel] " Anthony PERARD
2019-05-16 13:23 ` Wei Liu
2019-05-16 13:23 ` [Xen-devel] " Wei Liu
2019-05-16 13:38 ` Andrew Cooper
2019-05-16 13:38 ` [Xen-devel] " Andrew Cooper
2019-05-17 11:38 ` [PATCH v2] " Anthony PERARD
2019-05-17 11:38 ` [Xen-devel] " Anthony PERARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=651154bc-9710-5e03-23a2-d04a894853cc@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).