[compiler-rt] [lsan] Fix compilation on Android (PR #113003)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 18 16:27:08 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/113003.diff
1 Files Affected:
- (modified) compiler-rt/lib/lsan/lsan_common.cpp (+9-9)
``````````diff
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp
index 9aed36b96ce929..c54c1a7cc4930c 100644
--- a/compiler-rt/lib/lsan/lsan_common.cpp
+++ b/compiler-rt/lib/lsan/lsan_common.cpp
@@ -373,10 +373,10 @@ void ScanGlobalRange(uptr begin, uptr end, Frontier *frontier) {
}
template <class Accessor>
-void ScanExtraStack(const InternalMmapVector<Range> &ranges, Frontier *frontier,
- Accessor &accessor) {
+void ScanRanges(const InternalMmapVector<Range> &ranges, Frontier *frontier,
+ const char *region_type, Accessor &accessor) {
for (uptr i = 0; i < ranges.size(); i++) {
- ScanForPointers(ranges[i].begin, ranges[i].end, frontier, "FAKE STACK",
+ ScanForPointers(ranges[i].begin, ranges[i].end, frontier, region_type,
kReachable, accessor);
}
}
@@ -384,7 +384,7 @@ void ScanExtraStack(const InternalMmapVector<Range> &ranges, Frontier *frontier,
void ScanExtraStackRanges(const InternalMmapVector<Range> &ranges,
Frontier *frontier) {
DirectMemoryAccessor accessor;
- ScanExtraStack(ranges, frontier, accessor);
+ ScanRanges(ranges, frontier, "FAKE STACK", accessor);
}
# if SANITIZER_FUCHSIA
@@ -478,7 +478,7 @@ static void ProcessThread(tid_t os_id, uptr sp,
ScanForPointers(stack_begin, stack_end, frontier, "STACK", kReachable,
accessor);
GetThreadExtraStackRangesLocked(os_id, &extra_ranges);
- ScanExtraStack(extra_ranges, frontier, accessor);
+ ScanRanges(extra_ranges, frontier, "FAKE STACK", accessor);
}
if (flags()->use_tls) {
@@ -500,13 +500,13 @@ static void ProcessThread(tid_t os_id, uptr sp,
}
}
# if SANITIZER_ANDROID
+ extra_ranges.clear();
auto *cb = +[](void *dtls_begin, void *dtls_end, uptr /*dso_idd*/,
void *arg) -> void {
- ScanForPointers(
- reinterpret_cast<uptr>(dtls_begin), reinterpret_cast<uptr>(dtls_end),
- reinterpret_cast<Frontier *>(arg), "DTLS", kReachable, accessor);
+ reinterpret_cast<InternalMmapVector<Range> *>(arg)->push_back(
+ reinterpret_cast<uptr>(dtls_begin), reinterpret_cast<uptr>(dtls_end));
};
-
+ ScanRanges(extra_ranges, frontier, "DTLS", accessor);
// FIXME: There might be a race-condition here (and in Bionic) if the
// thread is suspended in the middle of updating its DTLS. IOWs, we
// could scan already freed memory. (probably fine for now)
``````````
</details>
https://github.com/llvm/llvm-project/pull/113003
More information about the llvm-commits
mailing list