]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: mte: Ensure TIF_MTE_ASYNC_FAULT is set atomically
authorCatalin Marinas <catalin.marinas@arm.com>
Fri, 9 Apr 2021 17:37:10 +0000 (18:37 +0100)
committerWill Deacon <will@kernel.org>
Mon, 12 Apr 2021 12:38:45 +0000 (13:38 +0100)
commit3c9652edccf64d99413426afa3880dd18d4ddd1a
tree954e29baf4bce155777502117ff6cb26272ea2e4
parent5406db78376b09f6668fef51cce328d7019bd499
arm64: mte: Ensure TIF_MTE_ASYNC_FAULT is set atomically

The entry from EL0 code checks the TFSRE0_EL1 register for any
asynchronous tag check faults in user space and sets the
TIF_MTE_ASYNC_FAULT flag. This is not done atomically, potentially
racing with another CPU calling set_tsk_thread_flag().

Replace the non-atomic ORR+STR with an STSET instruction. While STSET
requires ARMv8.1 and an assembler that understands LSE atomics, the MTE
feature is part of ARMv8.5 and already requires an updated assembler.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Fixes: 4f75c14b1f16 ("arm64: mte: Handle synchronous and asynchronous tag check faults")
Cc: <stable@vger.kernel.org> # 5.10.x
Reported-by: Will Deacon <will@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20210409173710.18582-1-catalin.marinas@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/Kconfig
arch/arm64/kernel/entry.S