Skip to content

MapPerms: Consistency between map and iomap - #577

Open
cazb2 wants to merge 1 commit into
seL4:mainfrom
au-ts:callumb/improve_permission_repr
Open

MapPerms: Consistency between map and iomap#577
cazb2 wants to merge 1 commit into
seL4:mainfrom
au-ts:callumb/improve_permission_repr

Conversation

@cazb2

@cazb2 cazb2 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This commit unifies the way VM rights are encoded in the sdf. Previously normal map perms were represented as a raw u8 enum while the iomap perms were represented as a proper type.

This uses a base enum for the vm rights and then uses a context specific struct around the base rights depending on if the perms are for a iomap or map entry.

This preserves existing correct behaviour, (I believe seL4 would reject the WriteExecute case where the tool would previously accept this for normal frames leading to a runtime error.)

@cazb2

cazb2 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@midnightveil

Copy link
Copy Markdown
Collaborator

Apologies, you will need to rebase affter: #581

@cazb2
cazb2 force-pushed the callumb/improve_permission_repr branch 2 times, most recently from 21b79bc to 7787f27 Compare July 27, 2026 23:19
Comment thread tool/microkit/src/sdf/memory_region.rs Outdated
Comment on lines 142 to 152
fn read(&self) -> bool {
self.perms & SysMapPerms::Read as u8 != 0
self.perms.read()
}

fn write(&self) -> bool {
self.perms & SysMapPerms::Write as u8 != 0
self.perms.write()
}

fn execute(&self) -> bool {
self.perms & SysMapPerms::Execute as u8 != 0
self.perms.execute()
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead: map.perms().read? Since type of perms is the same in both cases? Then don't need these extra methods? Or does that get ugly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I made it work lmk if you're happy with the design, it scales better while still allowing the map and the iomap to define their own types around the common FrameRights.

Comment thread tool/microkit/src/sdf/memory_region.rs Outdated
};
Ok(SysIOMapPerms(frame_rights))
}
pub fn read(self) -> bool {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing between functions

@dreamliner787-9 dreamliner787-9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from me apart from Julia's comments

@dreamliner787-9

Copy link
Copy Markdown
Collaborator

https://github.com/seL4/seL4/blob/5126e718bb68636267e28234c711ac8022b79fe2/src/arch/x86/kernel/vspace.c#L673-L692

seL4 reference for write only run time error.

Actually can you add this reference into https://github.com/seL4/microkit/pull/577/changes#diff-5fc8f1c29b8f90ae6c6d27410e489ac4d389486ec4c31f3323604cbab3f1cf1fR334

This commit unifies the way VM rights are encoded in the sdf.
Previously normal map perms were represented as a raw u8 while the iomap
perms were represented as a proper type.

Preserves existing correct behaviour. The tool will now error if a
write execute mapping was created, which seL4 treats as a runtime
error.

Signed-off-by: Callum <c.berry@student.unsw.edu.au>
@cazb2
cazb2 force-pushed the callumb/improve_permission_repr branch from 7787f27 to 047342f Compare August 17, 2026 11:25
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