Skip to content

Enable mapping extra TCB and SC caps into PD's#406

Open
Kswin01 wants to merge 15 commits into
seL4:mainfrom
au-ts:cap_sharing
Open

Enable mapping extra TCB and SC caps into PD's#406
Kswin01 wants to merge 15 commits into
seL4:mainfrom
au-ts:cap_sharing

Conversation

@Kswin01
Copy link
Copy Markdown
Contributor

@Kswin01 Kswin01 commented Jan 5, 2026

This PR adds functionality to map arbitrary TCB and SC caps of other PD's into another PD. This can allow a user to share a SC cap of one PD to another without having to explicitly make the destination PD the parent (and therefore have to also handle faults of the child).

Adding a cap to a PD requires adding a <cap/> node to a PD:

    <protection_domain name="parent" priority="55">
        <program_image path="parent.elf" />
        <cap type="tcb" pd="child" dest_cspace_slot="5" />
        <cap type="sc" pd="parent" dest_cspace_slot="6" />
    </protection_domain>

You must specify the type of cap (currently only implemented for TCBs and SCs but can be extended in the future). Additionally, the name of the pd that is the source of that cap. The destination cspace slot is an index into the BASE_USER_CAPS region of the cspace.

This PR is also reflected in: https://github.com/au-ts/microkit_sdf_gen/tree/cap_sharing

@Kswin01 Kswin01 force-pushed the cap_sharing branch 4 times, most recently from 8191952 to 6ec5219 Compare January 5, 2026 04:54
@Kswin01 Kswin01 force-pushed the cap_sharing branch 9 times, most recently from 34d549f to e2661e0 Compare January 21, 2026 04:40
Comment thread tool/microkit/src/capdl/builder.rs Outdated
Comment thread tool/microkit/src/capdl/builder.rs Outdated
Comment thread tool/microkit/src/sdf.rs Outdated
Comment thread tool/microkit/src/sdf.rs Outdated
Comment thread tool/microkit/src/sdf.rs Outdated
Comment thread tool/microkit/src/sdf.rs Outdated
Comment thread tool/microkit/src/sdf.rs
@Kswin01 Kswin01 force-pushed the cap_sharing branch 3 times, most recently from 3938f82 to 36eed41 Compare January 27, 2026 01:17
Copy link
Copy Markdown

@Indanz Indanz left a comment

Choose a reason for hiding this comment

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

As you can see from the comments, I don't know Rust, so take everything I say with a big grain of salt. But I'm pretty sure it doesn't need to be quite this ugly.

Comment thread tool/microkit/src/capdl/builder.rs Outdated
Comment thread tool/microkit/src/capdl/builder.rs Outdated
Comment thread tool/microkit/src/capdl/builder.rs
Comment thread tool/microkit/src/capdl/builder.rs Outdated
Comment thread tool/microkit/src/capdl/builder.rs Outdated
Comment thread tool/microkit/src/capdl/builder.rs Outdated
Comment thread tool/microkit/src/sdf.rs
@Kswin01 Kswin01 force-pushed the cap_sharing branch 3 times, most recently from 49c8382 to c870e06 Compare January 28, 2026 03:36
Kswin01 added 9 commits March 30, 2026 15:25
Signed-off-by: Krishnan Winter <krishnan.winter@unsw.edu.au>
Signed-off-by: Krishnan Winter <krishnan.winter@unsw.edu.au>
Signed-off-by: Krishnan Winter <krishnan.winter@unsw.edu.au>
Signed-off-by: Krishnan Winter <krishnan.winter@unsw.edu.au>
Signed-off-by: Krishnan Winter <krishnan.winter@unsw.edu.au>
Signed-off-by: Krishnan Winter <krishnan.winter@unsw.edu.au>
Signed-off-by: Krishnan Winter <krishnan.winter@unsw.edu.au>
Signed-off-by: Krishnan Winter <krishnan.winter@unsw.edu.au>
Signed-off-by: Krishnan Winter <krishnan.winter@unsw.edu.au>
Signed-off-by: Krishnan Winter <krishnan.winter@unsw.edu.au>
Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
The only reason why we're keeping the parent PD hierarchy is
for backwards compatability, if users want this they should
use the new cap sharing API.

Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
…better

Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
@midnightveil midnightveil self-assigned this Jun 5, 2026
@midnightveil
Copy link
Copy Markdown
Collaborator

midnightveil commented Jun 5, 2026

Remaining work on this to get this merged:

  • Test example
  • Documentation
  • Make the "user caps" its own cnode that is dynamically sized, there's no reason to limit this (see also: the untypeds PR).
  • Bikeshed the appearance (thought: instead of <cap>, doing a <extra_caps> element with child (<endpoint>) or (<sc>); this would allow more fine grain attribute on the different cap types, instead of smooshing everything onto one <cap> element. (edit: <cnode element?)

Desired additions in later PRs.

  • remove PD hierarchy. To do this we want to add a feature to automatically migrate one .system file to another; there should be no need for this to be manual user.
  • Make it a fully functional replacement for the PD hierarchy. i.e. allow the fault endpoints to be set up arbitrarily. (it might make sense for this not to be the <extra_caps>, IDK

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.

4 participants