Page MenuHomeFreeBSD

arm64: Add PROT_MTE to mmap
Needs ReviewPublic

Authored by andrew on Mar 19 2026, 4:06 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jun 25, 2:35 AM
Unknown Object (File)
Wed, Jun 24, 4:37 AM
Unknown Object (File)
Tue, Jun 23, 12:53 AM
Unknown Object (File)
Sat, Jun 20, 5:06 PM
Unknown Object (File)
Fri, Jun 19, 12:53 AM
Unknown Object (File)
Sun, Jun 14, 4:50 PM
Unknown Object (File)
Sat, Jun 13, 10:58 AM
Unknown Object (File)
Thu, Jun 4, 9:14 PM
Subscribers

Details

Reviewers
manu
kib
markj
brooks
Group Reviewers
arm64
Summary

TODO: Needs checks to limit where it can be used, e.g. only
anonymous memory, & can't be shared between processes.

Sponsored by: Arm Ltd

Diff Detail

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

Event Timeline

This is not complete, but would be useful to get feedback on the approach

Only allow PROT_MTE with MAP_ANON

sys/vm/vm_mmap.c
283–287

Is this enough to stop creating shared mappings? I would like to not allow this until we understand how it will work with vMTE where tags are in the processes virtual address space.

jrtc27 added inline comments.
sys/vm/vm_mmap.c
283–287

Are you sure you want to invest time going down the vMTE road?..

sys/vm/vm_mmap.c
283–287

No yet, but don't want to create an ABI we can't easily support with vMTE.

sys/arm64/arm64/pmap.c
5447

Even though it turns into a memattr, I think you're going to want a VM_PROT_MTE that is equal to PROT_MTE.

sys/sys/mman.h
60–64

I think _PROT_ARCH isn't going to be all that generic when you combing it with CHERI. I think it's better to have per-feature defines that get ORed into _PROT_ALL or used to compose _PROT_ARCH.

sys/vm/vm_mmap.c
283–287

For vMTE I think you'd need to prevent minherit(INHERIT_SHARE) as well.

sys/arm64/arm64/pmap.c
5447

This block should assert that (m->oflags & VPO_UNMANAGED) == 0, otherwise it's unclear how the updates to the page's pv_flags are being synchronized. Even then, I'm not sure the object busy in vm_fault_soft_fast() is sufficient.

5450

What if we are entering a 2MB or 64KB page, i.e., psind > 0?

5450

What happens if an MTE page is mapped by other means, e.g., via pmap_enter_quick(), and tags aren't synced?