Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: process: Fix context switching MTE store-only tag check
@ 2026-08-19 14:48 Vladimir Murzin
  2026-08-19 15:24 ` Yeoreum Yun
  2026-08-19 15:44 ` Catalin Marinas
  0 siblings, 2 replies; 3+ messages in thread
From: Vladimir Murzin @ 2026-08-19 14:48 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: catalin.marinas, will, yeoreum.yun

SCTLR_EL1.TCSO0 is set when user opt-in for MTE store-only tag check
mode. However, it is not part of SCTLR_USER_MASK which imply that on
context switch we never clear SCTLR_EL1.TCSO0, so we are leaking that
setting into another task.

Fix that by including SCTLR_EL1_TCSO0_MASK into SCTLR_USER_MASK

Fixes: 4d51ff5bba00 ("arm64/kernel: Support store-only mte tag check")
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 arch/arm64/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index c2a627f39314..6dfbcacd9ba0 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -264,7 +264,7 @@ static inline void task_set_sve_vl_onexec(struct task_struct *task,
 
 #define SCTLR_USER_MASK                                                        \
 	(SCTLR_ELx_ENIA | SCTLR_ELx_ENIB | SCTLR_ELx_ENDA | SCTLR_ELx_ENDB |   \
-	 SCTLR_EL1_TCF0_MASK)
+	 SCTLR_EL1_TCF0_MASK | SCTLR_EL1_TCSO0_MASK)
 
 static inline void arch_thread_struct_whitelist(unsigned long *offset,
 						unsigned long *size)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64: process: Fix context switching MTE store-only tag check
  2026-08-19 14:48 [PATCH] arm64: process: Fix context switching MTE store-only tag check Vladimir Murzin
@ 2026-08-19 15:24 ` Yeoreum Yun
  2026-08-19 15:44 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Yeoreum Yun @ 2026-08-19 15:24 UTC (permalink / raw)
  To: Vladimir Murzin; +Cc: linux-arm-kernel, catalin.marinas, will, yeoreum.yun


> SCTLR_EL1.TCSO0 is set when user opt-in for MTE store-only tag check
> mode. However, it is not part of SCTLR_USER_MASK which imply that on
> context switch we never clear SCTLR_EL1.TCSO0, so we are leaking that
> setting into another task.
> Fix that by including SCTLR_EL1_TCSO0_MASK into SCTLR_USER_MASK
> 
> Fixes: 4d51ff5bba00 ("arm64/kernel: Support store-only mte tag check")
> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
> ---
>  arch/arm64/include/asm/processor.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
> index c2a627f39314..6dfbcacd9ba0 100644
> --- a/arch/arm64/include/asm/processor.h
> +++ b/arch/arm64/include/asm/processor.h
> @@ -264,7 +264,7 @@ static inline void task_set_sve_vl_onexec(struct task_struct *task,
>  
>  #define SCTLR_USER_MASK                                                        \
>  	(SCTLR_ELx_ENIA | SCTLR_ELx_ENIB | SCTLR_ELx_ENDA | SCTLR_ELx_ENDB |   \
> -	 SCTLR_EL1_TCF0_MASK)
> +	 SCTLR_EL1_TCF0_MASK | SCTLR_EL1_TCSO0_MASK)
>  
>  static inline void arch_thread_struct_whitelist(unsigned long *offset,
>  						unsigned long *size)
> -- 
> 2.34.1

Oops, Sorry for this.

Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
-- 
Sincerely,
Yeoreum Yun


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64: process: Fix context switching MTE store-only tag check
  2026-08-19 14:48 [PATCH] arm64: process: Fix context switching MTE store-only tag check Vladimir Murzin
  2026-08-19 15:24 ` Yeoreum Yun
@ 2026-08-19 15:44 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2026-08-19 15:44 UTC (permalink / raw)
  To: Vladimir Murzin; +Cc: linux-arm-kernel, will, yeoreum.yun

On Wed, Aug 19, 2026 at 03:48:59PM +0100, Vladimir Murzin wrote:
> SCTLR_EL1.TCSO0 is set when user opt-in for MTE store-only tag check
> mode. However, it is not part of SCTLR_USER_MASK which imply that on
> context switch we never clear SCTLR_EL1.TCSO0, so we are leaking that
> setting into another task.
> 
> Fix that by including SCTLR_EL1_TCSO0_MASK into SCTLR_USER_MASK
> 
> Fixes: 4d51ff5bba00 ("arm64/kernel: Support store-only mte tag check")
> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-19 15:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 14:48 [PATCH] arm64: process: Fix context switching MTE store-only tag check Vladimir Murzin
2026-08-19 15:24 ` Yeoreum Yun
2026-08-19 15:44 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox