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

Joel Fernandes
2023-04-26T13:44:39Z

On Wed, Apr 26, 2023 at 8:30 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> Joel Fernandes <joel@joelfernandes.org> writes:
> > On Tue, Apr 25, 2023 at 6:58 AM Zhouyi Zhou <zhouzhouyi@gmail.com> 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