@@ -394,18 +394,18 @@ void ScanGlobalRange(uptr begin, uptr end, Frontier *frontier) {
394394}
395395
396396template <class Accessor >
397- void ScanExtraStack (const InternalMmapVector<Range> &ranges, Frontier *frontier,
398- Accessor &accessor) {
397+ void ScanRanges (const InternalMmapVector<Range> &ranges, Frontier *frontier,
398+ const char *region_type, Accessor &accessor) {
399399 for (uptr i = 0 ; i < ranges.size (); i++) {
400- ScanForPointers (ranges[i].begin , ranges[i].end , frontier, " FAKE STACK " ,
400+ ScanForPointers (ranges[i].begin , ranges[i].end , frontier, region_type ,
401401 kReachable , accessor);
402402 }
403403}
404404
405405void ScanExtraStackRanges (const InternalMmapVector<Range> &ranges,
406406 Frontier *frontier) {
407407 DirectMemoryAccessor accessor;
408- ScanExtraStack (ranges, frontier, accessor);
408+ ScanRanges (ranges, frontier, " FAKE STACK " , accessor);
409409}
410410
411411# if SANITIZER_FUCHSIA
@@ -499,7 +499,7 @@ static void ProcessThread(tid_t os_id, uptr sp,
499499 ScanForPointers (stack_begin, stack_end, frontier, " STACK" , kReachable ,
500500 accessor);
501501 GetThreadExtraStackRangesLocked (os_id, &extra_ranges);
502- ScanExtraStack (extra_ranges, frontier, accessor);
502+ ScanRanges (extra_ranges, frontier, " FAKE STACK " , accessor);
503503 }
504504
505505 if (flags ()->use_tls ) {
@@ -521,13 +521,14 @@ static void ProcessThread(tid_t os_id, uptr sp,
521521 }
522522 }
523523# if SANITIZER_ANDROID
524+ extra_ranges.clear ();
524525 auto *cb = +[](void *dtls_begin, void *dtls_end, uptr /* dso_idd*/ ,
525526 void *arg) -> void {
526- ScanForPointers (
527- reinterpret_cast <uptr>(dtls_begin), reinterpret_cast <uptr>(dtls_end ),
528- reinterpret_cast <Frontier *>(arg), " DTLS " , kReachable , accessor );
527+ reinterpret_cast <InternalMmapVector<Range> *>(arg)-> push_back (
528+ { reinterpret_cast <uptr>(dtls_begin),
529+ reinterpret_cast <uptr>(dtls_end)} );
529530 };
530-
531+ ScanRanges (extra_ranges, frontier, " DTLS " , accessor);
531532 // FIXME: There might be a race-condition here (and in Bionic) if the
532533 // thread is suspended in the middle of updating its DTLS. IOWs, we
533534 // could scan already freed memory. (probably fine for now)
0 commit comments