[PATCH 21/35] arm64/gcs: Implement shadow stack prctl() interface

Mark Brown broonie at kernel.org
Tue Jul 18 12:37:14 PDT 2023


On Tue, Jul 18, 2023 at 05:51:54PM +0000, Edgecombe, Rick P wrote:
> On Sun, 2023-07-16 at 22:51 +0100, Mark Brown wrote:

> > +                       gcs = alloc_gcs(task->thread.gcspr_el0, size,
> > +                                       0, 0);
> > +                       if (!gcs)
> > +                               return -ENOMEM;

> > +       task->thread.gcs_el0_mode = arg;
> > +       if (task == current)
> > +               gcs_set_el0_mode(task);
> > +

> Ah! So does this task == current part mean this can be called from
> another task via ptrace?

Ugh, right.  So I had been worried about preemption rather than invoking
prctl() via ptrace, though since ptrace can change the syscall invoked
by a task it could cause prctl() to be invoked that way (but that should
look like being run in the target process).

I'm not aware of an interface specifically intended to remotely invoke
prctls via ptrace but that doesn't mean there isn't one that I didn't
find yet.  I can't remember why I'm aware of the task != current case as
a concern which is worrying me.

> If so, then is the alloc_gcs() part on the wrong mm?

Yes, it will be.  I'll add a check in there to reject attempts to enable
GCS when task != current.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20230718/fbdef82a/attachment.sig>


More information about the linux-arm-kernel mailing list