[PATCH v7 20/39] arm64/gcs: Context switch GCS state for EL0
Deepak Gupta
debug at rivosinc.com
Wed Dec 13 11:59:45 PST 2023
On Wed, Nov 22, 2023 at 1:45 AM Mark Brown <broonie at kernel.org> wrote:
> +
> +/*
> + * Apply the GCS mode configured for the specified task to the
> + * hardware.
> + */
> +void gcs_set_el0_mode(struct task_struct *task)
> +{
> + u64 gcscre0_el1 = GCSCRE0_EL1_nTR;
> +
> + 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?
> +
> + if (task->thread.gcs_el0_mode & PR_SHADOW_STACK_WRITE)
> + gcscre0_el1 |= GCSCRE0_EL1_STREn;
> +
> + if (task->thread.gcs_el0_mode & PR_SHADOW_STACK_PUSH)
> + gcscre0_el1 |= GCSCRE0_EL1_PUSHMEn;
> +
> + write_sysreg_s(gcscre0_el1, SYS_GCSCRE0_EL1);
> +}
More information about the linux-riscv
mailing list