Skip to content

tool: fix broken PD hierarchy - #605

Merged
dreamliner787-9 merged 2 commits into
seL4:mainfrom
au-ts:hierarchy_fix
Sep 18, 2026
Merged

dreamliner787-9 merged 2 commits into
seL4:mainfrom
au-ts:hierarchy_fix

Conversation

@dreamliner787-9

Copy link
Copy Markdown
Collaborator

Prior to commit c67227f, PDs are fed into step 3 of build_capdl_spec()
as a flat vector in topological order. That is, a parent ID always
appears before its children PDs. However, commit c67227f changed the Vec
into a BTreeMap, so the ordering is now dictated by the Rust data
structure implementation.

Thus it is possible that a child will now be created before its parent.
Causing the code to crash when it tries to find the parent's fault
endpoint.

This is fixed by moving the fault endpoint binding step into a separate
"post processing" step that happens after all the PDs are created.

Closes #604

} else {
unreachable!("internal bug: build_capdl_spec() got a non TCB object ID when trying to bind the fault Endpoint.");
}
}

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.

Where did this come from? It wasn't in the previous code?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Previously in step 3-5 we just put the CTE inside caps_to_bind_to_tcb and then everything happen for us in step 3-13. But now this step is in a different scope we need to re-fetch the TCB and insert the fault EP CTE

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.

Right. That's somewhat ugly :/.

But alas...

Prior to commit c67227f, PDs are fed into step 3 of build_capdl_spec()
as a flat vector in topological order. That is, a parent ID always
appears before its children PDs. However, commit c67227f changed the Vec
into a BTreeMap, so the ordering is now dictated by the Rust data
structure implementation.

Thus it is possible that a child will now be created before its parent.
Causing the code to crash when it tries to find the parent's fault
endpoint.

This is fixed by moving the fault endpoint binding step into a separate
"post processing" step that happens after all the PDs are created.

Signed-off-by: Bill Nguyen <bill.nguyen@unsw.edu.au>
For future reference

Signed-off-by: Bill Nguyen <bill.nguyen@unsw.edu.au>

@midnightveil midnightveil 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.

Approving as a hotfix for the issue. I think I'd like to restructure this a bit more sensibly but for now let's just fix the issue.

@dreamliner787-9
dreamliner787-9 merged commit 547ab46 into seL4:main Sep 18, 2026
12 checks passed
@dreamliner787-9
dreamliner787-9 deleted the hierarchy_fix branch September 18, 2026 00:39
dreamliner787-9 added a commit that referenced this pull request Oct 5, 2026
Now that seL4/rust-sel4#374 had been merged and
the rust-seL4 commit updated in #616.

Signed-off-by: Bill Nguyen <bill.nguyen@unsw.edu.au>
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.

Hierarchy Example (and probably hierarchies themselves) are broken

2 participants