SafeOS Benchmark Test Cases

This page shows a technical manager, in about twenty minutes, that each of the six points of the manifesto was implemented in SafeOS. Each test has a few steps to type and a text copy of what the screen looks like. The copies come from real runs of SafeOS. Numbers such as ticks, process ids and hashes differ a little from run to run, and you may see a few stray letters in the boot messages, which you can ignore. Nothing has to be built or installed, and the machine is already prepared at: https://aws.safeos.ai/

Before you start

The six tests

Test

Manifesto point

What you will see

1

4.5 Immutable OS updates, dual slot (built in part)

You set up the machine and choose SafeOS from two kernels, and its own files cannot be changed

2

4.2 Dedicated CPU core for the global scheduler

ps shows one core that only schedules

3

4.3 True physical memory separation

ps shows three separate memory pools

4

4.1 Owner-mode (CPU Ring 1)

You log in to the owner's session at Ring 1, read the owner's rules, and watch the system enforce them

5

4.6 Self-contained application installation

The same command fails before an application is installed and works after

6

4.4 Context switching as a hardware trap

Two tests show that no task finds anything another task left behind

Test 1. Immutable OS updates, dual slot (4.5), built in part

The point. The owner, and not the vendor, decides which system runs, and the running system's own files cannot be changed.

Do.

  1. Start the machine and watch the screen. The first thing you see is the owner's boot menu. If it asks you to set a passphrase, press any key within 15 seconds.
  2. Type a passphrase of your choice, from 1 to 64 characters, and press Enter. Type it again to confirm. Write it down, because Test 4 needs it.
  3. When asked Default kernel: 1) xv6 2) SafeOS, type 2 and press Enter. These are the two slots: stock xv6 and SafeOS.
  4. Wait for the prompt SafeOS$. Type rm /bin/zombie and press Enter.

Screen. The last line shows the expected wording.

=== SafeOS Owner-Mode ===
First boot: the Owner block was created.
Chosen kernel: SafeOS
No Owner passphrase is set. Press any key within 15 seconds to set one.
New Owner passphrase (1 to 64 characters): ******
Again: ******
Default kernel: 1) xv6   2) SafeOS   (Enter keeps SafeOS): 2
Owner passphrase saved.
...
init: starting sh
SafeOS$ rm /bin/zombie
rm: /bin/zombie failed to delete

What it shows. Two kernels sit on the disk, and the owner chooses which one starts. The system's own programs cannot be deleted or changed while it runs.

What it does not show. Writing an update into an inactive slot while the system runs is not built yet, which is why this point is marked built in part.

If the screen says Press any key within 10 seconds for the Owner menu instead, a passphrase was already set. Ask for it, and skip steps 1 to 3.

Test 2. Dedicated CPU core for the global scheduler (4.2)

The point. One processor core holds the global view and does the scheduling, instead of every core scheduling for itself.

Do. Type ps and press Enter. This test needs a machine with two or more processor cores.

Screen. The top of the output:

SafeOS report: tick 58209, 2 cpu(s)

CPUS
CPU  ROLE           NOW
0    scheduler      -
1    worker         pid 37 ps

What it shows. Core 0 is the scheduler and is running no program, which is what the dash means. The other cores do the work: here ps itself runs on core 1. On a machine with a single core the role reads sched+worker, and this test cannot be shown.

Test 3. True physical memory separation (4.3)

The point. The memory of the kernel, the owner and the user programs is kept in separate pools.

Do. Type ps again, and look at the bottom of the output.

Screen.

MEMORY POOLS (4 KB pages)
POOL      FREE      USED      TOTAL
kernel    7534      319       7853
user      40947     13        40960
owner     8191      1         8192
(pool figures include this ps process itself)

The same three pools are printed in the first lines of the boot messages, each with its own physical address range:

pool kernel: 7795 pages, physical 0-2000000
pool user: 40960 pages, physical 4000000-e000000
pool owner: 8192 pages, physical 2000000-4000000

What it shows. There are three pools of different sizes, each with its own pages and its own address range. User programs take their memory only from the user pool, and the owner's pool is mapped only into the owner's session.

Test 4. Owner-mode, CPU Ring 1 (4.1)

The point. A control mode above ordinary programs belongs to the owner, and the system carries out the owner's limits by itself.

Do.

  1. Press the key chord. Type the passphrase from Test 1 and press Enter.
  2. Read the first lines: the self-test result and the banner.
  3. Type rules and press Enter. Then type exit, press Enter, and press Enter again to return to SafeOS$.
  4. Type hello and press Enter. Do this three times.
  5. Type deadloop and press Enter, and wait. It prints numbered lines and then stops by itself.

Screen. Look for three things: the banner === Owner (Ring 1) ===, the line dispatcher checks: all pass, and the rule for hello with a limit of 3.

[Owner at Ring 1] dispatcher checks: all pass

=== Owner (Ring 1) ===
Owner passphrase: ******
Logged in. Type help.
owner> rules
PROGRAM         RESOURCE  LIMIT   SCOPE    ACTION            KILL#  SHARED
hello           stdout    3       program  kill+deny         1      0 used, 0 violation(s)
deadloop        cputime   50      process  kill              1      -
helloagain      stdout    1       process  report            -      -
deadloopagain   cputime   500     program  kill              1      0 used, 0 violation(s)

KIND            RESOURCE  LIMIT   SCOPE    ACTION
App             cpu       20%     group    report
App             memory    10%     group    kill
App             cputime   10000   group    kill
App             stdout    10000   group    kill
Agent           cpu       20%     group    report
Agent           memory    10%     group    kill
Agent           cputime   10000   group    kill
Agent           stdout    10000   group    kill

Then the three runs of hello. The third is refused:

SafeOS$ hello
hello (running on cpu1)
world
SafeOS$ hello
hello (running on cpu1)
Exception: Run out of Resources
SafeOS$ hello
Exception: Run out of Resources
exec hello failed

Then deadloop, which would loop for ever. It stops after about 235 lines, and the number varies:

SafeOS$ deadloop
i=0(running on cpu1)
i=1(running on cpu1)
i=2(running on cpu1)
...
i=234(running on cpu1)
Exception: Run out of Time

What it shows. Ring 1 is the processor's privilege level between the kernel and ordinary programs, and here it is reserved for the owner. The line dispatcher checks: all pass is the system testing its own gate to the owner's mode with 37 checks. The owner's rule says hello may write 3 lines in all, and nobody is at the keyboard when the third run is refused. deadloop is a program that never ends by itself, and the owner's rule gives it 50 ticks of processor time, so the system stops it. In both cases the system applies the owner's rule by itself.

Test 5. Self-contained application installation (4.6)

The point. An application is one bundle in one directory, approved by the owner, and nothing can alter it while it runs.

Do.

  1. At SafeOS$, type testapp. The application is not installed yet.
  2. Press the key chord and log in. Type install testapp and press Enter. The screen lists the application's manifest: its name, its purpose and the limits it asks for. Type y and press Enter.
  3. Type exit, press Enter, and press Enter again.
  4. Type testapp again: it now runs. Then type testapp report progress-ok. Press the key chord, log in, type reports, and leave with exit, Enter, Enter. The owner sees what the application reported.
  5. Type testapp burn 1000 & and watch the screen. A warning appears, and when the application has used 500 ticks of processor time, the system stops it and says so.
  6. Press the key chord, log in, type rules, and read the last two lines.
  7. Type exit, press Enter, and press Enter again. Then type testapp mem and watch the screen: the application takes memory until the system stops it.

Screen, before installing.

SafeOS$ testapp
exec: fail
exec testapp failed

Screen, the installation.

owner> install testapp
manifest.txt (230 bytes):
   1 | name: testapp
   2 | kind: app
   3 | goal: A small program to test installation
   4 | deps: ls, cat
   5 | requires: cputime 500
   6 | requires: stdout 200
   7 | report: every 60 ticks
   8 | commands: testapp 8945c9ad476dd2a4...
manifest sha-256: fe3be58ae3f94ba6...
Install testapp (y/n): y
approved. testapp is copied to /apps/testapp/ and recorded when you leave this session.
owner> exit
=== Owner session ended (press Enter for a shell prompt) ===
[Owner] testapp installed in /apps/testapp/. Type testapp to run it; the registry lists it too

Screen, after installing.

SafeOS$ testapp
testapp: I am an installed app

Screen, the report. The owner reads what the application reported:

SafeOS$ testapp report progress-ok
testapp: write_report returned 0
SafeOS$
=== Owner (Ring 1) ===
Owner passphrase: ******
Logged in. Type help.
owner> reports
APP             REPORTS  LATEST REPORT
testapp         1        tick 15003 pid 37: progress-ok

Screen, the warning and the kill. The shell shows both as they happen. The application is stopped when all its processes together pass 500 ticks of processor time, which is the limit in its manifest:

SafeOS$ testapp burn 1000 &
SafeOS$ [Owner policy] testapp (App): CPU 20.9%, limit 20%: reported

SafeOS$ [Owner policy] testapp (App): cputime 501, limit 500: group killed

Screen, what the owner sees afterwards. The record stays in the rules table, so an owner who was not watching still learns what happened. The last row says the application used 501 ticks and was stopped once:

owner> rules
PROGRAM         RESOURCE  LIMIT   SCOPE    ACTION            KILL#  SHARED
hello           stdout    3       program  kill+deny         1      0 used, 0 violation(s)
deadloop        cputime   50      process  kill              1      -
helloagain      stdout    1       process  report            -      -
deadloopagain   cputime   500     program  kill              1      0 used, 0 violation(s)
testapp         stdout    200     group    kill+deny         1      0 used, 0 violation(s)
testapp         cputime   500     group    kill              1      501 used, 1 violation(s)

Screen, the memory kill. The application takes memory until it passes the owner's limit of 10% of the machine's memory, and the system stops it:

SafeOS$ testapp mem
testapp: holding 8000 pages (32000 KB)
[Owner policy] testapp (App): memory 10.5%, limit 10%: group killed

What it shows. The same command fails before the installation and works after it. The owner read and approved the manifest first. The application lives in its own directory, and its report is there for the owner to read after logging in. A program that uses too much processor time is warned about and then stopped when all its processes together pass the limit in its own manifest, with nobody present, and the owner finds the record afterwards in the rules table. A program that takes too much memory is stopped in the same way.

Test 6. Context switching as a hardware trap (4.4)

The point. When the system switches from one task to another, nothing the first task left in the processor's registers can be seen by the second.

Do. Type safeostests regtest and press Enter, and wait for the prompt. Then type safeostests fpuleak and press Enter.

Screen. The line regtest: PASS appears twice, and that is normal. The last line of the second screen shows the expected wording.

SafeOS$ safeostests regtest
== regtest ==
regtest: general registers changed 0 times, x87 stack 0 times (40 rounds, 3 processes)
regtest: PASS
regtest: PASS
safeostests: 1 of 1 passed

SafeOS$ safeostests fpuleak
== fpuleak ==
fpuleak: no leak, the child saw an empty x87 stack
fpuleak: PASS
safeostests: 1 of 1 passed

What it shows. In the first test, three tasks keep their own values in the processor's registers while the clock switches between them again and again, and none of them finds a value changed. In the second, a task fills the floating-point registers and a second task finds them empty.

Result sheet

Test

Point

Seen as described (yes or no)

Notes

1

4.5 Immutable OS updates

 

 

2

4.2 Scheduler core

 

 

3

4.3 Memory pools

 

 

4

4.1 Owner-mode

 

 

5

4.6 Installation

 

 

6

4.4 Context switching

 

 

Tester: ______________________  Date: ______________

 

// Written by Una Techie, Oct 19, 2026