Skip to content

Commit d2be327

Browse files
brooniewilldeacon
authored andcommitted
arm64/gcs: Don't call gcs_free() during flush_gcs()
Currently we call gcs_free() during flush_gcs() to reset the thread state for GCS. This includes unmapping any kernel allocated GCS, but this is redundant when doing a flush_thread() since we are reinitialising the thread memory too. Inline the reinitialisation of the thread struct. Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 650768c commit d2be327

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/arm64/kernel/process.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ static void flush_gcs(void)
288288
if (!system_supports_gcs())
289289
return;
290290

291-
gcs_free(current);
291+
current->thread.gcspr_el0 = 0;
292+
current->thread.gcs_base = 0;
293+
current->thread.gcs_size = 0;
292294
current->thread.gcs_el0_mode = 0;
293295
write_sysreg_s(GCSCRE0_EL1_nTR, SYS_GCSCRE0_EL1);
294296
write_sysreg_s(0, SYS_GCSPR_EL0);

0 commit comments

Comments
 (0)