[PATCH] arm64: mte: Avoid setting PG_mte_tagged if no tags cleared or restored

Catalin Marinas catalin.marinas at arm.com
Wed Oct 12 09:36:50 PDT 2022


On Thu, 6 Oct 2022 17:33:54 +0100, Catalin Marinas wrote:
> Prior to commit 69e3b846d8a7 ("arm64: mte: Sync tags for pages where PTE
> is untagged"), mte_sync_tags() was only called for pte_tagged() entries
> (those mapped with PROT_MTE). Therefore mte_sync_tags() could safely use
> test_and_set_bit(PG_mte_tagged, &page->flags) without inadvertently
> setting PG_mte_tagged on an untagged page.
> 
> The above commit was required as guests may enable MTE without any
> control at the stage 2 mapping, nor a PROT_MTE mapping in the VMM.
> However, the side-effect was that any page with a PTE that looked like
> swap (or migration) was getting PG_mte_tagged set automatically. A
> subsequent page copy (e.g. migration) copied the tags to the destination
> page even if the tags were owned by KASAN.
> 
> [...]

Applied to arm64 (for-next/core), thanks!

[1/1] arm64: mte: Avoid setting PG_mte_tagged if no tags cleared or restored
      https://git.kernel.org/arm64/c/a8e5e5146ad0

-- 
Catalin




More information about the linux-arm-kernel mailing list