History log of /freebsd/lib/libthr/thread/thr_init.c (Results 1 – 25 of 184)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 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 ...


Revision tags: release/14.2.0
# 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 ...


Revision tags: release/13.4.0, release/14.1.0
# 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


Revision tags: release/13.3.0, release/14.0.0
# 0dc52b72 15-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 ...


Revision tags: release/13.2.0, release/12.4.0
# e03c7f50 14-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 ...


Revision tags: release/13.1.0
# 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 ...


Revision tags: release/12.3.0
# 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 ...


Revision tags: release/13.0.0
# 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 ...


Revision tags: release/12.2.0, release/11.4.0, release/12.1.0
# 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 ...


Revision tags: release/11.3.0
# 7f49ce7a 28-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 ...


Revision tags: release/12.0.0
# 3d5db455 24-Nov-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r340427 through r340868.


# a4f02d5d 19-Nov-2018 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make libthr(3) use sysconf(_SC_NPROCESSORS_CONF); this shaves off
two calls to sysctl(2) from the binary startup.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision:

Make libthr(3) use sysconf(_SC_NPROCESSORS_CONF); this shaves off
two calls to sysctl(2) from the binary startup.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18046

show more ...


Revision tags: release/11.2.0
# 937d37fc 19-Nov-2017 Hans Petter Selasky <hselasky@FreeBSD.org>

Merge ^/head r325842 through r325998.


# df57947f 18-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

spdx: initial adoption of licensing ID tags.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensou

spdx: initial adoption of licensing ID tags.

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.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes: yes
Differential Revision: https://reviews.freebsd.org/D13133

show more ...


Revision tags: release/10.4.0, release/11.1.0
# 27c24068 22-May-2017 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r318560 through r318657.


12345678