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: [PATCH] libelf: find 1st section instead of assuming


Hi John,

On Thu, Jun 23, 2016 at 05:31:59PM +0200, John Ogness wrote:
> The situation occurs when adding sections to an existing ELF file that
> has none. You can see that in:
> 
>     libelf/elf_begin.c:file_read_elf()
> 
> When an ELF file is opened with ELF_C_RDWR or ELF_C_RDWR_MMAP, scnmax is
> set to 1. That leads to the first section being placed on the second
> section list when elf_newscn() is called.
> 
> Below is a relatively simple program to demonstrate this.

Thanks. None of our existing tests cover this. So I adapted one of them
and created a testcase that fails before your fix and succeeds after.
It does the same test for all combinations of ELF class 32/64 and
ELF_C_RDWR[_MMAP] to make sure all different code paths are hit.
I also added a ChangeLog entry.

Cheers,

Mark

Attachment: 0001-libelf-find-1st-section-instead-of-assuming.patch
Description: Text document


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