This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: elf_cntl(ELF_C_FDREAD) breaks elf64_getshdr() with non-mmap()ed ELF files


On Tue, Jul 17, 2012 at 05:50:28PM +0200, Mark Wielaard wrote:
> The asserts seem too aggressive/wrong in this case. The following
> comment in elf32_getshdr.c (load_shdr_wrlock) explains them:
> 
>       /* All the data is already mapped.  If we could use it
>          directly this would already have happened.  */
> 
> But in the case of elf_cntl (ELF_CREAD) this has not yet happened,
> unless you already accessed the shdrs before that call.

I think the best solution is to just adjust the asserts to take this
into account. Which is what the attached patch does. It also includes
a testcase. Comments?

Thanks,

Mark

Attachment: 0001-elf_getshdr-should-work-for-elf-flags-ELF_F_MALLOCED.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]