]> sourceware.org Git - glibc.git/commit
Check time arguments to pthread_timedjoin_np and pthread_clockjoin_np
authorJoseph Myers <josmyers@redhat.com>
Mon, 21 Oct 2024 20:56:48 +0000 (20:56 +0000)
committerJoseph Myers <josmyers@redhat.com>
Mon, 21 Oct 2024 20:56:48 +0000 (20:56 +0000)
commitb371ed272695919a332d30bd2754a82e5e683178
tree434b1c8e1d300cf355bb101b3817f997c6498db2
parente68b1b1f0830a47346bc07486861e85a76621265
Check time arguments to pthread_timedjoin_np and pthread_clockjoin_np

The pthread_timedjoin_np and pthread_clockjoin_np functions do not
check that a valid time has been specified.  The documentation for
these functions in the glibc manual isn't sufficiently detailed to say
if they should, but consistency with POSIX functions such as
pthread_mutex_timedlock and pthread_cond_timedwait strongly indicates
that an EINVAL error is appropriate (even if there might be some
ambiguity about exactly where such a check should go in relation to
other checks for whether the thread exists, whether it's immediately
joinable, etc.).  Copy the logic for such a check used in
pthread_rwlock_common.c.

pthread_join_common had some logic calling valid_nanoseconds before
commit 9e92278ffad441daf588ff1ff5bd8094aa33fbfd, "nptl: Remove
clockwait_tid"; I haven't checked exactly what cases that detected.

Tested for x86_64 and x86.
nptl/pthread_join_common.c
sysdeps/pthread/Makefile
sysdeps/pthread/tst-join16-time64.c [new file with mode: 0644]
sysdeps/pthread/tst-join16.c [new file with mode: 0644]
This page took 0.040209 seconds and 5 git commands to generate.