#
42b38843 |
|
16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line .h pattern Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
|
#
4d846d26 |
|
10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
|
#
7444f54b |
|
30-Aug-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: style the rest of rtld_lock.c Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36396
|
#
a687683b |
|
30-Aug-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: mask signals for default read locks Rtld locks from libthr defer signals delivery, which means that binding is not possible while a signal handler is executed. Binding might upgrade read-locked rtld_bind_lock to write-lock, if symbol resolution requires loading filters. If a signal would be delivered while rtld is in read-locked section, and signal handler needs binding which upgrades the lock, for non-threaded image that uses default rtld locks, we get the rtld data structures modified under the top-level active rtld frame. To correct the problem, mask signals for read-locking of default locks in addition to the write-locking. It is very cheap now with sigfastblock(2). Note that the global state is used to track pre-locked state of either sigfastblock(2) or signal mask (if sigfastblock(2) is administratively disabled). It is fine for non-threaded images since there are no other threads. But I believe that it is fine for threaded images using libc_r as well, since masking signals disables preemption (I did not tested it). NetBSD PR: https://gnats.netbsd.org/56979 Reported by: tmunro Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36396
|
#
529ab5a7 |
|
11-May-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: initialize default dlerror_seen_val as true There should be no error after startup. PR: 255698 Reported by: Eugene M. Kim <astralblue@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 1 week
|
#
4d9128da |
|
07-Apr-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: make dlerror() thread-local PR: 95339 Discussed with: arichardson Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29633
|
#
08bfbd43 |
|
10-Apr-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: workaround for broken ABI Right now, libthr does not initialize RtldLockInfo.rtli_version when calling _rtld_thread_init(), which makes versioning the interface troublesome. Add a workaround: if the calling object of _rtld_thread_init() exports the "_pli_rtli_version" symbol, then consider rtli_version initialized. Otherwise, forcibly set it to RTLI_VERSION_ONE, currently defined as RTLI_VERSION. Export "_pli_rtli_version" from libthr and properly initialize rtli_version. Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29633
|
#
4d7f08c8 |
|
10-Apr-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: unstaticise lockinfo and obj_from_addr() Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29633
|
#
aef199e5 |
|
08-Feb-2020 |
Konstantin Belousov <kib@FreeBSD.org> |
Use sigfastblock(2) in rtld. This allows for rtld to not issue two sigprocmask(2) syscalls for each symbol binding operation in single-threaded processes. Rtld needs to block signals as part of locking to ensure signal safety of the bind process, because signal handlers might need to lazily resolve symbol references. As result, number of syscalls issued on startup by simple programs not using libthr, is typically reduced 2x. For instance, for hello world, I see: non-sigfastblock # (truss ./hello > /dev/null) |& wc -l 63 sigfastblock # (truss ./hello > /dev/null) |& wc -l 37 Tested by: pho Disscussed with: cem, emaste, jilles Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D12773
|
#
b54a59f3 |
|
30-Jun-2019 |
Alex Richardson <arichardson@FreeBSD.org> |
Reduce size of rtld by 22% by pulling in less code from libc Currently RTLD is linked against libc_nossp_pic which means that any libc symbol used in rtld can pull in a lot of depedencies. This was causing symbol such as __libc_interposing and all the pthread stubs to be included in RTLD even though they are not required. It turns out most of these dependencies can easily be avoided by providing overrides inside of rtld. This change is motivated by CHERI, where we have an experimental ABI that requires additional relocation processing to allow the use of function pointers inside of rtld. Instead of adding this self-relocation code to RTLD I attempted to remove most function pointers from RTLD and discovered that most of them came from the libc dependencies instead of being actually used inside rtld. A nice side-effect of this change is that rtld is now 22% smaller on amd64. text data bss dec hex filename 0x21eb6 0xce0 0xe60 145910 239f6 /home/alr48/ld-elf-x86.before.so.1 0x1a6ed 0x728 0xdd8 113645 1bbed /home/alr48/ld-elf-x86.after.so.1 The number of R_X86_64_RELATIVE relocations that need to be processed on startup has also gone down from 368 to 187 (almost 50% less). Reviewed By: kib Differential Revision: https://reviews.freebsd.org/D20663
|
#
3ab5b6bd |
|
29-Oct-2018 |
Alex Richardson <arichardson@FreeBSD.org> |
rtld-elf: fix more warnings to allow compiling with WARNS=6 Reviewed By: kib Approved By: brooks (mentor) Differential Revision: https://reviews.freebsd.org/D17154
|
#
e6209940 |
|
27-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
libexec: adoption of SPDX licensing ID tags. Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended.
|
#
b88a8d3d |
|
10-Jan-2017 |
Konstantin Belousov <kib@FreeBSD.org> |
Fix acquisition of nested write compat rtld locks. Obtaining compat rtld lock in write mode sets process signal mask to block all signals. Previous mask is stored in the global variable oldsigmask. If a lock is write-locked while another lock is already write-locked, oldsigmask is overwritten by the total mask and on the last unlock, all signals except traps appear to be blocked. Fix this by counting the write-lock nested level, and only storing to oldsigmask/restoring from it at the outermost level. Masking signals disables involuntary preemption for libc_r, and there could be no voluntary context switches in the locked code (dl_iterate_phdr(3) keeps a lock around user callback, but it was added long after libc_r was renounced). Due to this, remembering the level in the global variable after the lock is obtained should be safe, because no two libc_r threads can acquire different write locks in parallel. PR: 215826 Reported by: kami Tested by: yamagi@yamagi.org (previous version) To be reviewed by: kan Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
|
#
e7bfd34b |
|
10-Jan-2017 |
Konstantin Belousov <kib@FreeBSD.org> |
Use ANSI C definitions, update comment. Sponsored by: The FreeBSD Foundation MFC after: 1 week
|
#
0c4f9ecd |
|
29-Mar-2015 |
Konstantin Belousov <kib@FreeBSD.org> |
Change compiler setting to make default visibility of the symbols for rtld on x86 to be hidden. This is a micro-optimization, which allows intrinsic references inside rtld to be handled without indirection through PLT. The visibility of rtld symbols for other objects in the symbol namespace is controlled by a version script. Reviewed by: kan, jilles Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
|
#
1c70d007 |
|
24-May-2014 |
Konstantin Belousov <kib@FreeBSD.org> |
Right now, the rtld prefork hook locks the rtld bind lock in the read mode. This allows the binder to be functional in the child after the fork (assuming no lazy loading of a filter is needed), but other rtld services which require write lock on rtld_bind_lock cause deadlock, if called by child. Change the _rtld_atfork() to lock the bind lock in write mode, making the rtld fully functional after the fork. Pre-resolve the symbols which are called by the libthr' fork() interposer, since dynamic resolution causes deadlock due to the rtld_bind_lock already owned in the write mode. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
|
#
0e9a2605 |
|
24-Aug-2011 |
Konstantin Belousov <kib@FreeBSD.org> |
Rtld links with the specially built pic static libc library to get some C runtime services, like printf(). Unfortunately, the multithread-safeness measures in the libc do not work in rtld environment. Rip the kernel printf() implementation and use it in the rtld instead of libc version. This printf does not require any shared global data and thus is mt-safe. Systematically use rtld_printf() and related functions, remove the calls to err(3). Note that stdio is still pulled from libc due to libmap implementaion using fopen(). This is safe but unoptimal, and can be changed later. Reported and tested by: pgj Diagnosed and reviewed by: kan (previous version) Approved by: re (bz)
|
#
a7bc470a |
|
09-Feb-2011 |
Konstantin Belousov <kib@FreeBSD.org> |
Use sigsetjmp/siglongjmp with disabled signal mask access for lock upgrade in rtld. There is no need to care about the mask, which causes a lot of unneeded sigprocmask(2) calls during each symbol lookup.
|
#
8569deaf |
|
25-Dec-2010 |
Konstantin Belousov <kib@FreeBSD.org> |
Implement support for ELF filters in rtld. Both normal and auxillary filters are implemented. Filtees are loaded on demand, unless LD_LOADFLTR environment variable is set or -z loadfltr was specified during the linking. This forces rtld to upgrade read-locked rtld_bind_lock to write lock when it encounters an object with filter during symbol lookup. Consolidate common arguments of the symbol lookup functions in the SymLook structure. Track the state of the rtld locks in the RtldLockState structure. Pass local RtldLockState through the rtld symbol lookup calls to allow lock upgrades. Reviewed by: kan Tested by: Mykola Dzham <i levsha me>, nwhitehorn (powerpc)
|
#
a7d5f7eb |
|
19-Oct-2010 |
Jamie Gritton <jamie@FreeBSD.org> |
A new jail(8) with a configuration file, to replace the work currently done by /etc/rc.d/jail.
|
#
fe0506d7 |
|
09-Mar-2010 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Create the altix project branch. The altix project will add support for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting is a two-module system, consisting of a base compute module and a CPU expansion module. SGI's NUMAFlex architecture can be an excellent platform to test CPU affinity and NUMA-aware features in FreeBSD.
|
#
3f2f85a6 |
|
20-Apr-2009 |
Robert Watson <rwatson@FreeBSD.org> |
Prefer <sys/param.h> to <machine/param.h> for the definition of CACHE_LINE_SIZE. Submitted by: bde MFC after: 2 weeks
|
#
d9d845a9 |
|
19-Apr-2009 |
Robert Watson <rwatson@FreeBSD.org> |
Explicitly include machine/param.h for CACHE_LINE_SIZE. MFC after: 2 weeks
|
#
cb5c4b10 |
|
27-Nov-2008 |
Konstantin Belousov <kib@FreeBSD.org> |
Add two rtld exported symbols, _rtld_atfork_pre and _rtld_atfork_post. Threading library calls _pre before the fork, allowing the rtld to lock itself to ensure that other threads of the process are out of dynamic linker. _post releases the locks. This allows the rtld to have consistent state in the child. Although child may legitimately call only async-safe functions, the call may need plt relocation resolution, and this requires working rtld. Reported and debugging help by: rink Reviewed by: kan, davidxu MFC after: 1 month (anyway, not before 7.1 is out)
|
#
d7f03759 |
|
19-Oct-2008 |
Ulf Lilleengen <lulf@FreeBSD.org> |
- Import the HEAD csup code which is the basis for the cvsmode work.
|
#
d8b04dc0 |
|
15-Sep-2008 |
David Xu <davidxu@FreeBSD.org> |
Allow multiple locks to be acquired by detecting corresponding bit flag, otherwise if a thread acquired a lock, another thread or the current thread itself can no longer acquire another lock because thread_mask_set() return whole flag word, this results bit leaking in the word and misbehavior in later locking and unlocking.
|
#
e91ff25c |
|
06-May-2008 |
Konstantin Belousov <kib@FreeBSD.org> |
Fix the problem with the C++ exception handling for the multithreaded programs. From the PR description: The gcc runtime's _Unwind_Find_FDE function, invoked during exception handling's stack unwinding, is not safe to execute from within multiple threads. FreeBSD' s dl_iterate_phdr() however permits multiple threads to pass through it though. The result is surprisingly reliable infinite looping of one or more threads if they just happen to be unwinding at the same time. Introduce the new lock that is write locked around the dl_iterate_pdr, thus providing required exclusion for the stack unwinders. PR: threads/123062 Submitted by: Andy Newman <an at atrn org> Reviewed by: kan MFC after: 2 weeks
|
#
fb6395da |
|
03-Apr-2007 |
Alexander Kabaev <kan@FreeBSD.org> |
Use u_int for variable manipulated by atomic ops to match atomic ops function prototypes.
|
#
165204a7 |
|
16-Nov-2004 |
John Baldwin <jhb@FreeBSD.org> |
Remove 80386 support from the ELF run time linker.
|
#
5908d366 |
|
04-Jul-2004 |
Stefan Farfeleder <stefanf@FreeBSD.org> |
Consistently use __inline instead of __inline__ as the former is an empty macro in <sys/cdefs.h> for compilers without support for inline.
|
#
6d5d786f |
|
29-May-2003 |
Alexander Kabaev <kan@FreeBSD.org> |
Allow threading libraries to register their own locking implementation in case default one provided by rtld is not suitable. Consolidate various identical MD lock implementation into a single file using appropriate machine/atomic.h. Approved by: re (scottl)
|