[PATCH V2] libelf/elf_end.c: check data_list.data.d.d_buf before free it

Robert Yang liezhi.yang@windriver.com
Mon Sep 3 01:32:00 GMT 2018

On 08/31/2018 05:35 PM, Mark Wielaard wrote:
> Hi Robert,
> On Fri, 2018-08-31 at 10:17 +0800, Robert Yang wrote:
>> 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:
>> https://github.com/ClusterLabs/libqb/commit/358e0120d8cd288095907869d3f8da92937188a0
> So, this is a separate issue? Or does the prelink problem also go away
> when using that commit/branch?
>> 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.
> OK. So I believe that is because prelink's error handling seems wrong.
> It seems to assume it adding the ELF data buffer itself, so frees it,
> but the data actually seemed to come from elf_getdata, so shouldn't
> have been freed by prelink.

Thanks, I will investigate that.

// Robert

> Thanks,
> Mark

More information about the Elfutils-devel mailing list