Skip to content

Resolve assertion failure in LSan #14626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions system/lib/compiler-rt/lib/lsan/lsan_common_emscripten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,15 @@ static void ProcessThreadsCallback(ThreadContextBase *tctx, void *arg) {
// we can for the current thread.
if (tctx->tid == GetCurrentThread()) {
uptr sp = (uptr) __builtin_frame_address(0);
CHECK(stack_begin <= sp && sp < stack_end);
stack_begin = sp;
if (sp < stack_begin || sp >= stack_end) {
// SP is outside the recorded stack range (e.g. the thread is running a
// signal handler on alternate stack, or swapcontext was used).
// Again, consider the entire stack range to be reachable.
LOG_THREADS("WARNING: stack pointer not in stack range.\n");
} else {
// Shrink the stack range to ignore out-of-scope values.
stack_begin = sp;
}
}

ScanRangeForPointers(stack_begin, stack_end, frontier, "STACK", kReachable);
Expand Down