[PATCH v2 0/3] aarch64: Add malloc MTE support
Muhammad Kamran
muhammad.kamran@arm.com
Wed Sep 30 08:44:06 GMT 2026
This series adds AArch64 malloc memory tagging support using MTE.
The first patch adds small malloc sysdep hooks for request-size and usable-size
calculations. This lets AArch64 adjust those calculations so the MTE granule
containing malloc chunk metadata is not exposed as usable allocation space.
The remaining patches add the AArch64 malloc IFUNC plumbing and MTE-aware
malloc-family wrappers. These wrappers return tagged user pointers when MTE
heap tagging is enabled and round allocations to MTE granules.
Changes since v1:
- Dropped the already-committed test fixes.
- Reworked the malloc changes to use small sysdep hooks instead of moving
malloc alignment, chunk layout, and size conversion definitions into
internal sysdeps headers.
- Kept the AArch64 size adjustment in the Linux AArch64 malloc sysdep header,
where it overrides the generic request-size and usable-size hooks.
Tested on aarch64-linux-gnu, arm-linux-gnueabihf, x86_64-linux-gnu,
i686-linux-gnu and build-tested for several targets with build-many-glibcs.py
and no regressions have been found.
Muhammad Kamran (3):
malloc: Add sysdep hooks for request and usable sizes
malloc: aarch64: Add MTE ifunc resolvers
malloc: aarch64: Add MTE memory tagging
malloc/arena.c | 9 +-
malloc/malloc.c | 26 ++-
sysdeps/aarch64/multiarch/Makefile | 1 +
sysdeps/aarch64/multiarch/malloc-ifuncs.c | 30 +--
sysdeps/aarch64/multiarch/malloc-ifuncs.h | 34 ++++
sysdeps/aarch64/multiarch/malloc-init.h | 33 +++
sysdeps/aarch64/multiarch/malloc-mte.c | 190 ++++++++++++++++++
sysdeps/generic/malloc-init.h | 25 +++
sysdeps/unix/sysv/linux/aarch64/Makefile | 43 ++++
.../unix/sysv/linux/aarch64/malloc-sysdep.h | 22 ++
.../unix/sysv/linux/aarch64/tst-mte-helper.h | 111 ++++++++++
.../linux/aarch64/tst-mte-malloc-static.c | 1 +
.../unix/sysv/linux/aarch64/tst-mte-malloc.c | 174 ++++++++++++++++
.../linux/aarch64/tst-mte-realloc-static.c | 1 +
.../unix/sysv/linux/aarch64/tst-mte-realloc.c | 107 ++++++++++
15 files changed, 782 insertions(+), 25 deletions(-)
create mode 100644 sysdeps/aarch64/multiarch/malloc-init.h
create mode 100644 sysdeps/aarch64/multiarch/malloc-mte.c
create mode 100644 sysdeps/generic/malloc-init.h
create mode 100644 sysdeps/unix/sysv/linux/aarch64/malloc-sysdep.h
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-mte-helper.h
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-mte-malloc-static.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-mte-malloc.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-mte-realloc-static.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-mte-realloc.c
--
2.43.0
More information about the Libc-alpha
mailing list