History log of /src/lib/libthr/thread/thr_init.c (Results 1 – 25 of 405)
Revision Date Author Comments
# 40a4508c 06-Aug-2025 Brooks Davis <brooks@FreeBSD.org>

libthr: GC unused _sigsuspend()

There are no consumers and it isn't a public symbol.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D51670


# 6b96e7a5 01-Jun-2025 Konstantin Belousov <kib@FreeBSD.org>

libthr/amd64: do not set THR_C_RUNTIME for thr_new() if the main thread did used AMD64_SET_TLSBASE

It is up to the code that organizes the runtime to properly set the
signal handler, and to set %fsb

libthr/amd64: do not set THR_C_RUNTIME for thr_new() if the main thread did used AMD64_SET_TLSBASE

It is up to the code that organizes the runtime to properly set the
signal handler, and to set %fsbase if libthr signal handler is to be
called. The change should leave the CPU state on the signal handler
entry identical to what it was before introduction of TLSBASE, for code
that provides its own startup and thread pointer, but still calls into
libthr as a hack.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

show more ...


# a5b0b2a7 04-Jun-2025 Brooks Davis <brooks@FreeBSD.org>

C runtime: add kernel version guards on exterrctl

This allows userspace to run on a (somewhat) out of date kernel.

Avoid a __FreeBSD_version bump and use the bump from a02180cf60a6 which
has occure

C runtime: add kernel version guards on exterrctl

This allows userspace to run on a (somewhat) out of date kernel.

Avoid a __FreeBSD_version bump and use the bump from a02180cf60a6 which
has occured since exterrctl was added.

Reviewed by: kevans
Fixes: b9c8a07d4dd9 ("C runtime: enable extended error reporting from kernel")
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D50687

show more ...


# b9c8a07d 23-May-2025 Konstantin Belousov <kib@FreeBSD.org>

C runtime: enable extended error reporting from kernel

Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D50483


# 676be271 14-Jan-2025 Konstantin Belousov <kib@FreeBSD.org>

libpthread_init(): ensure curthread == NULL until set explicitly

Otherwise libthr::_get_curthread() returns a garbage kept there from
allocate_initial_tls(), until libthr initialization proceeds eno

libpthread_init(): ensure curthread == NULL until set explicitly

Otherwise libthr::_get_curthread() returns a garbage kept there from
allocate_initial_tls(), until libthr initialization proceeds enough to
set initial pcb->pcb_thread. The garbage pcb_thread was dereferenced
as struct pthread and some memory read as TID. Since the read might not
be consistent between reads, thr_malloc_umtx unlock sometimes returned
EPERM instead of clearing the lock word.

Reported by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

show more ...


# 83aafcdc 14-Nov-2024 Kyle Evans <kevans@FreeBSD.org>

libc, libthr: coordinate stubs for pthread_{suspend,resume}_all_np

If libthr isn't linked into the process, then we don't have any pthreads
to worry about and our stubs can just return success -- th

libc, libthr: coordinate stubs for pthread_{suspend,resume}_all_np

If libthr isn't linked into the process, then we don't have any pthreads
to worry about and our stubs can just return success -- there are none
to suspend/resume.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D47350

show more ...


# 4b202f4f 14-Nov-2024 Kyle Evans <kevans@FreeBSD.org>

libthr: allow very early atfork registration

LSan wants to be able to register atfork handlers at __lsan_init time,
which can happen either at the first intercepted function call or in a
.preinit_ar

libthr: allow very early atfork registration

LSan wants to be able to register atfork handlers at __lsan_init time,
which can happen either at the first intercepted function call or in a
.preinit_array function. Both of these end up being very early in rtld
and executed with the bind lock held, which ends up causing problems
when we go to _libpthread_init().

Instead of requiring libpthread to be initialized, just insert the new
atfork handler straight into the list if it's not ready yet. The
critical section and locking should not be necessary if we're really
executing this early, as there won't be any threads to contend with.

Reviewed by: kib (earlier version), markj
Differential Revision: https://reviews.freebsd.org/D47349

show more ...


# f8bbbce4 06-Mar-2024 Konstantin Belousov <kib@FreeBSD.org>

libthr: remove explicit sys/cdefs.h includes

Sponsored by: The FreeBSD Foundation
MFC after: 1 week


# 0dc52b72 14-Aug-2023 Minsoo Choo <minsoochoo0122@proton.me>

libc: export pthread_getname_np stub

pthread_getname_np needs to be provided by libc in order to import
jemalloc 5.3.0.

A stub implementation for libc pthread_getname_np() is added for
_pthread_stu

libc: export pthread_getname_np stub

pthread_getname_np needs to be provided by libc in order to import
jemalloc 5.3.0.

A stub implementation for libc pthread_getname_np() is added for
_pthread_stubs.c, which always reports empty name for the main thread.

Internal _pthread_getname_np() is not exported, but provided for libc
own use.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41461

show more ...


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 93ca6ff2 15-Apr-2023 Konstantin Belousov <kib@FreeBSD.org>

umtx: allow to configure minimal timeout (in nanoseconds)

PR: 270785
Reviewed by: markj, mav
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org

umtx: allow to configure minimal timeout (in nanoseconds)

PR: 270785
Reviewed by: markj, mav
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39584

show more ...


# e03c7f50 13-Sep-2022 Konstantin Belousov <kib@FreeBSD.org>

libthr: extract code to get main stack base and size into helpers

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differenti

libthr: extract code to get main stack base and size into helpers

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

show more ...


# e2879ece 12-Sep-2022 Konstantin Belousov <kib@FreeBSD.org>

libc, libthr: use AT_USRSTACK{BASE,LIM} instead of sysctl("kern.usrstack") and get_rlimit(RLIMIT_STACK)

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Fo

libc, libthr: use AT_USRSTACK{BASE,LIM} instead of sysctl("kern.usrstack") and get_rlimit(RLIMIT_STACK)

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

show more ...


# ebf7a015 12-Sep-2022 Konstantin Belousov <kib@FreeBSD.org>

libthr: use nitems() for mib length

Suggested by: imp
Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision:

libthr: use nitems() for mib length

Suggested by: imp
Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

show more ...


# f75b1ff6 17-Jan-2022 Mark Johnston <markj@FreeBSD.org>

Revert "libthr: Use kern.stacktop for thread stack calculation."

The current ASLR stack gap feature will be removed, and with that the
need for this change, and the kern.stactop sysctl, is gone. Mo

Revert "libthr: Use kern.stacktop for thread stack calculation."

The current ASLR stack gap feature will be removed, and with that the
need for this change, and the kern.stactop sysctl, is gone. Moreover,
the approach taken in this revision does not provide compatibility for
old copies of libthr.so, and the revision should have also updated
__libc_map_stacks_exec().

This reverts commit 78df56ccfcb40013a3e6904bd6d39836220c3550.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33704

show more ...


# 78df56cc 13-Oct-2021 Dawid Gorecki <dgr@semihalf.com>

libthr: Use kern.stacktop for thread stack calculation.

Use the new kern.stacktop sysctl to retrieve the address of stack top
instead of kern.usrstack. kern.usrstack does not have any knowledge
of t

libthr: Use kern.stacktop for thread stack calculation.

Use the new kern.stacktop sysctl to retrieve the address of stack top
instead of kern.usrstack. kern.usrstack does not have any knowledge
of the stack gap, so this can cause problems with thread stacks.
Using kern.stacktop sysctl should fix most of those problems.
kern.usrstack is used as a fallback when kern.stacktop cannot be read.

Rename usrstack variables to stacktop to reflect this change.

Fixes problems with firefox and thunderbird not starting with
stack gap enabled.

PR: 239873
Reviewed by: kib
Obtained from: Semihalf
Sponsored by: Stormshield
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D31898

show more ...


# 412ef5da 28-Nov-2020 Konstantin Belousov <kib@FreeBSD.org>

libc: Add pthread_attr_get_np(3) stub, reporting ESRCH.

This seems to be required by recent clang asan.
I do not see other way than put the symbol under FBSD_1.0 version.

PR: 251112
Reported by: An

libc: Add pthread_attr_get_np(3) stub, reporting ESRCH.

This seems to be required by recent clang asan.
I do not see other way than put the symbol under FBSD_1.0 version.

PR: 251112
Reported by: Andrew Stitcher <astitcher@apache.org>
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27389

show more ...


# c5c3ba6b 03-Sep-2019 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r351317 through r351731.


# 65174f68 21-Aug-2019 Konstantin Belousov <kib@FreeBSD.org>

Fix _pthread_cancel_enter() and _pthread_cancel_leave() jmptable entries.

PR: 240022
Reported by: Andrew Gierth <andrew@tao11.riddles.org.uk>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days


# 0ab1bfc7 31-Jul-2019 Konstantin Belousov <kib@FreeBSD.org>

Avoid conflicts with libc symbols in libthr jump table.

In some corner cases of static linking and unexpected libraries order
on the linker command line, libc symbol might preempt the same libthr
sy

Avoid conflicts with libc symbols in libthr jump table.

In some corner cases of static linking and unexpected libraries order
on the linker command line, libc symbol might preempt the same libthr
symbol, in which case libthr jump table points back to libc causing
either infinite recursion or loop. Handle all of such symbols by
using private libthr names for them, ensuring that the right pointers
are installed into the table.

In collaboration with: arichardson
PR: 239475
Tested by: pho
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21088

show more ...


# 7f49ce7a 27-Jun-2019 Alan Somers <asomers@FreeBSD.org>

MFHead @349476

Sponsored by: The FreeBSD Foundation


# 2d8c3eeb 23-Jun-2019 Konstantin Belousov <kib@FreeBSD.org>

Add libc stub for pthread_getthreadid_np(3).

Requested by: jbeich
PR: 238650
Sponsored by: The FreeBSD Foundation
MFC after: 1 week


# 7e565c55 30-Jan-2019 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r343320 through r343570.


# 381c2d2e 29-Jan-2019 Konstantin Belousov <kib@FreeBSD.org>

Untangle jemalloc and mutexes initialization.

The need to use libc malloc(3) from some places in libthr always
caused issues. For instance, per-thread key allocation was switched to
use plain mmap(

Untangle jemalloc and mutexes initialization.

The need to use libc malloc(3) from some places in libthr always
caused issues. For instance, per-thread key allocation was switched to
use plain mmap(2) to get storage, because some third party mallocs
used keys for implementation of calloc(3).

Even more important, libthr calls calloc(3) during initialization of
pthread mutexes, and jemalloc uses pthread mutexes. Jemalloc provides
some way to both postpone the initialization, and to make
initialization to use specialized allocator, but this is very fragile
and often breaks. See the referenced PR for another example.

Add the small malloc implementation used by rtld, to libthr. Use it in
thr_spec.c and for mutexes initialization. This avoids the issues with
mutual dependencies between malloc and libthr in principle. The
drawback is that some more allocations are not interceptable for
alternate malloc implementations. There should be not too much memory
use from this allocator, and the alternative, direct use of mmap(2) is
obviously worse.

PR: 235211
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18988

show more ...


# 3d5db455 24-Nov-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r340427 through r340868.


12345678910>>...17