[PATCH] riscv: fix race when vmap stack overflow

Tong Tiangen tongtiangen at huawei.com
Fri Oct 21 06:46:23 PDT 2022



在 2022/10/21 21:22, Andrea Parri 写道:
> 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
> .

Hi Andrea:

IIUC, the earlier memory access amoswap.aqrl, here .aqrl guarantee it.
But anyway, consider we don't care about performance here, using 
smp_store_release()(add barrier()) surely right.

Thanks,
Tong.



More information about the linux-riscv mailing list