]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
arm64/gcs: task_gcs_el0_enable() should use passed task
authorJeremy Linton <jeremy.linton@arm.com>
Sat, 19 Jul 2025 04:37:33 +0000 (23:37 -0500)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 23 Jul 2025 11:08:17 +0000 (12:08 +0100)
commitcbbcfb94c55c02a8c4ce52b5da0770b5591a314c
tree823f14506ce5d725ea6fb346bd8bc337daa4096a
parent1a665a71ef0fb043c6cfafbf6a6cc9cdc2357505
arm64/gcs: task_gcs_el0_enable() should use passed task

Mark Rutland noticed that the task parameter is ignored and
'current' is being used instead. Since this is usually
what its passed, it hasn't yet been causing problems but likely
will as the code gets more testing.

But, once this is fixed, it creates a new bug in copy_thread_gcs()
since the gcs_el_mode isn't yet set for the task before its being
checked. Move gcs_alloc_thread_stack() after the new task's
gcs_el0_mode initialization to avoid this.

Fixes: fc84bc5378a8 ("arm64/gcs: Context switch GCS state for EL0")
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20250719043740.4548-2-jeremy.linton@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/gcs.h
arch/arm64/kernel/process.c