[v3,0/2] Enable MTE support for stack

Message ID 20260310141107.43347-1-claudiu.zissulescu-ianculescu@oracle.com (mailing list archive)
Headers
Series Enable MTE support for stack |

Message

Claudiu Zissulescu March 10, 2026, 2:11 p.m. UTC
  From: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>

Hello,

This is a follow up of v2 with the next changes:

 - use mprotect flags PROT_GROWSDOWN/PROT_GROWSUP.
 - corrects macros in cpu-feature.h, and fixes code styles in dl-mte.c
 - adds MTE-aware setjmp/longjmp support for stack tag cleanup.
 - adds a configure check for -fsanitize=memtag-stack compiler flag.
 - adds two new tests.

Changes history:
  - dropped changes related to stack creation for threads. No longer
    needed.
  - Adaped code to changes introduced with:
      "elf: early conversion of elf p_flags to mprotect flags"
 
Best wishes,
Claudiu

Claudiu Zissulescu (1):
  aarch64: Add memory tagging support for setjmp/longjmp routines

Cupertino Miranda (1):
  rtld: Enable MTE for stack when specified in .dynamic

 configure                                     |  36 ++++++
 configure.ac                                  |  17 +++
 elf/elf.h                                     |   7 +-
 sysdeps/aarch64/Makefile                      |  10 ++
 sysdeps/aarch64/__longjmp.S                   |  33 ++++++
 sysdeps/aarch64/cpu-features.h                |  12 ++
 sysdeps/aarch64/dl-mte.c                      |  85 ++++++++++++++
 sysdeps/aarch64/dl-prop.h                     |   4 +
 sysdeps/aarch64/tst-mte-jmp.c                 | 108 ++++++++++++++++++
 sysdeps/aarch64/tst-mte-stack.c               |  74 ++++++++++++
 sysdeps/unix/sysv/linux/aarch64/Makefile      |   4 +
 .../unix/sysv/linux/aarch64/dl-mte-stack.c    |  45 ++++++++
 12 files changed, 434 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/aarch64/dl-mte.c
 create mode 100644 sysdeps/aarch64/tst-mte-jmp.c
 create mode 100644 sysdeps/aarch64/tst-mte-stack.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/dl-mte-stack.c
  

Comments

Yury Khrustalev March 10, 2026, 2:35 p.m. UTC | #1
On Tue, Mar 10, 2026 at 04:11:05PM +0200, claudiu.zissulescu-ianculescu@oracle.com wrote:
> From: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
> 
> Hello,
> 
> This is a follow up of v2 with the next changes:
> 
>  - use mprotect flags PROT_GROWSDOWN/PROT_GROWSUP.
>  - corrects macros in cpu-feature.h, and fixes code styles in dl-mte.c
>  - adds MTE-aware setjmp/longjmp support for stack tag cleanup.
>  - adds a configure check for -fsanitize=memtag-stack compiler flag.
>  - adds two new tests.
> 
> Changes history:
>   - dropped changes related to stack creation for threads. No longer
>     needed.
>   - Adaped code to changes introduced with:
>       "elf: early conversion of elf p_flags to mprotect flags"
>  
> Best wishes,
> Claudiu

Thanks for this, I will look into these changes shortly.

As I've said earlier, please don't merge these patches until we have
discussed the required ABI changes (via a new issue in [1]) and also
documented it in the relevant ABI spec (SYSVABI).

Please note that the MemTagABIELF64 [2] is **not stable** is likely to
change significantly, and implementing it in Glibc would create serious
issue with backward compatibility.

[1]: https://github.com/ARM-software/abi-aa
[2]: https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst

Thanks,
Yury
  
Yury Khrustalev March 18, 2026, 9:49 a.m. UTC | #2
Hi Claudiu,

On Tue, Mar 10, 2026 at 04:11:05PM +0200, claudiu.zissulescu-ianculescu@oracle.com wrote:
> From: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
> 
> Hello,
> 
> This is a follow up of v2 with the next changes:
> 
>  - use mprotect flags PROT_GROWSDOWN/PROT_GROWSUP.
>  - corrects macros in cpu-feature.h, and fixes code styles in dl-mte.c
>  - adds MTE-aware setjmp/longjmp support for stack tag cleanup.
>  - adds a configure check for -fsanitize=memtag-stack compiler flag.
>  - adds two new tests.
> 
> Changes history:
>   - dropped changes related to stack creation for threads. No longer
>     needed.
>   - Adaped code to changes introduced with:
>       "elf: early conversion of elf p_flags to mprotect flags"
>  
> Best wishes,
> Claudiu

I've sent an email [1] to explain plans for the work that will need to
be done before this patch can move forward.

I am working on this separate patch for this preparation right now, you
will need to wait for it to come through and then rebase your patch.

I've also raised issues in Arm ABI GitHub repo [2] to discuss what
should be written down in the spec: [3, 4, 5]. Please engage in this
discussion. Thank you!

Kind regards,
Yury

---

[1]: https://inbox.sourceware.org/libc-alpha/abpzpwY6C2ycSnv7@arm.com/
[2]: https://github.com/ARM-software/abi-aa/
[3]: https://github.com/ARM-software/abi-aa/issues/381 (for MemtagABI)
[4]: https://github.com/ARM-software/abi-aa/issues/382 (for SYSVABI)
[5]: https://github.com/ARM-software/abi-aa/issues/383 (for AAPCS64,
     as longjmp and setjmp are described in AAPCS64)
  
Yury Khrustalev March 20, 2026, 11:42 a.m. UTC | #3
On Wed, Mar 18, 2026 at 09:49:45AM +0000, Yury Khrustalev wrote:
> Hi Claudiu,
> 
> On Tue, Mar 10, 2026 at 04:11:05PM +0200, claudiu.zissulescu-ianculescu@oracle.com wrote:
> > From: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
> > 
> > Hello,
> > 
> > This is a follow up of v2 with the next changes:
> > 
> >  - use mprotect flags PROT_GROWSDOWN/PROT_GROWSUP.
> >  - corrects macros in cpu-feature.h, and fixes code styles in dl-mte.c
> >  - adds MTE-aware setjmp/longjmp support for stack tag cleanup.
> >  - adds a configure check for -fsanitize=memtag-stack compiler flag.
> >  - adds two new tests.
> > 
> > Changes history:
> >   - dropped changes related to stack creation for threads. No longer
> >     needed.
> >   - Adaped code to changes introduced with:
> >       "elf: early conversion of elf p_flags to mprotect flags"
> >  
> > Best wishes,
> > Claudiu
> 
> I've sent an email [1] to explain plans for the work that will need to
> be done before this patch can move forward.
> 
> I am working on this separate patch for this preparation right now, you
> will need to wait for it to come through and then rebase your patch.

Please see https://inbox.sourceware.org/libc-alpha/20260320113657.167707-1-yury.khrustalev@arm.com/

Kind regards,
Yury