[PATCH] libdw: add thread-safety to dwarf_getabbrev()

Mark Wielaard mark@klomp.org
Mon Aug 26 13:18:00 GMT 2019


Hi Jonathon,

Thanks for checking our new mailinglist settings :)
You message was accepted now and the HTML attachment stripped.

On Sun, 2019-08-25 at 20:24 -0500, Jonathon Anderson wrote:
> The one extra line in dwarf_getcfi.c
> is to account for a failure in the test suite when Valgrind is
> enabled (didn't catch it the first time around).

That is an interesting catch. And obviously a latent bug. It works if
things are in the first memblock (as part of the larger Dwarf struct),
since that is allocated with calloc, and so zeroed out. But if the cfi
would get into a later memblock it would get a random value, since
those are malloced. In your patch the memblocks are always malloced,
and so the bug shows up immediately.

Lets just cherry-pick this fixup since it is a good fixup to have.

Does the attached look correct?

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libdw-fix-latent-bug-in-dwarf_getcfi.c-not-setting-d.patch
Type: text/x-patch
Size: 1223 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/elfutils-devel/attachments/20190826/10da6ca6/attachment.bin>


More information about the Elfutils-devel mailing list