C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::thread::detach() can segfault

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 11 Dec 2024 21:24:15 -0300
On Wednesday 11 December 2024 20:19:04 Brasilia Standard Time Phil Bouchard
wrote:
> Impossible because the backtrace lists __pthread_detach() and the thread
> uses a reference to a global data structure.

I don't see why you're saying it's impossible - because you haven't posted any
code. In any case, it's not the point of this list, so don't post the code
here. Post to your vendor's bug tracker.

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.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2024-12-12 00:24:26