#
a3d0178e |
| 24-Mar-2023 |
joerg <joerg@NetBSD.org> |
Use snprintf_ss in pthread__assertfunc and update comment in pthread__errorfunc. snprintf can use locks in some code paths and we only care about the restricted subset here.
|
#
83ff3937 |
| 31-May-2022 |
riastradh <riastradh@NetBSD.org> |
libpthread(3): Fix a marvellous interaction with rtld.
Patch from chs@. Comment explaining the story by me. This patch may not be optimal -- maybe it would be better in pthread__init, or better fo
libpthread(3): Fix a marvellous interaction with rtld.
Patch from chs@. Comment explaining the story by me. This patch may not be optimal -- maybe it would be better in pthread__init, or better for rtld to call _lwp_unpark after _lwp_park in the contened case -- but we've tested this version and it's annoying to reproduce, so let's take this version and worry about testing improvements later.
show more ...
|
#
f2e0628f |
| 12-Feb-2022 |
riastradh <riastradh@NetBSD.org> |
libpthread: Move namespacing include to top of .c files.
Stuff like libc's namespace.h, or atomic_op_namespace.h, which does namespacing tricks like `#define atomic_cas_uint _atomic_cas_uint', has t
libpthread: Move namespacing include to top of .c files.
Stuff like libc's namespace.h, or atomic_op_namespace.h, which does namespacing tricks like `#define atomic_cas_uint _atomic_cas_uint', has to go at the top of each .c file. If it goes in the middle, it might be too late to affect the declarations, and result in compile errors.
I tripped over this by including <sys/atomic.h> in mips <machine/lock.h>.
(Maybe we should create a new pthread_namespace.h file for the purpose, but this'll do for now.)
show more ...
|
#
2b5695a7 |
| 13-Apr-2021 |
mrg <mrg@NetBSD.org> |
fake-use alloca()'s return value to quieten -Werror=unused-result
|
#
59bcdab6 |
| 22-Jul-2020 |
msaitoh <msaitoh@NetBSD.org> |
s/reseting/resetting/
|
#
1fadceab |
| 14-Jun-2020 |
ad <ad@NetBSD.org> |
Don't need to ignore ESRCH from _lwp_park() any more.
|
#
07889332 |
| 11-Jun-2020 |
ad <ad@NetBSD.org> |
Drop self->pt_lock before clearing TSD / malloc TSD.
|
#
c0c406ec |
| 10-Jun-2020 |
ad <ad@NetBSD.org> |
- Make pthread_condvar and pthread_mutex work on the stack rather than in pthread_t, so there's less chance of bad things happening if someone calls (for example) pthread_cond_broadcast() from a
- Make pthread_condvar and pthread_mutex work on the stack rather than in pthread_t, so there's less chance of bad things happening if someone calls (for example) pthread_cond_broadcast() from a signal handler.
- Remove all the deferred waiter handling except for the one case that really matters which is transferring waiters from condvar -> mutex on wakeup, and do that by splicing the condvar's waiters onto the mutex.
- Remove the mutex waiters bit as it's another complication that's not strictly needed.
show more ...
|
#
8432eea1 |
| 04-Jun-2020 |
joerg <joerg@NetBSD.org> |
If _malloc_thread_cleanup is implement, call it from libpthread. Provide the hook from modern jemalloc to avoid using TSD for the thread destruction cleanup as it can result in reentrancy crashes if
If _malloc_thread_cleanup is implement, call it from libpthread. Provide the hook from modern jemalloc to avoid using TSD for the thread destruction cleanup as it can result in reentrancy crashes if fork is called from a thread that never called malloc as it will result in a late malloc from the pre-fork synchronisation handler.
show more ...
|
#
c13674b7 |
| 03-Jun-2020 |
ad <ad@NetBSD.org> |
Deal with a couple of problems with threads being awoken early due to timeouts or cancellation where:
- The restarting thread calls _lwp_exit() before another thread gets around to waking it with
Deal with a couple of problems with threads being awoken early due to timeouts or cancellation where:
- The restarting thread calls _lwp_exit() before another thread gets around to waking it with _lwp_unpark(), leading to ESRCH (observed by joerg@). (I may have removed a similar check mistakenly over the weekend.)
- The restarting thread considers itself gone off the sleep queue but at the same time another thread is part way through waking it, and hasn't fully completed that operation yet by setting thread->pt_mutexwait = 0. I think that could have potentially lead to the list of waiters getting messed up given the right circumstances.
show more ...
|
#
836855ce |
| 02-Jun-2020 |
joerg <joerg@NetBSD.org> |
Pass down errno when calling pthread__errorfunc after a system call. Allow format arguments for that reason and use (v)snprintf_ss in pthread_errorfunc to avoid race conditions and the like.
|
#
5fb1f338 |
| 01-Jun-2020 |
ad <ad@NetBSD.org> |
In the interests of reliability simplify waiter handling more and redo condvars to manage the list of waiters with atomic ops.
|
#
c405aa55 |
| 16-May-2020 |
ad <ad@NetBSD.org> |
- Try to eliminate a hang in "parked" I've been seeing while stress testing. Centralise wakeup of deferred waiters in pthread__clear_waiters() and use throughout libpthread. Make fewer assumptio
- Try to eliminate a hang in "parked" I've been seeing while stress testing. Centralise wakeup of deferred waiters in pthread__clear_waiters() and use throughout libpthread. Make fewer assumptions. Be more conservative in pthread_mutex when dealing with pending waiters.
- Remove the "hint" argument everywhere since the kernel doesn't use it any more.
show more ...
|
#
872d720f |
| 15-May-2020 |
joerg <joerg@NetBSD.org> |
Lock/unlock/reinit pthread__deadqueue_lock over fork.
|
#
703bdfa8 |
| 14-Apr-2020 |
joerg <joerg@NetBSD.org> |
Drop most of the logic associated with pthread__started.
The pthread_cond logic is a questionable optimisation at best and the post-fork logic is plainly broken.
|
#
f8ff9381 |
| 16-Feb-2020 |
kamil <kamil@NetBSD.org> |
Revert "Enhance the pthread(3) + malloc(3) init model"
It is reported to hand on aarch64 with gzip.
|
#
42337091 |
| 16-Feb-2020 |
kamil <kamil@NetBSD.org> |
Set __isthreaded before bootstrapping malloc(3)
jemalloc depends on the __isthreaded dynamic state logic.
Reported by <wiz> for mpv and by <tih> for gzip.
|
#
af31a025 |
| 15-Feb-2020 |
kamil <kamil@NetBSD.org> |
Enhance the pthread(3) + malloc(3) init model
Separate the pthread_atfork(3) call from pthread_tsd_init() and move it into a distinct function.
Call inside pthread__init() late TSD initialization r
Enhance the pthread(3) + malloc(3) init model
Separate the pthread_atfork(3) call from pthread_tsd_init() and move it into a distinct function.
Call inside pthread__init() late TSD initialization route, just after "pthread_atfork(NULL, NULL, pthread__fork_callback);".
Document that malloc(3) initialization is now controlled again and called during the first pthread_atfork(3) call.
Remove #if 0 code from pthread_mutex.c as we no longer initialize malloc prematurely.
show more ...
|
#
253ea5f8 |
| 08-Feb-2020 |
kamil <kamil@NetBSD.org> |
Change the behavior of pthread_equal()
On error when not aborting, do not return EINVAL as it has a side effect of being interpreted as matching threads. For invalid threads return unmatched.
Check
Change the behavior of pthread_equal()
On error when not aborting, do not return EINVAL as it has a side effect of being interpreted as matching threads. For invalid threads return unmatched.
Check pthreads for NULL, before accessing pt_magic field. This avoids faults on comparision with a NULL pointer.
This behavior is in the scope of UB, but should be easier to deal with buggy software.
show more ...
|
#
766bd633 |
| 05-Feb-2020 |
ryoon <ryoon@NetBSD.org> |
Remove trailing whiteapaces and tab
|
#
2f17c8c7 |
| 29-Jan-2020 |
ad <ad@NetBSD.org> |
- pthread_join(): remove temporary hack now kernel returns correct errno.
- kill(getpid(), SIGABRT) -> _lwp_kill(_lwp_self(), SIGABRT)
|
#
d139241f |
| 29-Jan-2020 |
kamil <kamil@NetBSD.org> |
Chack thread->pt_magic with PT_MAGIC promptly
Rearrange some checks to avoid verifying pthread_t after using it.
|
#
93d2a1d3 |
| 29-Jan-2020 |
kamil <kamil@NetBSD.org> |
Revert previous
Two assignments are correct.
|
#
11d90fc2 |
| 29-Jan-2020 |
kamil <kamil@NetBSD.org> |
Do not set stackbase2 twice for !__MACHINE_STACK_GROWS_UP
|
#
a8272d2f |
| 28-Jan-2020 |
ad <ad@NetBSD.org> |
pthread_join(): add a temporary hack to make lib/libpthread/t_detach pass. The correct fix is to do this in kernel (I have that change, but it's part of the wider change to index LWPs in a tree).
|