rtld - do not allow both dynamic DTV index and static TLS offset* If we are allocating static offset for an object with dynamic index, return failure. In the opposite case, if dynamic index is re
rtld - do not allow both dynamic DTV index and static TLS offset* If we are allocating static offset for an object with dynamic index, return failure. In the opposite case, if dynamic index is requested for statically allocated TLS area, directly use the offset instead of setting the index. Taken from FreeBSD, commit 91880e07f605edb90339685bc934699a4344de3b.* While there, fix dtv timing race between threads.Co-authored-by: Matthew Dillon <dillon@apollo.backplane.com>Reported-by: Stephane Russell <srussell@prodigeinfo.qc.ca>
show more ...
rtld - Improve error reporting* Prefix hex type values with 0x* Include (%s) obj->path so the user has some idea which file is responsible for the error.Requested-by: servik
rtld: Handle non-PLT type 37 relocations. Mainly to unbreak certain use cases of ifunc.
rtld: Extract reloc_iresolve_one(). Will be used to properly handle non-PLT 37 ifunc relocations in -pie.
rtld(1): Fix building with -fno-common.-fno-common will be default in future compilers (GCC 10, for example).
rtld - Use kern.tls_extra* Use kern.tls_extra, if available, to calculate the extra tls space to allocate for late library loads.* If not available, default to 6144 bytes instead of 1280 bytes
rtld - Use kern.tls_extra* Use kern.tls_extra, if available, to calculate the extra tls space to allocate for late library loads.* If not available, default to 6144 bytes instead of 1280 bytes to support greater use of static tls sections in late-loaded libraries (read: mesa 19.3).Reported-by: ftigeot
rtld - Remove 'register' keyword* Remove use of 'register'.
rtld-elf - Fix ancient C code* Adjust malloc() (used only by rtld-elf) to use size_t and fix a number of shift operations.Submitted-by: swildner
libc - Implement sigblockall() and sigunblockall()* Signal safety is becoming a defacto requirement for most of libc and pthreads. In particular, the memory allocator. Given the chances of te
libc - Implement sigblockall() and sigunblockall()* Signal safety is becoming a defacto requirement for most of libc and pthreads. In particular, the memory allocator. Given the chances of teaching tens of thousands of programmers about signal safety, and just making it work in libc and pthreads, only one of these two possibilities is actually realizable. In particular, high-level languages have become so complex, and some applications (chrome, firefox, etc) have become so complex, that the code is regularly tripping over signal safety issues. However, implementing signal safety with current mechanisms is extremely expensive due to the need for multiple system calls. To whit, DragonFlyBSD now has a mechanism that does not require system calls in the critical path.* Implement sigblockall() and sigunblockall(). These functions leverage the new /dev/lpmap per-thread shared page mechanism to provide a way to temporary block the dispatch of all maskable signals without having to make any system calls. These are extremely fast routines. - Reentrant / Recursable - Temporarily blocks any dispatch of a maskable asynchronous signal to the calling thread. Other threads are not affected... this is a per-thread mechanism. - The last sigunblockall() will immediately dispatch any blocked signals. - The normal signal mask is not affected by these routines. - Does not block signals caused by synchronous traps. - The current recursion count is retained on [v]fork() to ease coding and to also allow signals to be temporarily blocked across a fork until the child process is ready to deal with them, if desired.* Implement signal safety for most of pthreads. All temporary internal mutexes are now wrapped with sigblockall() and sigunblockall().* Implement signal safety for the malloc subsystem. All functions are wrawpped with sigblockall() and sigunblockall(). These implementations make lang/mono and lang/rust far more reliable than they were before. Where 9 out of 10 builds used to fail, now they succeed.
Cleanup <sys/uio.h> includes. No longer needed after <sys/ktrace.h> cleanup.
world/kernel: Use the rounddown2() macro in various places.Tested-by: zrj
world/kernel: Use the powerof2() macro in various places.
rtld - Support static TLS bindings for late-loaded shared libraries* Allow late (manual) dlopen()s to load shared libraries which use static TLS variables, as long as there is space. Do proper
rtld - Support static TLS bindings for late-loaded shared libraries* Allow late (manual) dlopen()s to load shared libraries which use static TLS variables, as long as there is space. Do proper late-binding and initialize the area for all threads.* rtld will cache a symbol lookup on first-need for: "_pthread_distribute_static_tls" and then call it as needed to initialize late-bound static TLS space. This symbol is weakly bounded to __libc_distribute_static_tls in libc, and strongly overridden by _libthread_distribute_static_tls in libthread_xu.* Fixes mesa glx-tls and others.* Test code from FreeBSD. Also tested with other combinations including a pthread_create() and -static compilation. https://github.com/dumbbell/test-tls-initial-exec
rtld-elf - Notify thread state to optimize relocations* Add shims to allow libthread_xu to notify rtld when threading is being used.* Requires weak symbols in libc which are overriden by rtld-e
rtld-elf - Notify thread state to optimize relocations* Add shims to allow libthread_xu to notify rtld when threading is being used.* Requires weak symbols in libc which are overriden by rtld-elf.* Implement the feature in rtld-elf and use it to avoid making calls to lwp_gettid(). When threaded, use tls_get_tcb() (which does not require a system call) instead of lwp_gettid(). When not threaded, just use a constant. NOTE: We cannot use tls_get_tcb() unconditionally because the tcb is not setup during early relocations. So do this whack-a-mole to make it work.* This leaves just the sigprocmask wrappers around rtld-elf (which are needed to prevent stacked relocations from signal handlers).Poked-by: mjg
i386 removal, part 71/x: Remove legacy FreeBSD brand.We had a compat layer in i386 that was intended to run old DragonFlybinaries from <1.2 times if my memory serves well. That also workedwith Fr
i386 removal, part 71/x: Remove legacy FreeBSD brand.We had a compat layer in i386 that was intended to run old DragonFlybinaries from <1.2 times if my memory serves well. That also workedwith FreeBSD 4.x binaries. It was removed in part 7 and 8 of thiscommit series.This commit reverts cee191cabfed209fdad9972bd88be5b18e310361.It also removes all references to ld-elf.so.1.Reported-by: zrj
Use .Fn for function names in some manual pages.
rtld-elf - Allow dynamic (late) relocations to relro section (2)* Add missing header file adjustment
rtld-elf - Allow dynamic (late) relocations to relro section* Normally the relro section is mprotect()ed to read-only after normal load relocations.* It appears that some programs can issue dyn
rtld-elf - Allow dynamic (late) relocations to relro section* Normally the relro section is mprotect()ed to read-only after normal load relocations.* It appears that some programs can issue dynamic relocations at run-time to such sections.* If the relro mprotect has been done on an object, temporarily mprotect the object back to RW to execute the relocation, then mprotect it back to RO.Reported-by: marino
rtld-elf: -e is an ld(1) option.
calloc - Work around gcc-8 bug (2).GCC-8 at -O2 improperly tries to optimize calloc() replacement even formalloc+bzero sequence back to calloc from calloc itself. This affectsboth main root's she
calloc - Work around gcc-8 bug (2).GCC-8 at -O2 improperly tries to optimize calloc() replacement even formalloc+bzero sequence back to calloc from calloc itself. This affectsboth main root's shell (tcsh as default) and ld-elf.so dynamic linker.Explicitly use -fno-builtin-malloc to prevent that at any -Ox level.
rtld - Fix ifunc relocations* ifunc relocations had a bug that caused an immediate seg-fault. Apparently this type of relocation is not used very much, we've never encountered it before. But t
rtld - Fix ifunc relocations* ifunc relocations had a bug that caused an immediate seg-fault. Apparently this type of relocation is not used very much, we've never encountered it before. But the qemu port uses it.* Fix the bug. Basically missing lockstate and the top level in rtld was expected to hold the bind lock.
buildworld: Mark few special PROG cases.When NOSHARED is set it leads to undesirable link commands having both -sharedand -static arguments. Avoid that.
rtld: Remove unneeded CSTD, our default is gnu99.
pthreads - Fix rtld-elf and libthread_xu* Fixes chrome, thunderbird, and multiple other issues with recent libpthreads work.Testing-by: mneumann, dillon
rtld - Add fork hooks for libthread_xu to install* Add fork hooks for libthread_xu to install. rtld must acquire its locks exclusively during a fork, and then release them after the fork is co
rtld - Add fork hooks for libthread_xu to install* Add fork hooks for libthread_xu to install. rtld must acquire its locks exclusively during a fork, and then release them after the fork is complete, to prevent the fork() from catching the locks in a bad state. See libthread_xu.
12345678