Date: Wed, 11 Dec 2024 21:39:36 -0300
On Wednesday 11 December 2024 21:24:15 Brasilia Standard Time Thiago Macieira
via Std-Proposals wrote:
> In https://codebrowser.dev/glibc/glibc/nptl/pthread_detach.c.html, there is
> no direct access to global data. The only possibility is in that call to
> __nptl_free_tcb → __nptl_deallocate_stack → queue_stack, which can only
> happen if the thread in question has been cancelled... but you didn't
> mention cancellation and std::thread doesn't have that ability anyway.
Partially scratch that. "cancelhandling" is not exclusive to cancellations.
EXITING_BITMASK is about whether the thread is exiting and that is set in
pthread_create.c's in-thread function. It looks like glibc does not use
atomic_load for relaxed loads, but that's what that load should be.
That said, I don't see how this could be a race condition. We can only reach
that and the call to __nptl_free_tcb() if the compare_exchange above
succeeded, in which case __nptl_free_tcb() won't be called in
pthread_create.c.
Anyway, submit a bug report to your vendor.
via Std-Proposals wrote:
> In https://codebrowser.dev/glibc/glibc/nptl/pthread_detach.c.html, there is
> no direct access to global data. The only possibility is in that call to
> __nptl_free_tcb → __nptl_deallocate_stack → queue_stack, which can only
> happen if the thread in question has been cancelled... but you didn't
> mention cancellation and std::thread doesn't have that ability anyway.
Partially scratch that. "cancelhandling" is not exclusive to cancellations.
EXITING_BITMASK is about whether the thread is exiting and that is set in
pthread_create.c's in-thread function. It looks like glibc does not use
atomic_load for relaxed loads, but that's what that load should be.
That said, I don't see how this could be a race condition. We can only reach
that and the call to __nptl_free_tcb() if the compare_exchange above
succeeded, in which case __nptl_free_tcb() won't be called in
pthread_create.c.
Anyway, submit a bug report to your vendor.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel DCAI Platform & System Engineering
Received on 2024-12-12 00:39:45