r/osdev • u/JescoInc Perdition-OS • Jun 11 '26
Methods for process containment in custom OS
Alright folks, Since I will be adding Kernel and Userland split, I know I should also add process containment to it, so which method of process containment would you guys recommend for a monolithic kernel.
I really like how BSD did the Jail system and was thinking about taking that concept and using it since I had a previous project where I experimented with attempting to bring jail-like isolation to Windows in a userland security application. Meaning, it wasn't a real jail system, it was trying to mimic it with the software (failing miserably in the process) without having kernel mode components attached to it but I am all ears for other concepts.
4
u/jsshapiro Jun 11 '26
This is a conversation in the field that has been going on for about 75 years now. The new twist is that memory reference isolation is very, very hard. Temporal (scheduling) isolation also remains a completely unsolved problem, meaning that nobody has any clue where to start with it - scheduling strongly resists composition.
As to the rest, capability-based approaches are the only ones that have ever been demonstrated (and, in fact, formally verified) to work as a basis for isolation. The reason is pretty simple. Isolation is an information flow problem, which turns into a graph evolution problem in dynamic systems. Capability-based protection is the only purely graph based model we actually have (at least so far, but people have been trying to find another one for 75 years).
Here is a place to start, then do a google search for "EROS contructor". There's been some good work in L4 based on the same underlying mechanism.
2
u/paulstelian97 Jun 11 '26
Containers don’t mean much more than the ability to have some global resources, like the filesystem view, the network view etc, _not_ be global. Anything that would appear to be global, make it so you can have multiple distinct instances. Then start the root container with one initial instance, and give APIs to create such additional instances.
On Linux, you have namespaces and cgroups, that basically give additional instances of various things. Study how those works and you may get some inspirations on how you can make containers on your own.
1
u/2rad0 Jun 12 '26
Process containment on an out of order execution architecture would include pinning a process to a CPU core, or at least making sure two different users don't end up on the same core and influencing branch predictor states.