flattened model for syscall parsing
@jaybosamiya-ms is already working on this.
Since Dec 8, 2025.
- Dominant language
- Rust
- Stars
- 2.7k
- Forks
- 144
- Avg merge
- 12h 21m
- Merged PRs (30d)
- 146
Description
I have been meaning to bring this up...
I think we should consider changing the way we parse syscalls a bit... right now, we have three layers of syscall handling: the parsing code here which constructs the enum, the dispatch code which matches on the enum, and then the individual
sys_*methods.In some cases, we spread the syscall parsing and handling across all three places--we check some parameters here in the parsing code and return various errnos, we check some more parameters in the dispatch code (or even copy user parameters to kernel memory), and then we do yet more validation in the syscall itself.
It seems to me that we should flatten all of this and do all the validation and arg parsing in the
sys_*methods. This is slightly less powerful, in that you can't reuse the parsing code with multiple syscall implementations. But I don't think that's a realistic goal, anyway, because the parsing logic is very specific to the individual implementation.In that world, the separate enum goes away, and the dispatch code is just a big table of syscall number to
sys_*fn--some Rust trickery can handle converting the parameter types. But getting there is a big effort, and we need to agree to it first.If this seems vaguely right to everyone, then I suggest that in the meantime, we stop adding complicated code to the parsing and dispatch layers. In this case, just have
socketcallparse intoSocketcall { call: i32, args: ConstPtr<usize> }, and have the dispatch layer callsys_socketcall(call: i32, args: ConstPtr<usize>) -> _. Then do this complicated parsing there.
Originally posted by @jstarks in https://github.com/microsoft/litebox/pull/535#discussion_r2586725163
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.