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

Jonathon Anderson jma14@rice.edu
Mon Aug 26 13:37:00 GMT 2019


Looks correct to me (assuming it applies). I think there's another 
latent bug in there somewhere (tests that use libdwfl used to leak 
mem_tails, but now that dwarf_begin_elf doesn't do an initial malloc it 
doesn't trigger), I'll try hunting it down when I have the time.

Glad I could be of help testing the mailinglist :)

-Jonathon

On Mon, Aug 26, 2019 at 8:18 AM, Mark Wielaard <mark@klomp.org> wrote:
> 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



More information about the Elfutils-devel mailing list