DOCUMENTATION / V1.0.0 LTS
OrbitOne v0.1.17 — a program that is not part of the kernel
What changed, in one sentence
Until v0.1.16 the kernel could run its programs. It can now run a program.
Why that is not the same thing
v0.1.16 gave the kernel a real ELF64 loader. It read headers,
honoured segment rights, refused W+X, confined images to the user
region. Every image it read, however, had been assembled together with
the kernel and lived in its .rodata. Nothing in that setup
could distinguish a loader from a lookup table with extra steps: the
bytes were always the same bytes, produced by the same build, and a
loader that silently ignored the header would have passed every
test.
The question v0.1.17 answers is the one that was left open: can the kernel execute software it has never seen?
The proof
scripts/gen_min_elf.py produces a 136-byte ELF64 image
outside the build. It does three things: put 7 in rdi, put
0 (SYS_EXIT) in rax,
int 0x80.
At the shell:
touch /tmp/mine.hex
append /tmp/mine.hex 7f454c4602010100000000000000000002003e00010000000000000080000000...
append /tmp/mine.hex ...
append /tmp/mine.hex ...
append /tmp/mine.hex 48c7c70700000048c7c000000000cd80
user image /tmp/mine.hex
user run /tmp/mine.hex
Measured:
append_ok path=/tmp/mine.hex added=32 bytes=272
user_image program=/tmp/mine.hex bytes=136 entry=0x8000000000 segments=1 pages=1
user_spawn program=/tmp/mine.hex id=3
[syscall] exit code=7
Exit code 7 is produced by no built-in image (hello
exits 0, data exits 42, own exits with its
pid). The result therefore cannot come from a fallback to an internal
copy. And deleting the file is enough to make the program vanish:
rm /tmp/h.hex
user run /tmp/h.hex
user_spawn program=/tmp/h.hex error=file not found
hello is still in the kernel binary at that point. The
path is what is run.
Counter-proof
Changing the exit-code byte in scripts/gen_min_elf.py
from 0x07 to 0x63 makes assertion group 15 of
scripts/test_ring3.sh fail, and only that group. The
assertion observes the bytes that were typed, not the fact that
something ran. Restored afterwards.
Why hexadecimal
The /tmp store holds String, that is UTF-8.
An ELF image is arbitrary bytes. Two options existed:
- Make the store carry raw bytes. That touches quota accounting, the
snapshot format, NVRAM persistence and
cat. None of it belongs to this milestone. - Transcribe to text.
Option 2 was taken. It costs two characters per byte, and the
limitation stays visible rather than hidden: the file can be
cat-ed, and typed by hand.
src/hex.rs is a pure module with 22 host tests. It
ignores ASCII whitespace on input — not out of politeness, but because a
shell line is capped at line_editor::CMD_BUF_SIZE (128
bytes), so an image has to be written across several lines. Everything
else is refused, including a 0x prefix and
:/-/ , separators, as is an odd
number of digits.
Why append had to
exist
A 136-byte image is 272 hexadecimal characters. write
replaces a file's content, and one shell line carries about 111 usable
characters. Without an append operation, no file written from the
console could ever hold a program. append reserves quota
before copying, so a refused append leaves the file exactly as it
was.
Refusals stay at their own level
A failure says where the chain stopped:
write /tmp/bad.hex zz
user run /tmp/bad.hex
user_spawn program=/tmp/bad.hex error=hex: caractere non hexadecimal
write /tmp/court.hex 7f454c46
user run /tmp/court.hex
user_spawn program=/tmp/court.hex error=elf: image plus courte qu'un en-tete
If both said the same thing, one could not tell transcription from parsing.
What was deliberately not duplicated
user::load_bytes is the single loading path;
user::load(Program) is a wrapper around it. A file
undergoes exactly the same validation as a built-in image because it
is the same code — not because two code paths were kept in
step. A file's size is bounded by user::MAX_IMAGE_BYTES
before any allocation: the kernel decides how much heap a
/tmp file may cost it.
Measurements
scripts/test_ring3.sh: 19 assertion groups, all passing (was 17).scripts/test_regression_full.sh: 15 structural checks (was 14).- Host tests: 250 (was 223). Floor raised in
scripts/test_host_coverage.sh. - Clippy: 0 warnings.
What this release does not do
- A program still has to be transcribed to hexadecimal;
/tmpcarries text. - The image is read entirely into the heap before being examined. No streaming, no demand paging.
- Nothing consumes relocations or dynamic linking, so a binary from an external toolchain will not load as-is.
- There is still no user heap, and no way for a program to open a file.