[PATCH 03/13] nptl: Remove clockwait_tid
Adhemerval Zanella
adhemerval.zanella@linaro.org
Mon Dec 14 12:52:12 GMT 2020
On 14/12/2020 09:16, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
>
>> -static __always_inline int
>> -futex_timed_wait_cancel64 (pid_t *tidp, pid_t tid,
>> - const struct __timespec64 *timeout, int private)
>> -{
>> - int err = INTERNAL_SYSCALL_CANCEL (futex_time64, tidp,
>> - __lll_private_flag (FUTEX_WAIT, private),
>> - tid, timeout);
>
> This uses FUTEX_WAIT. But the replacement,
> __futex_abstimed_wait_common64, uses FUTEX_WAIT_BITSET. I do not think
> this is correct because the kernel will use FUTEX_WAKE internally for
> the pd->tid wakeup relied upon by pthread_join.
>
> This seems to cause pthread_join regressions on some kernel versions.
>
> We need to audit all callers of __futex_abstimed_wait64 if they are
> actually compatible with FUTEX_WAIT_BITSET.
I don't think it should matter, as Andreas has put FUTEX_WAIT is exactly
as FUTEX_WAIT_BITSET plus FUTEX_BITSET_MATCH_ANY. On a recent kernel:
SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
struct __kernel_timespec __user *, utime, u32 __user *, uaddr2,
u32, val3)
{
[...]
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
}
long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
u32 __user *uaddr2, u32 val2, u32 val3)
{
[...]
case FUTEX_WAIT:
val3 = FUTEX_BITSET_MATCH_ANY;
fallthrough;
case FUTEX_WAIT_BITSET:
return futex_wait(uaddr, flags, val, timeout, val3);
[...]
More information about the Libc-alpha
mailing list