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

Mark Wielaard mark@klomp.org
Fri Aug 31 09:35:00 GMT 2018

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.



More information about the Elfutils-devel mailing list