[PATCH 0/2] RFC: Support for MTE stack tagging.

Cupertino Miranda cupertino.miranda@oracle.com
Fri Mar 14 13:21:40 GMT 2025


Hi everyone,

This is an initial work to enable glibc support for MTE stack tagging.
In a nutshell glibc should set PROT_MTE to any stack pages which get
allocated for any running application which requires MTE stack tagging.

The approach taken to flag the need for stack tagging is to check
.dynamic entries specific to aarch64, as described in section 6 from:
https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst

This is an initial propose patch. I would like to get some feedback
for the approach used to check for the .dynamic flags, how the
PROT_MTE property is set for the stacks or any other comments.

This feature is related to the work done by Indu Bhagat submitted as RFC
in gcc-patches:
  https://gcc.gnu.org/pipermail/gcc-patches/2024-November/668017.html
And in binutils in:
  https://sourceware.org/pipermail/binutils/2024-December/137989.html

I noticed my patches fail a lot of conform/linknamespace tests. I
think I need some guidance for why this happens.

Looking forward to your comments.

Best regards,
Cupertino

Cupertino Miranda (2):
  rtld: Enable MTE for stack when specified in .dynamic.
  nptl: Enable MTE for stacks created for threads.

 elf/dl-mte-stack.c                            | 28 +++++++
 elf/elf.h                                     |  8 +-
 nptl/allocatestack.c                          |  3 +-
 nptl/nptl-stack.c                             |  7 ++
 nptl/nptl-stack.h                             |  2 +
 sysdeps/aarch64/Makefile                      |  3 +-
 sysdeps/aarch64/cpu-features.h                | 15 ++++
 sysdeps/aarch64/dl-mte.c                      | 50 +++++++++++
 sysdeps/aarch64/dl-prop.h                     |  4 +
 sysdeps/unix/sysv/linux/aarch64/Makefile      | 10 +++
 .../unix/sysv/linux/aarch64/dl-mte-stack.c    | 83 +++++++++++++++++++
 11 files changed, 210 insertions(+), 3 deletions(-)
 create mode 100644 elf/dl-mte-stack.c
 create mode 100644 sysdeps/aarch64/dl-mte.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/dl-mte-stack.c

-- 
2.39.5



More information about the Libc-alpha mailing list