Skip to content

Add support for XN vm attributes#86

Open
nspin wants to merge 1 commit into
seL4:masterfrom
nspin:pr/xn-vm-attr
Open

Add support for XN vm attributes#86
nspin wants to merge 1 commit into
seL4:masterfrom
nspin:pr/xn-vm-attr

Conversation

@nspin

@nspin nspin commented Mar 24, 2026

Copy link
Copy Markdown
Member

This includes removing the use of the grant permission to encode executable permissions for frames. The kernel does not use the grant permission to determine whether a frame is executable, so this encoding was not doing anything.

Motivated by seL4/rust-sel4#280 (comment)

@lsf37

lsf37 commented Mar 25, 2026

Copy link
Copy Markdown
Member

The kernel does not use the grant permission to determine whether a frame is executable, so this encoding was not doing anything.

Hm, I need to look into what the capDL formalisation does with this. It's possible that the Haskell version here was an early attempt to model NX that never got carried through to the rest of the model and implementation.

@kent-mcleod

Copy link
Copy Markdown
Member

How would this impact the C capdl loader app? It does respect the lack of grant right to set execute never on the ARM page mappings here I think: https://github.com/seL4/capdl/blob/master/capdl-loader-app/src/main.c#L1496-L1500

@nspin

nspin commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

How would this impact the C capdl loader app? It does respect the lack of grant right to set execute never on the ARM page mappings here I think: https://github.com/seL4/capdl/blob/master/capdl-loader-app/src/main.c#L1496-L1500

Good catch. The way forward with this PR as it is would be to remove the line you linked and instead add logic to incorporate XN into the vm_attrs at

", .vm_attribs = " ++
(if cached then "seL4_ARCH_Default_VMAttributes" else "CDL_VM_CacheDisabled") ++
(and at
#define CDL_VM_CacheEnabled seL4_ARCH_Default_VMAttributes
#define CDL_VM_CacheDisabled seL4_ARCH_Uncached_VMAttributes
#if defined(CONFIG_ARCH_ARM)
/* ARM does not support write through */
#define CDL_VM_WriteThrough CDL_VM_CacheDisabled
/* Note that this is the number of bits translated by the PT
* not the size of the actual PT object */
#elif defined(CONFIG_ARCH_X86)
#define CDL_VM_WriteThrough seL4_X86_WriteThrough
#endif
).

This includes removing the use of the grant permission to encode
executable permissions for frames. The kernel does not use the grant
permission to determine whether a frame is executable, so this encoding
was not doing anything.

Signed-off-by: Nick Spinale <nick@nickspinale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants