Page MenuHomeFreeBSD

arm64: mte: userspace configuration of MTE via sysarch() system call
Needs ReviewPublic

Authored by andrew on Mar 19 2026, 4:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 13, 10:58 AM
Unknown Object (File)
Wed, Jun 10, 2:53 PM
Unknown Object (File)
Thu, Jun 4, 10:17 PM
Unknown Object (File)
Thu, Jun 4, 10:17 PM
Unknown Object (File)
Fri, May 22, 9:40 AM
Unknown Object (File)
May 17 2026, 7:00 AM
Unknown Object (File)
May 17 2026, 7:00 AM
Unknown Object (File)
May 14 2026, 8:30 AM
Subscribers

Details

Reviewers
manu
Group Reviewers
arm64
Summary

Introduce two new sysarch options to allow for userspace configuration
of MTE: ARM64_MEMORY_TAG and ARM64_MTE_CTRL.

ARM64_MTE_CTRL allows for userspace configuration of MTE for a process,
including setting the Tag Check Fault and Allocation Access bits in
SCTLR_EL1 to control whether accesses to tagged memory cause an
exception on a tag check fault, and whether that exception is raised
synchronously or asynchronously.

ARM64_MEMORY_TAG is used to tag the pages in a given memory range by
changing their memory attributes. The arguments for this are the same as
the sysarch BTI option, so the arm64_guard_page_args struct has been
renamed to arm64_memory_args.

Sponsored by: Arm Ltd
Signed-off-by: Harry Moulton <harry.moulton@arm.com>
Co-authored-by: Andrew Turner <andrew@FreeBSD.org>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 71539
Build 68422: arc lint + arc unit

Event Timeline

markj added inline comments.
sys/arm64/arm64/mte.c
55

Why are these defined as macros and not functions?

82

Should this be written td->td_md.md_sctlr &= ~SCTLR_USER_MASK?

87

The function should reject unknown flags.

93

Not EOPNOTSUPP?

124

I don't think we can have td != curthread right now? If that's going to become false at some point, this function should also make sure the calling thread has permission to modify the target process...

125

Left in a debug print.

256

Why does this not preserve SCTLR_ATA0?

277

Same here.

sys/arm64/arm64/sys_machdep.c
85