lkml.org 
[lkml]   [2022]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] riscv: fix race when vmap stack overflow
From


在 2022/10/21 16:36, Andrea Parri 写道:
>>>> + atomic_set_release(&spin_shadow_stack, 0);
>>>
>>> Have not really looked the details: should there be a matching acquire?
>>
>> 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.
>>
>> The following memory operations order is not important, because we
>> just care about sp value.
>>
>> Also, we use relax amoswap before, because sp has naturelly
>> dependency. But giving them RCsc is okay here, because we don't care
>> about performance here.
>
> Thanks for the clarification.
>
> I'm not really suggesting to add unneeded synchronization, even more
> so in local/private constructs as in this case. It just felt odd to
> see the release without a pairing acquire, so I asked. ;-)
>
> Thanks,
> Andrea
>
>
>> eg:
>> handle_kernel_stack_overflow:
>> +1: la sp, spin_shadow_stack
>> + amoswap.w.aqrl sp, sp, (sp)
>> + bnez sp, 1b
>> +
>> ....
>> + smp_store_release(&spin_shadow_stack, 0);
>> + smp_mb();
>

Hi Andrea, Zhang, Guo:
Consider this implementation:)

smp_store_mb(&spin_shadow_stack, 0);

Thanks,
Tong.
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
>
> .

\
 
 \ /
  Last update: 2022-10-21 14:09    [W:0.039 / U:0.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site