Skip to content

Support badged SMC caps to restrict SMC function IDs - #589

Open
midnightveil wants to merge 5 commits into
seL4:mainfrom
au-ts:julia/badged-smc
Open

Support badged SMC caps to restrict SMC function IDs#589
midnightveil wants to merge 5 commits into
seL4:mainfrom
au-ts:julia/badged-smc

Conversation

@midnightveil

@midnightveil midnightveil commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Note: this contains a breaking change by removing the SMC attribute.
This should be fine, as the 3.0.0 release is planned to be breaking anyway.
This change could be reverted; it is left as a separate commit to make that easy.

The other design choice here was that we do not permit "function_id=0", or some other way to make badge = 0 <=> unbadged smc cap which has no allowlisting, instead allowing everything. This is always (in my opinion) a bad design.

<system>
    <protection_domain name="arm_smc" priority="1">
        <program_image path="arm_smc.elf" />

        <cspace>
            <!-- An (ARM) SMC capability that permits SMC calls to 0x84000000 (PSCI_VERSION) -->
            <cap_smc slot="1" function_id="0x84000000" />
        </cspace>
    </protection_domain>
</system>

Review commit-by-commit.

@midnightveil midnightveil linked an issue Aug 10, 2026 that may be closed by this pull request
@midnightveil
midnightveil force-pushed the julia/badged-smc branch 2 times, most recently from 4fb3591 to c7191ec Compare August 11, 2026 00:44
@midnightveil
midnightveil marked this pull request as ready for review August 11, 2026 02:53
This is useful as we are going to add SMC caps and they
don't reference PD name/ID, so we need to distinguish them.

Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
Needed for new SMC badge changes.

Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
Useful for debugging.

Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
The "smc=true" attribute on a PD would provide an unbadged
SMC capability that allows a component to invoke any function
exposed by the ARM Secure Monitor. Use our extra capabilities
/ cap mappings feature to support this.

This leaves the "smc=true" still enabled and useable.

Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
Use instead <cap_sc> feature instead for allow-listed
function IDs.

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

Indanz commented Aug 12, 2026

Copy link
Copy Markdown

The current way of doing SMC is by setting an attribute smc=true on the PD description and calling microkit_arm_smc_call().

The proposed way is using the recently added cap export mechanism and letting users call seL4_ARM_SMC_Call() directly on that cap.

I agree that this is a better API, as it is more generic and avoids the Microkit wrapper function.

However, the cap_smc part makes it SMC specific again. That's probably in line with the other exported caps, but I would have made it more generic and support all boot caps and have a generic badge thing instead of function_id, which requires SMC specific code again. I think I made the same comment on other caps exported via cspace.

I would not disallow function_id="0" for unbadged SMC caps, that is user policy. It can be handy for testing and if a process needs to do multiple SMC calls and one of them is destructive, then it doesn't add much to badge the caps.

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.

Add ARM SMC forwarding granularity

2 participants