[PATCH 0/4] Expand MTE tagging API to multi-page and !0 tags

From: Pierre-Clément Tosi

Date: Tue Dec 01 2026 - 09:50:16 EST


(Based on kvmarm/fixes, to avoid conflicts with Fuad's patches [1])

This series aims to provide an MTE page-tagging API which

1. supports non-zero tags, such that KASAN can reuse it (future series)
2. has built-in support for multi-page passes, for folios, (m)THP, ...

It achieves this as follows:

- patch 1 adds helpers for logical tags, used by later commits
- patch 2 decouples the page tagging API from mte.h, to address on-going
pains of circular dependencies that header is very prone to
- patch 3 adds support for multi-page tagging with any tag value
- patch 4 adds separate functions for clearing the data along tagging

The new functions are named to fit in with existing kernel APIs and for
conciseness and clarity. A later series will make use of them and
introduce helpers for callers not dealing directly with void*, which is
most of them. That's moved out into a separate series so that the
bikeshedding doesn't delay other series (optimizations & integration
with KASAN).

Tested on v7.4-rc1 with [1]:
git cherry-pick cbf47fe57a56 62b9e1f75a3c da9f24dc4336

[1]: https://lore.kernel.org/all/20261021110700.493315-1-fuad.tabba@xxxxxxxxx

Signed-off-by: Pierre-Clément Tosi <ptosi@xxxxxxxxxx>
---
Pierre-Clément Tosi (4):
arm64: Introduce mte_tag_of()/mte_tagged() helpers
arm64: Introduce <asm/mte-tagging.h>
arm64: Introduce mte_tag_page[s]()
arm64: Introduce mte_[tag_]clear_page[s]()

arch/arm64/include/asm/mte-def.h | 20 +++++++++++
arch/arm64/include/asm/mte-kasan.h | 4 +--
arch/arm64/include/asm/mte-tagging.h | 67 ++++++++++++++++++++++++++++++++++++
arch/arm64/include/asm/mte.h | 5 ---
arch/arm64/kernel/cpufeature.c | 1 +
arch/arm64/kernel/mte.c | 1 +
arch/arm64/kvm/guest.c | 1 +
arch/arm64/kvm/mmu.c | 1 +
arch/arm64/lib/mte.S | 26 +++++++-------
arch/arm64/mm/fault.c | 3 +-
arch/arm64/mm/proc.S | 8 ++---
11 files changed, 111 insertions(+), 26 deletions(-)
---
base-commit: 012e4bc01e339a65dc7c59181b5efb33b171d12c
change-id: 20261129-mte-page-api-f285a514f1ad

Best regards,
--
Pierre-Clément Tosi <ptosi@xxxxxxxxxx>