Re: [patch V2 1/8] signal: Prevent exec() race

From: Frederic Weisbecker

Date: Wed Sep 09 2026 - 12:10:39 EST


Le Wed, Sep 09, 2026 at 03:45:36PM +0200, Thomas Gleixner a écrit :
> On Wed, Sep 09 2026 at 14:51, Peter Zijlstra wrote:
> > On Wed, Sep 09, 2026 at 02:45:55PM +0200, Peter Zijlstra wrote:
> >> On Wed, Sep 09, 2026 at 02:13:11PM +0200, Frederic Weisbecker wrote:
> >> > P2(int *next, int *prev, int *pid, spinlock_t *sighand)
> >> > {
> >> > int r0;
> >> > int r1;
> >> > // get target
> >> > r0 = READ_ONCE(*pid);
> >> > spin_lock(sighand);
> >
> > There is no dependency between r0 and sighand. While I think there is in
> > posixtimer_send_sigqueue(). Does making it smp_load_acquire() help?
>
> sighand is r0->sighand->siglock and obviously not known before r0 is
> read. So yes there is a data dependency in reality :)

Ah but the script writes *psighand on one hand and the spin_lock on the
other hand does an acquire so of course it works. But that doesn't tell
if that's transferrable through struct pid->task write on one hand and
struct pid->task deref on the other hand plus task->sighand dependencies.

My brain melts enough for today...