]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: mte: Ensure the cleared tags are visible before setting the PTE
authorCatalin Marinas <catalin.marinas@arm.com>
Tue, 17 May 2022 09:35:32 +0000 (10:35 +0100)
committerWill Deacon <will@kernel.org>
Tue, 17 May 2022 13:29:51 +0000 (14:29 +0100)
commit15263263596c88a570355c8bf6330909fb17c208
treea86bef28c0094d659065a86755b5b14fe433fa24
parent90829aaa59aecd2100a978684adecb3ffe825cec
arm64: mte: Ensure the cleared tags are visible before setting the PTE

As an optimisation, only pages mapped with PROT_MTE in user space have
the MTE tags zeroed. This is done lazily at the set_pte_at() time via
mte_sync_tags(). However, this function is missing a barrier and another
CPU may see the PTE updated before the zeroed tags are visible. Add an
smp_wmb() barrier if the mapping is Normal Tagged.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Fixes: 070bcde54743 ("arm64: mte: Clear the tags when a page is mapped in user-space with PROT_MTE")
Cc: <stable@vger.kernel.org> # 5.10.x
Reported-by: Vladimir Murzin <vladimir.murzin@arm.com>
Cc: Will Deacon <will@kernel.org>
Reviewed-by: Steven Price <steven.price@arm.com>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com>
Link: https://lore.kernel.org/r/20220517093532.127095-1-catalin.marinas@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/mte.c