[libcxx] [libc] [clang] [lldb] [libcxxabi] [libunwind] [lld] [compiler-rt] [llvm] [clang-tools-extra] [flang] [mlir] [asan] Install `pthread_atfork` (PR #75290)

Rainer Orth via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 19 04:58:18 PST 2023


rorth wrote:

It took me a bit to notice this snippet in `sanitizer_solaris.cpp`:
```
DECLARE__REAL_AND_INTERNAL(int, fork, void) {
  // TODO(glider): this may call user's pthread_atfork() handlers which is bad.
  return _REAL(fork)();
}
```
which didn't show up in searches for `internal_fork`.

>From what I could learn from `libc` disassembly and the OpenSolaris sources, the only way to avoid the handlers on Solaris is to invoke the syscall directly.  This is highly unportable, however: syscalls are an implemention detail that can (and **does**) change.  There's reasonable hope that this won't happen for the remaining livetime of Solaris 11.4, though.

I'll give such a patch a try...

https://github.com/llvm/llvm-project/pull/75290


More information about the cfe-commits mailing list