Explore Arm Memory Tagging Extension with an example C program
Introduction
Create and compile an example C application to explore Arm MTE
Run the example application to explore Arm MTE
Next Steps
Explore Arm Memory Tagging Extension with an example C program
Who is this for?
This is an introductory topic for developers who want to gain experience with the Arm Memory Tagging Extension (MTE).
What will you learn?
Upon completion of this Learning Path, you will be able to:
- Build an MTE-enabled C program on AArch64 Linux
- Run the program to observe MTE detecting an invalid memory access
- Use QEMU to run the example when MTE hardware is unavailable
Prerequisites
Before starting, you will need the following:
- An AArch64 Linux development machine. You can also use a cloud instance. For more information, see the list of Arm cloud service providers .
Summary
This summary was drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
You’ll explore Arm MTE on an
aarch64 Linux system. First, you’ll build and run a small C program that triggers buffer-overflow and use-after-free errors, then observe the resulting faults or diagnostics. You’ll use a recent Arm system or supported Arm-based cloud instance to relate MTE behavior to invalid memory accesses.Frequently asked questions
These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
MTE is implemented in Armv8.5-A and Armv9-A processors. Verify that you’re using an AArch64 Linux system with hardware that supports MTE. Otherwise, the example might not show tagging-related behavior.
Expect behavior that illustrates MTE catching memory safety issues, such as a fault or diagnostic triggered by an invalid access. The outcome should align with the bug the program intentionally exercises.
Yes. Install
qemu-user and run the example with qemu-aarch64 ./mte-example. This lets you exercise MTE behavior when the processor doesn’t implement MTE.Confirm you’re on AArch64 Linux and that the processor implements MTE (Armv8.5-A or Armv9-A). If the processor lacks MTE support, install
qemu-user and run qemu-aarch64 ./mte-example to exercise the MTE behavior through emulation.The example writes beyond a 16-byte allocation granule at offset
0x10. MTE detects the tag mismatch and should generate an exception.