* [PATCH] arm64/gcs: Flush the GCS locking state on exec
@ 2025-11-29 0:48 Mark Brown
2025-12-01 9:19 ` Yury Khrustalev
2025-12-15 18:17 ` Catalin Marinas
0 siblings, 2 replies; 3+ messages in thread
From: Mark Brown @ 2025-11-29 0:48 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Thiago Jung Bauermann
Cc: linux-arm-kernel, linux-kernel, Yury Khrustalev, Mark Brown
When we exec a new task we forget to flush the set of locked GCS mode bits.
Since we do flush the rest of the state this means that if GCS is locked
the new task will be unable to enable GCS, it will be locked as being
disabled. Add the expected flush.
Fixes: fc84bc5378a8 ("arm64/gcs: Context switch GCS state for EL0")
Reported-by: Yury Khrustalev <Yury.Khrustalev@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
arch/arm64/kernel/process.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index fba7ca102a8c..489554931231 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -292,6 +292,7 @@ static void flush_gcs(void)
current->thread.gcs_base = 0;
current->thread.gcs_size = 0;
current->thread.gcs_el0_mode = 0;
+ current->thread.gcs_el0_locked = 0;
write_sysreg_s(GCSCRE0_EL1_nTR, SYS_GCSCRE0_EL1);
write_sysreg_s(0, SYS_GCSPR_EL0);
}
---
base-commit: ac3fd01e4c1efce8f2c054cdeb2ddd2fc0fb150d
change-id: 20251128-arm64-gcs-flush-lock-163eab9c22f4
Best regards,
--
Mark Brown <broonie@kernel.org>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] arm64/gcs: Flush the GCS locking state on exec
2025-11-29 0:48 [PATCH] arm64/gcs: Flush the GCS locking state on exec Mark Brown
@ 2025-12-01 9:19 ` Yury Khrustalev
2025-12-15 18:17 ` Catalin Marinas
1 sibling, 0 replies; 3+ messages in thread
From: Yury Khrustalev @ 2025-12-01 9:19 UTC (permalink / raw)
To: Mark Brown
Cc: Catalin Marinas, Will Deacon, Thiago Jung Bauermann,
linux-arm-kernel, linux-kernel
On Sat, Nov 29, 2025 at 12:48:45AM +0000, Mark Brown wrote:
> When we exec a new task we forget to flush the set of locked GCS mode bits.
> Since we do flush the rest of the state this means that if GCS is locked
> the new task will be unable to enable GCS, it will be locked as being
> disabled. Add the expected flush.
>
> Fixes: fc84bc5378a8 ("arm64/gcs: Context switch GCS state for EL0")
> Reported-by: Yury Khrustalev <Yury.Khrustalev@arm.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
Thanks! I've tested this patch and it works as expected.
Tested-by: Yury Khrustalev <yury.khrustalev@arm.com>
> ---
> arch/arm64/kernel/process.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index fba7ca102a8c..489554931231 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -292,6 +292,7 @@ static void flush_gcs(void)
> current->thread.gcs_base = 0;
> current->thread.gcs_size = 0;
> current->thread.gcs_el0_mode = 0;
> + current->thread.gcs_el0_locked = 0;
> write_sysreg_s(GCSCRE0_EL1_nTR, SYS_GCSCRE0_EL1);
> write_sysreg_s(0, SYS_GCSPR_EL0);
> }
>
> ---
> base-commit: ac3fd01e4c1efce8f2c054cdeb2ddd2fc0fb150d
> change-id: 20251128-arm64-gcs-flush-lock-163eab9c22f4
>
> Best regards,
> --
> Mark Brown <broonie@kernel.org>
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] arm64/gcs: Flush the GCS locking state on exec
2025-11-29 0:48 [PATCH] arm64/gcs: Flush the GCS locking state on exec Mark Brown
2025-12-01 9:19 ` Yury Khrustalev
@ 2025-12-15 18:17 ` Catalin Marinas
1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2025-12-15 18:17 UTC (permalink / raw)
To: Will Deacon, Thiago Jung Bauermann, Mark Brown
Cc: linux-arm-kernel, linux-kernel, Yury Khrustalev
On Sat, 29 Nov 2025 00:48:45 +0000, Mark Brown wrote:
> When we exec a new task we forget to flush the set of locked GCS mode bits.
> Since we do flush the rest of the state this means that if GCS is locked
> the new task will be unable to enable GCS, it will be locked as being
> disabled. Add the expected flush.
>
>
Applied to arm64 (for-next/fixes), thanks!
[1/1] arm64/gcs: Flush the GCS locking state on exec
https://git.kernel.org/arm64/c/98a97bf41528
--
Catalin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-15 18:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-29 0:48 [PATCH] arm64/gcs: Flush the GCS locking state on exec Mark Brown
2025-12-01 9:19 ` Yury Khrustalev
2025-12-15 18:17 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).