-
Couldn't load subscription status.
- Fork 15k
Open
Labels
Description
There is an interceptor for _setjmp but not _longjmp. The causes _longjmp to fail to restore the __tsan_func_entry/__tsan_func_exit stack to its position at _setjmp and can eventually result in overflow and internal TSAN crashes.
Discovered when addressing dart-lang/sdk#61536.
#include <setjmp.h>
__attribute__((noinline))
void foo(jmp_buf* buf) {
_longjmp(*buf, 1);
}
int main() {
jmp_buf buf;
for (int i = 0; i < 10000000; i++) {
if (_setjmp(buf) == 0) {
foo(&buf);
}
}
}This small example crashes with _setjmp/_longjmp, but works with setjmp/longjmp.