Skip to content

Commit 5c9dedc

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.4
1 parent 9a4661c commit 5c9dedc

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

compiler-rt/lib/lsan/lsan_common.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -373,18 +373,18 @@ void ScanGlobalRange(uptr begin, uptr end, Frontier *frontier) {
373373
}
374374

375375
template <class Accessor>
376-
void ScanExtraStack(const InternalMmapVector<Range> &ranges, Frontier *frontier,
377-
Accessor &accessor) {
376+
void ScanRanges(const InternalMmapVector<Range> &ranges, Frontier *frontier,
377+
const char *region_type, Accessor &accessor) {
378378
for (uptr i = 0; i < ranges.size(); i++) {
379-
ScanForPointers(ranges[i].begin, ranges[i].end, frontier, "FAKE STACK",
379+
ScanForPointers(ranges[i].begin, ranges[i].end, frontier, region_type,
380380
kReachable, accessor);
381381
}
382382
}
383383

384384
void ScanExtraStackRanges(const InternalMmapVector<Range> &ranges,
385385
Frontier *frontier) {
386386
DirectMemoryAccessor accessor;
387-
ScanExtraStack(ranges, frontier, accessor);
387+
ScanRanges(ranges, frontier, "FAKE STACK", accessor);
388388
}
389389

390390
# if SANITIZER_FUCHSIA
@@ -478,7 +478,7 @@ static void ProcessThread(tid_t os_id, uptr sp,
478478
ScanForPointers(stack_begin, stack_end, frontier, "STACK", kReachable,
479479
accessor);
480480
GetThreadExtraStackRangesLocked(os_id, &extra_ranges);
481-
ScanExtraStack(extra_ranges, frontier, accessor);
481+
ScanRanges(extra_ranges, frontier, "FAKE STACK", accessor);
482482
}
483483

484484
if (flags()->use_tls) {
@@ -500,13 +500,13 @@ static void ProcessThread(tid_t os_id, uptr sp,
500500
}
501501
}
502502
# if SANITIZER_ANDROID
503+
extra_ranges.clear();
503504
auto *cb = +[](void *dtls_begin, void *dtls_end, uptr /*dso_idd*/,
504505
void *arg) -> void {
505-
ScanForPointers(
506-
reinterpret_cast<uptr>(dtls_begin), reinterpret_cast<uptr>(dtls_end),
507-
reinterpret_cast<Frontier *>(arg), "DTLS", kReachable, accessor);
506+
reinterpret_cast<InternalMmapVector<Range> *>(arg)->push_back(
507+
reinterpret_cast<uptr>(dtls_begin), reinterpret_cast<uptr>(dtls_end));
508508
};
509-
509+
ScanRanges(extra_ranges, frontier, "DTLS", accessor);
510510
// FIXME: There might be a race-condition here (and in Bionic) if the
511511
// thread is suspended in the middle of updating its DTLS. IOWs, we
512512
// could scan already freed memory. (probably fine for now)

0 commit comments

Comments
 (0)