[PATCH v7 20/39] arm64/gcs: Context switch GCS state for EL0

Mark Brown broonie at kernel.org
Wed Dec 13 12:02:24 PST 2023


On Wed, Dec 13, 2023 at 11:59:45AM -0800, Deepak Gupta wrote:
> On Wed, Nov 22, 2023 at 1:45 AM Mark Brown <broonie at kernel.org> wrote:

> > +       if (task->thread.gcs_el0_mode & PR_SHADOW_STACK_ENABLE)
> > +               gcscre0_el1 |= GCSCRE0_EL1_RVCHKEN | GCSCRE0_EL1_PCRSEL;

> If the intent is to disable, is the GCS stack freed or kept around?
> I expect if libc is taking the decision to disable, kernel should free it up.
> Is it freed in some other flow?

Kept around and freed on thread exit.  There is a potential race between
for example disabling in a signal handler and something trying to walk
the stack so we err on the side of caution.
-------------- 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-riscv/attachments/20231213/1b52713c/attachment.sig>


More information about the linux-riscv mailing list