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

From: Mark Brown
Date: Wed Dec 13 2023 - 15:02:37 EST


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@xxxxxxxxxx> 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.

Attachment: signature.asc
Description: PGP signature