All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Brian Marcotte <marcotte@panix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Jan Beulich <jbeulich@suse.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH XSA-followup for-4.8] libelf: fix symtab/strtab loading for 32bit domains
Date: Wed, 23 Nov 2016 02:47:32 +0000	[thread overview]
Message-ID: <20161123024732.GB23385@citrix.com> (raw)
In-Reply-To: <1479836377-9627-1-git-send-email-roger.pau@citrix.com>

On Tue, Nov 22, 2016 at 05:39:37PM +0000, Roger Pau Monne wrote:
> Commit ed04ca introduced a bug in the symtab/strtab loading for 32bit
> guests, that corrupted the section headers array due to the padding
> introduced by the elf_shdr union.
> 
> The Elf section header array on 32bit should be accessible as an array of
> Elf32_Shdr elements, and the union with Elf64_Shdr done in elf_shdr was
> breaking this due to size differences between Elf32_Shdr and Elf64_Shdr.
> 
> Fix this by copying each section header one by one, and using the proper
> size depending on the bitness of the guest kernel. While there, also fix
> a couple of consistency issues, by making sure we always use the sizes of
> our local versions of the ELF header and the ELF sections headers.
> 
> Reported-by: Brian Marcotte <marcotte@panix.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

This doesn't seem to build for me.

64 bit:

../../xen/common/libelf/libelf-loader.c: In function ‘elf_load_bsdsyms’:
../../xen/common/libelf/libelf-loader.c:304:5: error: ‘ehdr_size’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     elf_memcpy_safe(elf, ELF_HANDLE_PTRVAL(header_handle),
     ^
../../xen/common/libelf/libelf-loader.c:264:30: note: ‘ehdr_size’ was declared here
     unsigned long shdr_size, ehdr_size, header_size;
                              ^
../../xen/common/libelf/libelf-loader.c:312:99: error: ‘shdr_size’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     elf_store_field_bitness(elf, header_handle, e_shentsize, shdr_size);
                                                                                                   ^
../../xen/common/libelf/libelf-loader.c:264:19: note: ‘shdr_size’ was declared here
     unsigned long shdr_size, ehdr_size, header_size;
                   ^
cc1: all warnings being treated as errors

32 bit:

../../xen/common/libelf/libelf-loader.c:304:20: error: 'ehdr_size' may be used uninitialized in this function [-Werror=uninitialized]
../../xen/common/libelf/libelf-loader.c:312:5: error: 'shdr_size' may be used uninitialized in this function [-Werror=uninitialized]

This patch is applied on top of 986f790e0184d4bf575462077378e14fa9f85aa9.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

      reply	other threads:[~2016-11-23  2:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22 17:39 [PATCH XSA-followup for-4.8] libelf: fix symtab/strtab loading for 32bit domains Roger Pau Monne
2016-11-23  2:47 ` Wei Liu [this message]

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=20161123024732.GB23385@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=marcotte@panix.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.