DOCUMENTATION / V1.0.0 LTS
OrbitOne v0.1.15 — One Address Space Per Process
What changed, and why it mattered
v0.1.14 got code running in ring 3. That was necessary but not sufficient: all user tasks shared the kernel's single set of page tables. A "user program" was therefore a program that could exist only one at a time, because a second one would have been mapped over the first — same code page, same stack page, same addresses, same physical frames. The kernel enforced that restriction explicitly and refused to spawn a second user task.
v0.1.15 removes the restriction by removing its cause. Each task now
owns a set of page tables and the CPU's CR3 register is
reloaded on every switch. Two tasks running the same program at the same
virtual address no longer see each other.
This is the change that makes the word "process" mean something here.
The measurement that proves it
user run own2 starts two instances of a program
that:
- asks the kernel for its own pid (
getpid), - pushes it onto its stack,
- spins long enough to be preempted several times,
- pops the value back and exits with it.
Observed:
[user] bascule en anneau 3 id=5 entry=0x8000000000 stack=0x8000002000 cr3=0xa47000
[user] bascule en anneau 3 id=6 entry=0x8000000000 stack=0x8000002000 cr3=0xa53000
[syscall] exit code=5
[syscall] exit code=6
Identical virtual addresses, different CR3, different
exit codes. Had the two stacks been the same physical page, the second
task would have overwritten the first's value and both would have exited
with the same code.
Where the isolation actually lives
A new address space copies all 512 entries of the kernel's top-level table except one. Sharing entries rather than duplicating tables is deliberate: it means an interrupt taken in ring 3 lands on kernel code that is mapped in every space, and later kernel mappings are visible everywhere without a fixup pass.
The user region moved from 0x4000_0000 to
0x80_0000_0000. The old address sat in top-level entry 0,
which also covers the kernel image and the low heap — an entry every
space must share, and which would therefore have carried the user pages
along with it. Entry 1 was measured to be unused (QEMU's
info mem shows the kernel occupying entries 0, 2 and 3).
Isolation comes from the kernel never mapping anything into that
entry.
W^X is now structural
The user code page used to be mapped writable, filled, then made read-only. There was an instant — brief, but real — where a page was simultaneously writable and executable. The program is now written through the kernel's physical-memory window, so the user mapping is created read-only and executable and never changes. There is no longer a moment to get the ordering wrong in.
Counter-proofs run
- Removing the
CR3reload from the context switch: no user program starts at all. The mechanism is load-bearing. - Copying all top-level entries, user entry included: nothing breaks. Recorded as a negative result. The kernel puts nothing in that entry, so the copy is zero anyway; the explicit clearing is a guard against a future regression, not the isolation mechanism itself. Claiming otherwise would have been wrong.
Test surface
scripts/test_ring3.sh went from 9 to 13 assertion
groups. scripts/test_regression_full.sh gained a 13th
structural check. Host unit tests remain at 186, clippy at zero
warnings.
What this release still does not do
- No ELF loader: user programs are assembly blobs assembled into
.rodata. - One 4 KiB code page and one 4 KiB stack page per process. No user heap.
- No
fork, noexec. - Three syscalls:
exit,write,getpid. syscall/sysretare not implemented;int 0x80is the only gate. The GDT descriptor order is already the oneSTARrequires, so this is an addition, not a rewrite.- No demand paging, no swapping, no copy-on-write.