On 04/12/17 02:08 PM, Doug Moore wrote:
> It's not clear to me that the cache is thread-safe; I don't see any locking
> going on, so I wonder if there might be problems with multiple threads
> reading/writing the global cache at once.  Has this problem been addressed?

Gparser.c calls lock_acquire and lock_release if caching is UNW_CACHE_GLOBAL

http://git.savannah.gnu.org/gitweb/?p=libunwind.git;a=blob;f=src/dwarf/Gparser.c;h=ede856e053e5d1716058d2e56165e9feb4a670e6;hb=HEAD#l571

which are macros around sigprocmask + taking the lock with pthread_mutex_lock

http://git.savannah.gnu.org/gitweb/?p=libunwind.git;a=blob;f=include/libunwind_i.h;h=ee2ea2fbec327b1f812baabbab98191ded830c56;hb=HEAD#l199

For thread-local cache, it is indeed not really safe, looks like the
TLS part of it was removed at some point in the past, and we should
fix it eventually:

http://git.savannah.gnu.org/gitweb/?p=libunwind.git;a=blob;f=include/dwarf.h;h=e29b8400ea90719d196cffebd184829ca12a0b98;hb=HEAD#l41

_______________________________________________
Libunwind-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to