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

Re: [Xen-devel] [PATCH XSA-followup for-4.8] libelf: fix symtab/strtab loading for 32bit domains



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@xxxxxxxxx>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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