Re: futex+io_uring: futex_q::task can maybe be dangling (but is not actually accessed, so it's fine)
From: Jens Axboe
Date: Mon Jan 13 2025 - 09:46:23 EST
On 1/13/25 7:38 AM, Peter Zijlstra wrote:
> On Fri, Jan 10, 2025 at 08:33:34PM -0700, Jens Axboe wrote:
>
>> @@ -548,7 +549,7 @@ void __futex_queue(struct futex_q *q, struct futex_hash_bucket *hb)
>>
>> plist_node_init(&q->list, prio);
>> plist_add(&q->list, &hb->chain);
>> - q->task = current;
>> + q->task = task;
>> }
>>
>> /**
>
> The alternative is, I suppose, to move the q->task assignment out to
> these two callsites instead. Thomas, any opinions?
That suggestion was posed in my reply as well, but I didn't spend the
time checking if it was safe/feasible. If you/Thomas think it's safe, we
can certainly do that instead. But I'd much rather you make that call
than me :-)
--
Jens Axboe