Module Name: src
Committed By: joerg
Date: Sun Feb 28 23:12:37 UTC 2021
Modified Files:
src/sys/lib/libunwind: AddressSpace.hpp
Log Message:
Defer acquiring the FDE lock until after the allocation. This can avoid
nesting issues between malloc and backtrace when using LSan.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/lib/libunwind/AddressSpace.hpp
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/lib/libunwind/AddressSpace.hpp
diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.9 src/sys/lib/libunwind/AddressSpace.hpp:1.10
--- src/sys/lib/libunwind/AddressSpace.hpp:1.9 Thu Nov 2 16:09:33 2017
+++ src/sys/lib/libunwind/AddressSpace.hpp Sun Feb 28 23:12:37 2021
@@ -283,7 +283,6 @@ public:
}
bool addFDE(pint_t pcStart, pint_t pcEnd, pint_t fde) {
- pthread_rwlock_wrlock(&fdeTreeLock);
Range *n = (Range *)malloc(sizeof(*n));
n->hdr_base = fde;
n->hdr_start = 0;
@@ -292,6 +291,7 @@ public:
n->last_pc = pcEnd;
n->data_base = 0;
n->ehframe_base = 0;
+ pthread_rwlock_wrlock(&fdeTreeLock);
if (static_cast<Range *>(rb_tree_insert_node(&segmentTree, n)) == n) {
pthread_rwlock_unlock(&fdeTreeLock);
return true;