diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2021-01-04 13:36:14 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2021-01-07 12:39:01 +0100 |
commit | 83b5bd628f65e6b4d1924b307d6a88a57827bdb0 (patch) | |
tree | 0d4bf18c4b3f3258ad2ed1f90718bc0d7e95d8f7 | |
parent | arm64: kasan: Set TCR_EL1.TBID1 when KASAN_HW_TAGS is enabled (diff) | |
download | linux-83b5bd628f65e6b4d1924b307d6a88a57827bdb0.tar.xz linux-83b5bd628f65e6b4d1924b307d6a88a57827bdb0.zip |
arm64: Move PSTATE.TCO setting to separate functions
For consistency with __uaccess_{disable,enable}_hw_pan(), move the
PSTATE.TCO setting into dedicated __uaccess_{disable,enable}_tco()
functions.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
-rw-r--r-- | arch/arm64/include/asm/uaccess.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index 6f986e09a781..f0fe0cc6abe0 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -176,10 +176,21 @@ static inline void __uaccess_enable_hw_pan(void) * The Tag check override (TCO) bit disables temporarily the tag checking * preventing the issue. */ -static inline void uaccess_disable_privileged(void) +static inline void __uaccess_disable_tco(void) { asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(0), ARM64_MTE, CONFIG_KASAN_HW_TAGS)); +} + +static inline void __uaccess_enable_tco(void) +{ + asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(1), + ARM64_MTE, CONFIG_KASAN_HW_TAGS)); +} + +static inline void uaccess_disable_privileged(void) +{ + __uaccess_disable_tco(); if (uaccess_ttbr0_disable()) return; @@ -189,8 +200,7 @@ static inline void uaccess_disable_privileged(void) static inline void uaccess_enable_privileged(void) { - asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(1), - ARM64_MTE, CONFIG_KASAN_HW_TAGS)); + __uaccess_enable_tco(); if (uaccess_ttbr0_enable()) return; |