Hi sel4-devs,
As I had mentioned in the last developer call, I am porting seL4 to morello
architecture. To be exact, I plan to run a hybrid kernel with hybrid
userspace. The hybrid mode essentially means that you define CHERI
capability pointers explicitly, but if not stated, everything is just a
standard 64bit pointer.

Based on browsing the code, I have jotted down the following list of items
I need to change. 1,2 are just observations, and 3 is where I need some
input.

1. Change the type of "registers" field in TCB in the kernel to store 128
bits instead of 64 bits per reg. This ties into the kernel_enter and
restore_user_context code. It ensures that if a user app explicitly uses
CHERI capabilities, it is not lost on a context switch.[1,2]
- Done.

2. Change the syscall and IPC APIs to allow for passing CHERI caps.
CHERIcaps are just 128 bits, so we should be able to pass them as arguments
in IPC. The use case I have in mind is as follows - Imagine a mmap server.
This server would return a VA to the caller, which in the CHERI world would
be a CHERI capability. This mmap-server would allocate the memory and map
it into the callee's virtual address space. Do you think this is a valid
use case?

3. Update seL4_UserContext code to read and write newer regs from the user
space. The seL4_UserContext struct will need to be updated to accommodate
the new register DDC(default data capability reg). It will also need to be
updated to accommodate 128 bit regs instead of 64 bits. This is where I ran
into an issue - an assert statement in the build directory checks the size
of the seL4_UserContext structure. Looks like it gets its info from the
sel4arch.xml file[4]. I am not sure how to change XML processing to have it
generate the correct size value for that struct.

I have not created ifdef guard for morello yet, as this is just a hacky
pass to get it working. My diff so far is available at [3] if anyone wants
to take a look.
Any help and suggestions on the approach would be greatly appreciated.

Thanks,
Sid

[1]
https://gitlab.com/arm-research/security/icecap/seL4/-/blob/morello/include/arch/arm/arch/64/mode/machine/registerset.h#L169
[2]
https://gitlab.com/arm-research/security/icecap/seL4/-/blob/morello/include/arch/arm/arch/64/mode/machine/registerset.h#L270
[3]
https://gitlab.com/arm-research/security/icecap/seL4/-/compare/pre-morello-upstream-sel4...morello?from_project_id=22234764
[4]
https://gitlab.com/arm-research/security/icecap/seL4/-/blob/morello/libsel4/sel4_arch_include/aarch64/interfaces/sel4arch.xml#L11
_______________________________________________
Devel mailing list -- devel@sel4.systems
To unsubscribe send an email to devel-leave@sel4.systems

Reply via email to