|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH for-4.8] libelf: fix symtab/strtab loading for 32bit domains
>>> On 05.10.16 at 18:17, <roger.pau@xxxxxxxxxx> wrote:
> On Wed, Oct 05, 2016 at 09:51:06AM -0600, Jan Beulich wrote:
>> >>> On 05.10.16 at 17:11, <roger.pau@xxxxxxxxxx> wrote:
>> > + /*
>> > + * Load the section headers.
>> > + *
>> > + * NB: this _must_ be done one by one, and taking the bitness into
>> > account,
>> > + * so that the guest can treat this as an array of type
>> > Elf{32/64}_Shdr.
>> > + */
>> > + shdr_size = elf_64bit(elf) ? sizeof(Elf64_Shdr) : sizeof(Elf32_Shdr);
>> > + for ( i = 0; i < ELF_BSDSYM_SECTIONS; i++ )
>> > + {
>> > + if ( elf_64bit(elf) )
>> > + shdr = &header.elf_header.section[i].e64;
>> > + else
>> > + shdr = &header.elf_header.section[i].e32;
>> > +
>> > + rc = elf_load_image(elf, header_base + ehdr_size + shdr_size * i,
>> > + ELF_REALPTR2PTRVAL(shdr), shdr_size,
>> > shdr_size);
>>
>> You shouldn't read shdr_size bytes here, but only sizeof() ones.
>
> Well, shdr_size is just the result of a sizeof.
Oh, I didn't even spot that - it makes things worse: The value gets
retrieved correctly earlier on.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |