FAILED: patch "[PATCH] arm64: add MTE supported check to thread switching and" failed to apply to 5.14-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 8c8a3b5bd960cd88f7655b5251dc28741e11f139 Mon Sep 17 00:00:00 2001
From: Peter Collingbourne <[email protected]>
Date: Wed, 15 Sep 2021 12:03:35 -0700
Subject: [PATCH] arm64: add MTE supported check to thread switching and
syscall entry/exit
This lets us avoid doing unnecessary work on hardware that does not support MTE, and will allow us to freely use MTE instructions in the code called by mte_thread_switch().
Since this would mean that we do a redundant check in mte_check_tfsr_el1(), remove it and add two checks now required in its callers. This also avoids an unnecessary DSB+ISB sequence on the syscall exit path for hardware not supporting MTE.
arch/arm64/include/asm/mte.h +6 -0
@@ -99,11 +99,17 @@ void mte_check_tfsr_el1(void);static inline void mte_check_tfsr_entry (void ) { +if (!system_supports_mte ()) +return ; +mte_check_tfsr_el1 (); }static inline void mte_check_tfsr_exit (void ) { +if (!system_supports_mte ()) +return ; +/* * The asynchronous faults are sync'ed automatically with * TFSR_EL1 on kernel entry but for exit an explicit dsb()
arch/arm64/kernel/mte.c +4 -6
@@ -142,12 +142,7 @@ void mte_enable_kernel_async(void)#ifdef CONFIG_KASAN_HW_TAGS void mte_check_tfsr_el1 (void ) { -u64 tfsr_el1; - -if (!system_supports_mte ()) -return ; - - tfsr_el1 =read_sysreg_s (SYS_TFSR_EL1 ); +u64 tfsr_el1 =read_sysreg_s (SYS_TFSR_EL1 );if (unlikely (tfsr_el1 &SYS_TFSR_EL1_TF1 )) {/*
@@ -199,6 +194,9 @@ void mte_thread_init_user(void)void mte_thread_switch (struct task_struct *next) { +if (!system_supports_mte ()) +return ; +mte_update_sctlr_user (next);/*