[PATCH 1/2] arm64: Add return value to mte_disable_tco_entry()

Marc Zyngier maz at kernel.org
Mon Oct 26 01:23:04 PDT 2026


In order to provide adequate levels of synchronisation when clearing
TCO, update mte_disable_tco_entry() to indicate whether it has actually
done something.

Signed-off-by: Marc Zyngier <maz at kernel.org>
---
 arch/arm64/include/asm/mte.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/include/asm/mte.h b/arch/arm64/include/asm/mte.h
index 7f7b97e099968..411e5a6f6d94c 100644
--- a/arch/arm64/include/asm/mte.h
+++ b/arch/arm64/include/asm/mte.h
@@ -224,10 +224,10 @@ static inline bool folio_try_hugetlb_mte_tagging(struct folio *folio)
 }
 #endif
 
-static inline void mte_disable_tco_entry(struct task_struct *task)
+static inline bool mte_disable_tco_entry(struct task_struct *task)
 {
 	if (!system_supports_mte())
-		return;
+		return false;
 
 	/*
 	 * Re-enable tag checking (TCO set on exception entry). This is only
@@ -240,8 +240,12 @@ static inline void mte_disable_tco_entry(struct task_struct *task)
 	 * expensive.
 	 */
 	if (kasan_hw_tags_enabled() ||
-	    (task->thread.sctlr_user & (1UL << SCTLR_EL1_TCF0_SHIFT)))
+	    (task->thread.sctlr_user & (1UL << SCTLR_EL1_TCF0_SHIFT))) {
 		asm volatile(SET_PSTATE_TCO(0));
+		return true;
+	}
+
+	return false;
 }
 
 #ifdef CONFIG_KASAN_HW_TAGS
-- 
2.47.3




More information about the linux-arm-kernel mailing list