[PATCH V2] libelf/elf_end.c: check data_list.data.d.d_buf before free it
Fri Aug 31 02:14:00 GMT 2018
On 08/31/2018 03:57 AM, Mark Wielaard wrote:
> On Wed, Aug 29, 2018 at 04:53:20PM +0800, Robert Yang wrote:
>> The one which actually saves the data is data_list.data.d.d_buf, so check it
>> before free rawdata_base.
>> This can fix a segmentation fault when prelink libqb_1.0.3:
>> prelink: /usr/lib/libqb.so.0.18.2: Symbol section index outside of section numbers
>> The segmentation fault happens when prelink call elf_end().
> Are you sure this isn't a bug in prelink like we discussed last time?
> If it isn't, can you give a short example how this issue happens?
Sorry, I can't make sure which ones is wrong, libqb, prelink or elfutils, this
happens when cross compiling, and I've built more than 4 hunderds of packages,
libqb 1.0.3 is the only package which has the problem, I've also fixed prelink,
but it is another segmentation fault error. I've reported this problem to libqb
community, then they make another branch for libqb, and it works well without
any errors, the branch is topic-no-ldsection, and the commit is:
I've used gdb/valgrind to debug this segfault, but can't find prelink's distinct
problem, the only problem I found is that elfutil's elf_end() free() a NULL
memory, so I made this patch.
I think that someone who uses libqb_1.0.3 + elfutils + prelink + crosscompile
would meet the same problem.
More information about the Elfutils-devel