Re: [PATCH] riscv: fix race when vmap stack overflow

From: Andrea Parri
Date: Fri Oct 21 2022 - 09:23:00 EST


Hi Tong,

> > > I use atomic_set_release here, because I need earlier memory
> > > operations finished to make sure the sp is ready then set the spin
> > > flag.

> Consider this implementation:)
>
> smp_store_mb(&spin_shadow_stack, 0);

smp_store_mb() has "WRITE_ONCE(); smp_mb()" semantics; so it doesn't
guarantee that the store to spin_shadow_stack is ordered after program
-order earlier memory accesses.

Andrea