Skip to content

Commit

Permalink
arm64: Move PSTATE.TCO setting to separate functions
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Vincenzo Frascino <[email protected]>
Acked-by: Mark Rutland <[email protected]>
  • Loading branch information
ctmarinas committed Jan 7, 2021
1 parent f34d93f commit 83b5bd6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions arch/arm64/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 83b5bd6

Please sign in to comment.