Re: BUG : PowerPC RCU: torture test failed with __stack_chk_fail

From: Joel Fernandes
Date: Wed Apr 26 2023 - 09:44:39 EST


On Wed, Apr 26, 2023 at 8:30 AM Michael Ellerman <mpe@xxxxxxxxxxxxxx> wrote:
>
> Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> writes:
> > On Tue, Apr 25, 2023 at 6:58 AM Zhouyi Zhou <zhouzhouyi@xxxxxxxxx> wrote:
> ...
> >
> > Out of curiosity for PPC folks, why cannot 64-bit PPC use per-task
> > canary? Michael, is this an optimization? Adding Christophe as well
> > since it came in a few years ago via the following commit:
>
> I think Christophe also answered these in his reply.
>
> We do use a per-task canary, but because we don't have "current" in a
> register, we can't use the value in current for GCC.
>
> In one of my replies I said a possible solution would be to keep current
> in a register on 64-bit, but we'd need to do that in addition to the
> paca, so that would consume another GPR which we'd need to think hard
> about.

Makes sense. I'd think it is not worth allocating a separate GPR just
for this, and may cause similar register optimization issues as well.

> There's another reason to have it in the paca, which is that the paca is
> always accessible, even when the MMU is off, whereas current isn't (in
> some situations).
>
> In general we don't want to use stack protector in code that runs with
> the MMU off, but if the canary wasn't in the paca then we'd have a hard
> requirement to not use stack protector in that code.

How could you control which code paths don't have the stack protector?
Just curious.

thanks,

- Joel