[flang-commits] [clang] [compiler-rt] [clang-tools-extra] [mlir] [libunwind] [libcxxabi] [llvm] [lldb] [libcxx] [flang] [lld] [libc] [asan] Install `pthread_atfork` (PR #75290)
Rainer Orth via flang-commits
flang-commits at lists.llvm.org
Thu Dec 21 05:57:43 PST 2023
rorth wrote:
> I'll give such a patch a try...
That would be something like
```
int internal_fork(void) {
// Call syscall directly to avoid pthread_atfork handler processing.
//
// This is highly unportable on Solaris since syscalls are an implementation
// detail subject to change.
return syscall(SYS_forksys, 0, 0);
}
```
Unfortunately, this fails miserably: at least every asan test that invokes the `llvm-symbolizer` fails like
```
==4030==Launching Symbolizer process: /usr/bin/llvm-symbolizer --demangle --inlines --default-arch=i386
==4031==Waiting on the process failed (errno 10).
==4031==WARNING: external symbolizer didn't start up correctly!
```
>From all I could learn from the OpenSolaris `libc` code (`lib/libc/port/threads/scalls.c` (`forkx`), it seems that there happens so much processing on `libc`-internal data structures that cannot simply be skipped that there's no reasonable chance to run `fork` without the handlers. Expecting to be able to seems to be hack that may work on some platforms, but not on others.
https://github.com/llvm/llvm-project/pull/75290
More information about the flang-commits
mailing list