Page MenuHomeFreeBSD

Add the arm64 table attributes and use them
ClosedPublic

Authored by andrew on Sep 23 2021, 3:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 9, 4:53 PM
Unknown Object (File)
Thu, Mar 7, 7:42 PM
Unknown Object (File)
Feb 20 2024, 7:05 PM
Unknown Object (File)
Feb 11 2024, 12:57 AM
Unknown Object (File)
Feb 7 2024, 6:44 PM
Unknown Object (File)
Jan 19 2024, 2:11 AM
Unknown Object (File)
Jan 16 2024, 2:34 PM
Unknown Object (File)
Dec 20 2023, 1:28 AM
Subscribers

Details

Summary

Add the table page table attributes on arm64 and use them to add
restrictions to the block and page entries below them. This ensures
we are unable to increase the permissions in these last level entries
without also changing them in the upper levels.

Use the attributes to ensure the kernel can't execute from userspace
memory and vice versa, userspace has no access to read or write kernel
memory, and that the DMAP region is non-executable.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 41783
Build 38672: arc lint + arc unit

Event Timeline

sys/arm64/arm64/pmap.c
1886
1889

I would suggest adding a note to the effect that this is done for bootstrap L0 entries in locore. And maybe we should assert it in pmap_bootstrap().

Where are bits 59/60 described in the ARMARM?

sys/arm64/include/pte.h
41
In D32081#725184, @kib wrote:

Where are bits 59/60 described in the ARMARM?

The bits are defined as UXNTable and PXNTable in D5.3.3 Memory attribute fields in the VMSAv8-64 translation table format descriptors under the Next-level attributes in stage 1 VMSAv8-64 Table descriptors header (at least in G.b). This also points to Hierarchical control of instruction fetching in D5.4.6 Access permissions for instruction execution.

This revision is now accepted and ready to land.Sep 28 2021, 5:44 PM
alc added inline comments.
sys/arm64/arm64/pmap.c
1878

A stylistic suggestion: Use l0e instead of l0. A few lines later, in the same function, we use the same variable name, l0, as a pointer instead of a value. In general, I'd like to suggest that going forward new or revised code use names of the form l0p or l0e.

This revision was automatically updated to reflect the committed changes.