Join our Newsletter — 33% off our NHI Course
Home› Guides› Arm MTE Guide: Hardware Memory Tagging Against Use-After-Free…
Guide Application Security

Arm MTE Guide: Hardware Memory Tagging Against Use-After-Free and Overflows

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 12 min read
On this page

Use-after-free and out-of-bounds writes in C and C++ code remain among the most exploited bug classes, and rewriting every native component in a memory-safe language will take years. The Arm Memory Tagging Extension (MTE) is a hardware feature that tags memory and pointers so the CPU can catch many of these bugs at the moment of access, in testing and in production. This guide explains how tagging works, the synchronous, asynchronous and asymmetric modes and their trade-offs, where MTE is available on Android and Linux, and how to deploy and test it. It is for systems developers, platform security engineers and mobile security teams. Platform support is stated from vendor documentation as checked on 26 November 2026; hardware and OS support changes, so confirm against the current documentation.

Key takeaways

  • MTE is a lock and key check in hardware. Every 16-byte granule of memory carries a 4-bit tag, every pointer carries a 4-bit key in its top byte, and a mismatch on load or store raises a fault.
  • Detection is probabilistic, not guaranteed. With only 16 tag values, a stale or stray pointer can match by chance, so MTE raises attacker cost and catches most bugs across many runs rather than proving their absence.
  • Mode choice is a speed versus precision trade. SYNC stops the faulting instruction and reports the address; ASYNC reports later with low overhead; ASYMM checks reads synchronously and writes asynchronously.
  • Support is real but uneven. Android has supported MTE for heap allocation since Android 12, with select devices from Android 13; Linux exposes it to userspace through PROT_MTE and prctl on MTE-capable arm64 hardware.
  • It complements, not replaces, memory-safe languages. MTE hardens existing native code and finds bugs in testing; new code in memory-safe languages removes the bug classes at source.

What MTE is

MTE was introduced in the Armv8.5-A architecture, described in Arm's "Armv8.5-A Memory Tagging Extension" white paper, and Android documentation describes it as part of Armv9. It adds four bits of metadata to every 16 bytes of physical memory, called the tag granule, and uses Top Byte Ignore (TBI) so that four bits in the top byte of a 64-bit pointer can carry a matching tag without enlarging pointers. When a program allocates memory, the allocator picks a tag, writes it to the granules and returns a pointer carrying the same tag. On free, the memory is retagged, so a dangling pointer still holding the old tag no longer matches.

The two bug classes it targets are:

  • Temporal errors (CWE-416 Use After Free): a pointer used after its memory was freed or reallocated now carries the wrong tag.
  • Spatial errors (CWE-787 Out-of-bounds Write and related reads): a pointer that runs past the end of its allocation into an adjacent allocation meets a different tag.

Arm's own guidance frames MTE for both uses: testing a product with MTE enabled finds latent bugs, and deployment with imprecise checks gives a balance between performance and detection. Apple's Memory Integrity Enforcement, announced in September 2025, builds on the later Enhanced MTE (EMTE, FEAT_MTE4 in Armv8.9) in synchronous mode; that is a separate implementation and this guide focuses on Arm MTE on Android and Linux.

How tagging works

ElementDetailWhy it matters
Tag granule16 bytes, alignedOverflows smaller than the padding up to the next granule boundary are not caught
Tag size4 bits (16 values)A random wrong tag matches about 1 time in 16
Pointer key4 bits in the top byte via TBINo pointer size change, so ABI stays the same
Tag storage4 bits per 16 bytes, held by the memory systemSmall memory cost compared with software shadow memory
Allocator roleChooses tags on allocate and retags on freeProtection depends on the allocator: Scudo on Android, glibc malloc on Linux when enabled
Tag selectionRandom tags, with adjacent allocations kept distinct where configuredMakes linear overflows into neighbours deterministic to catch

Probabilistic detection

Tags cannot be unique across all allocations, as Arm's white paper notes, but allocators can make sequential allocations differ. Android's allocator exposes this choice: M_MEMTAG_TUNING_BUFFER_OVERFLOW, the default, gives deterministic detection of overflows into adjacent allocations, while M_MEMTAG_TUNING_UAF gives about 93% detection probability for both spatial and temporal bugs. Over many executions on many devices, the chance that at least one run catches a given bug tends towards certainty, which is why fleet-wide deployment finds bugs that a single test run misses.

Synchronous, asynchronous and asymmetric modes

ModeWhat happens on mismatchReport qualityOverheadBest use
SYNCThe faulting access is not performed; SIGSEGV with SEGV_MTESERR and the fault addressPrecise; Android records allocation and free stack tracesHighestTesting, debugging and high-value attack surfaces where security outweighs speed
ASYNCFault recorded and delivered at the next kernel entry; SIGSEGV with SEGV_MTEAERR and no fault addressImpreciseLowProduction mitigation for well-tested code with low bug density
ASYMMReads checked synchronously, writes asynchronously (Armv8.7-A)Precise for readsSimilar to ASYNCProduction where hardware supports it; Android recommends it whenever available

Decision guidance: run SYNC in CI, fuzzing and pre-release testing. In production, choose ASYMM on hardware that supports it, otherwise ASYNC, and keep SYNC for the most exposed processes, such as parsers of untrusted media or network input. Apple argues in its Memory Integrity Enforcement write-up that asynchronous checking leaves a race window for attackers, which is the main argument for SYNC where its cost is acceptable. On Android, when ASYNC finds a bug, the runtime API can switch a process to SYNC to capture an accurate report.

On Linux the per-CPU file /sys/devices/system/cpu/cpu<N>/mte_tcf_preferred (values async, sync or asymm, default async, writable only by privileged users) sets which mode the kernel picks when a task allows several. Android notes that small in-order cores often perform similarly across modes and can be set to prefer SYNC.

Where MTE is available today

Platforms are listed alphabetically.

PlatformWhat the vendor documentation statesHow it is enabled
Android (AOSP)Kernel and userspace heap support since Android 12; in Android 12, ASYNC was enabled for system_server, zygote64, Bluetooth, NFC and SecureElement HALs, statsd, system apps and networking daemons except netd. Stack tagging from Android 14 QPR3. MTE-accelerated KASAN (CONFIG_KASAN_HW_TAGS) on by default in GKI kernels from android12-5.10Build flags (memtag_heap), system property arm64.memtag.process.<basename>, MEMTAG_OPTIONS, app manifest
Android devicesSelect devices support MTE starting from Android 13; Android developer documentation lists Pixel 8 and later Pixel models as known to support it. Some devices offer a Developer Options toggle to reboot with MTE enabled, described as experimentalCheck /proc/cpuinfo for the mte feature flag
Apple (iPhone)Apple announced Memory Integrity Enforcement in September 2025, built on the Enhanced Memory Tagging Extension (EMTE) in synchronous mode, on A19 and A19 Pro chips in iPhone 17 models and iPhone AirBuilt into the operating system on supported devices; see Apple's security research blog for the design
Linux (arm64)CONFIG_ARM64_MTE on MTE-capable hardware, advertised to userspace as HWCAP2_MTE. Kernel heap checking through Hardware Tag-Based KASANPROT_MTE on mmap or mprotect, prctl(PR_SET_TAGGED_ADDR_CTRL) per thread, glibc.mem.tagging tunable

MTE needs both CPU support and firmware and kernel enablement, so a capable CPU does not guarantee that tagging is switched on. Verify on the actual target rather than from a chip specification.

Deploying and testing with MTE

Android apps

  • Manifest: set android:memtagMode on <application> or <process> to off, default, sync or async. MTE is off by default, and a <process> value overrides the application value.
  • Debug builds: override memtagMode to sync in the debug manifest so testers always get precise reports.
  • Single device: enable NATIVE_MEMTAG_SYNC or NATIVE_MEMTAG_ASYNC under Developer options, App Compatibility Changes.
  • Stack tagging: rebuild native code with -fsanitize=memtag and -march=armv8-a+memtag. Instrumented apps only run on MTE-capable devices, so keep this to test builds.
  • Reports: crashes produce a tombstone with the signal code, a cause line such as use after free, and allocation and free backtraces.

Android platform builders

  • Per module: sanitize: { memtag_heap: true } in Android.bp for ASYNC, plus diag: { memtag_heap: true } for SYNC.
  • Per directory: PRODUCT_MEMTAG_HEAP_ASYNC_INCLUDE_PATHS, PRODUCT_MEMTAG_HEAP_SYNC_INCLUDE_PATHS and PRODUCT_MEMTAG_HEAP_EXCLUDE_PATHS.
  • Runtime: mallopt with M_HEAP_TAGGING_LEVEL_SYNC, _ASYNC or _NONE. Switching to NONE is one-way and disables MTE for the process.
  • Kernel: kasan.mode=sync or async and kasan.fault=report or panic on the boot command line.

Linux userspace

  • glibc: set glibc.mem.tagging through GLIBC_TUNABLES; bit 0 makes malloc return tagged memory with random tags, bit 1 requests precise faulting. The default, 0, disables tagging.
  • Custom allocators: map memory with PROT_MTE (anonymous and RAM-based file mappings only) and set the check mode with PR_MTE_TCF_SYNC or PR_MTE_TCF_ASYNC; requesting both selects asymmetric mode where supported.
  • Diagnostics: core dumps include tags as PT_AARCH64_MEMTAG_MTE segments, and debuggers read tags through PTRACE_PEEKMTETAGS.

Phased rollout

  1. Inventory: list native components that parse untrusted input and the hardware they run on; confirm MTE is enabled on that hardware.
  2. Test in SYNC: enable SYNC in CI, unit tests and fuzzing on MTE hardware. Fix every finding; latent bugs often surface immediately.
  3. Pilot ring: enable ASYNC or ASYMM for a small internal fleet and collect SEGV_MTEAERR crashes through your crash pipeline.
  4. Expand: widen the ring by process and device group, keeping SYNC for the highest-risk processes.
  5. Roll back safely: on Android, set memtagMode or the system property to off for an affected process; on Linux, clear the glibc tunable. Keep the switch per process so one crashing component does not force fleet-wide disablement.

Limits and complements

ControlWhat it coversRelation to MTE
Memory-safe languagesRemoves most spatial and temporal bugs at sourceLong-term fix; MTE protects the native code that remains
HWASan and ASanSoftware sanitisers with high coverage in test buildsMTE SYNC is a faster test option that needs no recompiling for heap checks
FuzzingGenerates inputs that reach buggy pathsMTE turns silent corruption into visible crashes during fuzzing
ASLR, DEP and CFIMake exploitation harder after corruptionMTE aims to stop the corruption itself; layer both
Hardware Tag-Based KASANKernel heap checking with MTESame hardware; reports only the first bug and then disables checking
  • Granularity: overflows that stay inside the same 16-byte granule, or inside one allocation (for example between fields of a struct), are not detected.
  • Collisions: random tags can collide, so an attacker able to retry may eventually get a matching pointer; ASYNC reporting also leaves a window before termination.
  • Coverage gaps: memory that is not tagged, such as untagged mappings or allocators without MTE support, gets no protection.
  • Compatibility: code that stores data in pointer top bits or makes assumptions about pointer values can break; test on MTE devices before shipping.

See the Memory-Safe Languages Guide, the Exploit Mitigations Guide and the Fuzzing Guide.

Detection, measurement and framework mapping

Treat every MTE fault as a security-relevant memory safety bug until triaged. Feed tombstones and core dumps into the same crash pipeline as other native crashes, tagged by signal code so SEGV_MTESERR and SEGV_MTEAERR can be counted separately.

  • Coverage: share of native processes handling untrusted input that run with MTE enabled, by mode.
  • Findings: MTE faults per release in testing and in the field, and the share fixed before release.
  • Time to fix: median days from first MTE report to shipped fix.
  • Escape rate: memory safety bugs found externally in components already running MTE.
  • Performance budget: measured overhead per mode on target hardware, against an agreed limit.
FrameworkReferenceHow MTE relates
NIST SP 800-53 Rev 5SI-16 Memory ProtectionControls that protect system memory from unauthorised code execution; MTE is a hardware means of meeting it
NIST SP 800-53 Rev 5SA-11 Developer Testing and EvaluationSYNC mode in CI and fuzzing as a dynamic testing control
NIST SP 800-53 Rev 5SA-8 Security and Privacy Engineering PrinciplesSecure-by-design choice of platform mitigations
MITRE ATT&CKT1203 Exploitation for Client Execution; T1068 Exploitation for Privilege EscalationRaises the cost of exploiting memory corruption bugs for these techniques
MITRE CWECWE-416, CWE-787The bug classes MTE detects

Common failure patterns

  • Assuming a capable chip means MTE is on: firmware, kernel and allocator must all enable it. Check /proc/cpuinfo or HWCAP2_MTE on the target.
  • Running ASYNC in testing: imprecise reports without a fault address slow triage. Use SYNC wherever performance is not the constraint.
  • Shipping stack-tagged builds: instrumented apps only run on MTE-capable devices, so they fail elsewhere.
  • Disabling MTE globally on the first crash: the crash is usually a real bug. Disable per process if needed and fix the defect.
  • Ignoring field crashes: SEGV_MTEAERR reports that are never routed to engineering waste the fleet-wide detection that makes probabilistic tagging effective.

Practitioner checklist

  • Confirm MTE is enabled on each target platform, not just supported by the CPU.
  • Run SYNC mode in CI, unit tests and fuzzing on MTE hardware for all native code.
  • Choose ASYMM in production where supported, otherwise ASYNC, and SYNC for the most exposed processes.
  • Set android:memtagMode explicitly for apps with native code, with a sync override in debug builds.
  • Enable glibc.mem.tagging or an MTE-aware allocator for Linux services that parse untrusted input.
  • Route SEGV_MTESERR and SEGV_MTEAERR crashes into the crash pipeline with security triage.
  • Keep a per-process off switch for rollback rather than fleet-wide disablement.
  • Track coverage, findings and time to fix, and pair MTE with a plan to move new code to memory-safe languages.

Standards and references

Related NHI Mgmt Group resources: Memory-Safe Languages Guide · Exploit Mitigations Guide · Fuzzing Guide · Android App Security Guide · CWE Top 25 Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.