Re: [PATCH v34 14/14] sched/proxy: Add deactivated (sleeping) owner handling to find_proxy_task()
From: Zhan Xusheng
Date: Thu Dec 03 2026 - 02:38:42 EST
Hi Prateek,
On Wed, Dec 02, 2026 at 02:26:24PM +0530, K Prateek Nayak wrote:
> /*Back */
> raw_spin_rq_lock_irqrestore(p->pi_lock);
> /* Preempted; RCU grace period done. */
>
> activate_blocked_waiters(owner)
> /* !!! Use after free for owner !!! */
[...]
> One way to get around this is to do a guard(irqsave)() before grabbing
> the &p->pi_lock and that way, you should have an RCU-protected reference
> for the entirety of activate_blocked_waiters().
try_to_wake_up() starts with guard(preempt)(), which also covers the
activate_blocked_waiters() call at out:, so no grace period can end
before it returns. The last put_task_struct() and
put_task_struct_rcu_user() both free the task through call_rcu(), so
the owner stays valid there without disabling interrupts.
Thanks,
Zhan Xusheng