Module Name: src Committed By: martin Date: Wed May 13 18:08:38 UTC 2020
Modified Files: src/lib/libc/gen [netbsd-9]: pthread_atfork.c src/libexec/ld.elf_so [netbsd-9]: rtld.c rtld.h symbols.map Log Message: Pull up following revision(s) (requested by chs in ticket #907): libexec/ld.elf_so/rtld.c: revision 1.205 libexec/ld.elf_so/rtld.h: revision 1.140 libexec/ld.elf_so/symbols.map: revision 1.3 libexec/ld.elf_so/symbols.map: revision 1.4 lib/libc/gen/pthread_atfork.c: revision 1.13 lib/libc/gen/pthread_atfork.c: revision 1.14 libexec/ld.elf_so/rtld.h: revision 1.139 libexec/ld.elf_so/rtld.c: revision 1.204 Introduce intermediate locking for fork, so that the dynamic linker is in a consistent state. This most importantly avoids races between dlopen and friends and fork, potentially resulting in dead locks in the child when it itself tries to acquire locks. Rename __atomic_fork to __locked_fork and give it &errno as argument. rtld and libc use different storage, so the initial version would incorrectly report the failure reason for fork(). There is still a small race condition inside ld.elf_so as it doesn't use thread-safe errno internally, but that's a more contained internal issue. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.10.18.1 src/lib/libc/gen/pthread_atfork.c cvs rdiff -u -r1.197.2.3 -r1.197.2.4 src/libexec/ld.elf_so/rtld.c cvs rdiff -u -r1.136 -r1.136.2.1 src/libexec/ld.elf_so/rtld.h cvs rdiff -u -r1.2 -r1.2.8.1 src/libexec/ld.elf_so/symbols.map Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.