Re: [PATCH v2] powerpc: Fix irq_soft_mask_set() and irq_soft_mask_return() with sanitizer

From: Christophe Leroy
Date: Tue Aug 30 2022 - 05:10:11 EST




Le 30/08/2022 à 11:01, Nicholas Piggin a écrit :
> On Tue Aug 30, 2022 at 3:24 PM AEST, Christophe Leroy wrote:
>>> This is still slightly concerning to me. Is there any guarantee that the
>>> compiler would not use a different sequence for the address here?
>>>
>>> Maybe explicit r13 is required.
>>>
>>
>> local_paca is defined as:
>>
>> register struct paca_struct *local_paca asm("r13");
>>
>> Why would the compiler use another register ?
>
> Hopefully it doesn't. Is it guaranteed that it won't?
>
>> If so, do we also have an
>> issue with the use of current_stack_pointer in irq.c ?
>
> What problems do you think it might have? I think it may be okay
> because we're only using it to check what stack we are using so doesn't
> really matter what value it is when we sample it.
>
> The overflow check similarly probably doesn't matter the exact value.
>
>> Segher ?
>
> I'm sure Segher will be delighted with the creative asm in __do_IRQ
> and call_do_irq :) *Grabs popcorn*
>

Segher was in the loop,
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/5ca6639b7c1c21ee4b4138b7cfb31d6245c4195c.1570684298.git.christophe.leroy@xxxxxx/