Issue 161443
Summary Missing tsan interceptor for _longjmp on Mac
Labels new issue
Assignees
Reporter rmacnak-google
    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 https://github.com/dart-lang/sdk/issues/61536.

```c
#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`.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to