This is an archive of the discontinued LLVM Phabricator instance.

[LSAN][Fuchsia] Added ForEachExtraThreadStackRange to support Fuchsia code.
ClosedPublic

Authored by kstoimenov on Jan 13 2023, 1:29 PM.

Diff Detail

Event Timeline

kstoimenov created this revision.Jan 13 2023, 1:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2023, 1:29 PM
kstoimenov requested review of this revision.Jan 13 2023, 1:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2023, 1:29 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
kstoimenov retitled this revision from [LSAN][Fuchsia] Added ForEachExtraThreadStackRange tp support Fuchsia code. to [LSAN][Fuchsia] Added ForEachExtraThreadStackRange to support Fuchsia code..Jan 13 2023, 1:30 PM
vitalybuka added inline comments.
compiler-rt/lib/lsan/lsan_common.h
112–116

why do we both?

kstoimenov added inline comments.Jan 13 2023, 1:37 PM
compiler-rt/lib/lsan/lsan_common.h
112–116

Because code in lsan_common_fuchsia.cpp should not depend on LSAN specific function like GetLsanThreadRegistryLocked. That is the reason why we were getting unresolved external for ASAN builds.

Removed callback.

vitalybuka added inline comments.Jan 13 2023, 2:00 PM
compiler-rt/lib/asan/asan_thread.cpp
536

void* to actual type

compiler-rt/lib/lsan/lsan_thread.cpp
77–78

remove ForEachExtraStackRange and use GetExtraThreadStackRanges instead

77–78

GetExtraThreadStackRanges(os_id, vector<>...)

vitalybuka added inline comments.Jan 13 2023, 2:15 PM
compiler-rt/lib/asan/asan_thread.cpp
509–510
compiler-rt/lib/lsan/lsan_common_fuchsia.cpp
154

P1, ingore other comment if this one works

I guess the only problem that we have empty SuspendedThreadsListFuchsia

instead of stuff on line 149
maybe introduce lsan::GetAllThreads() and use it
for params->callback(
lsan::GetAllThreads(), params->argument)

Removed callbacks.

I've removed callbacks from the interface. PTAL.

vitalybuka added inline comments.Jan 13 2023, 3:08 PM
compiler-rt/lib/lsan/lsan_common_fuchsia.cpp
154

P1, ingore other comment if this one works

I guess the only problem that we have empty SuspendedThreadsListFuchsia

instead of stuff on line 149
maybe introduce lsan::GetAllThreads() and use it
for params->callback(
lsan::GetAllThreads(), params->argument)

what about this? seems easy and will make fuchsia loop consistent with the rest

kstoimenov added inline comments.Jan 13 2023, 3:29 PM
compiler-rt/lib/lsan/lsan_common_fuchsia.cpp
154

Could you please elaborate or provide sample code?

Added ScanExtraStackRanges.

I think this should work. I added ScanExtraStackRanges helper which is used both by lsan_common.cpp and lsan_common_fuchsia.cpp.

vitalybuka added inline comments.Jan 13 2023, 5:05 PM
compiler-rt/lib/lsan/lsan_common_fuchsia.cpp
148–154
vitalybuka added inline comments.Jan 13 2023, 5:10 PM
compiler-rt/lib/lsan/lsan_common_fuchsia.cpp
148–154

I see, this does not work :(
Please upload your favorite snapshot.

Fixed fuchsia.

Fixed compilation on Fuchsia.

kstoimenov added inline comments.Jan 13 2023, 5:53 PM
compiler-rt/lib/lsan/lsan_common_fuchsia.cpp
148–154

This shapshot compiles on Fuchsia.

remove GetAllThreads

vitalybuka accepted this revision.Jan 13 2023, 9:20 PM
This revision is now accepted and ready to land.Jan 13 2023, 9:20 PM
This revision was landed with ongoing or failed builds.Jan 13 2023, 9:21 PM
This revision was automatically updated to reflect the committed changes.