Compare commits
89
Commits
v4.0.0-alpha.5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
058d78d1ea | ||
|
|
ab2141383c | ||
|
|
2783edbf89 | ||
|
|
4c7503f352 | ||
|
|
6ebe706351 | ||
|
|
a4f0beaac8 | ||
|
|
0825a4348f | ||
|
|
552d76595d | ||
|
|
3633e051a8 | ||
|
|
db0085d926 | ||
|
|
0234dc6baf | ||
|
|
78073f3112 | ||
|
|
9c7fa4f855 | ||
|
|
63e9966abc | ||
|
|
20918f9f09 | ||
|
|
9db364f7c7 | ||
|
|
5425d52cb1 | ||
|
|
6eecf0d2d7 | ||
|
|
65737e282f | ||
|
|
d5605eddb6 | ||
|
|
a9a8687fa5 | ||
|
|
43f8687f70 | ||
|
|
0522d77337 | ||
|
|
27ab2bce1e | ||
|
|
41befb0294 | ||
|
|
9039ce836d | ||
|
|
0a0be0cafd | ||
|
|
adcfadb7f7 | ||
|
|
1990a40f09 | ||
|
|
40e9773885 | ||
|
|
f7769c0e93 | ||
|
|
cf2a321807 | ||
|
|
0684cd8362 | ||
|
|
7cfcbf2b68 | ||
|
|
3945d3964a | ||
|
|
7422dc5319 | ||
|
|
33bd835474 | ||
|
|
998510757a | ||
|
|
bd8997ffdf | ||
|
|
dc3803ab47 | ||
|
|
84f119a1b3 | ||
|
|
d6b894769c | ||
|
|
cad8291478 | ||
|
|
57f556e645 | ||
|
|
9b114fff83 | ||
|
|
a1b26eacaf | ||
|
|
daf614285a | ||
|
|
4d64e677f5 | ||
|
|
29b99f90e6 | ||
|
|
6c639e5d20 | ||
|
|
3733949c28 | ||
|
|
a6371b1ce3 | ||
|
|
255dd92deb | ||
|
|
b5e85392c1 | ||
|
|
9c8b8dbd8b | ||
|
|
4ecdc80197 | ||
|
|
1961348e15 | ||
|
|
16b8fddaef | ||
|
|
f2174a39a4 | ||
|
|
fe0f709498 | ||
|
|
4a7ca4e288 | ||
|
|
c9cc39f4ec | ||
|
|
d052af6d53 | ||
|
|
c4b922d496 | ||
|
|
2b8609e4fc | ||
|
|
e43cd63936 | ||
|
|
b450c92858 | ||
|
|
cb1d6d6790 | ||
|
|
07f86d94c8 | ||
|
|
5d9737223b | ||
|
|
bc876f8088 | ||
|
|
3b229ba635 | ||
|
|
913b74a631 | ||
|
|
2957be86e5 | ||
|
|
d46ca3d174 | ||
|
|
1008b442cd | ||
|
|
0c2aab1ab5 | ||
|
|
f8be000b0a | ||
|
|
5e1dcc197b | ||
|
|
4f7521290a | ||
|
|
e6addc73b7 | ||
|
|
8dd1129ff0 | ||
|
|
d06a16f869 | ||
|
|
d93e985794 | ||
|
|
7af88cc704 | ||
|
|
666cf39b8b | ||
|
|
9e737b6252 | ||
|
|
04f917f005 | ||
|
|
b13d452e66 |
+4
-1
@@ -315,7 +315,10 @@ for its tree -- any change outside the evidence after the run is stale, and the
|
||||
again. **One stage per foreground command is also a protocol**, and is how an agent runs it (the
|
||||
QEMU rule: never in the background): `scripts/nightly.sh protocol accept-amd64`, then
|
||||
`accept-aarch64`, `accept-riscv64`, `accept-stick-high`, `test-32`, `proofs`, `images`, `docs`,
|
||||
each its own command, then `scripts/nightly.sh protocol-report`. The tools: `make
|
||||
each its own command, then `scripts/nightly.sh protocol-report`. **While a PR is open, commit locally and
|
||||
push once** (#152, 2026-11-08): Gitea redoes the PR's patch test and diff statistics on every push to its
|
||||
branch, and a burst of pushes with large log directories took it to 1.75 GiB. Its `app.ini` diff limits
|
||||
(`MAX_GIT_DIFF_LINES` 300, `MAX_GIT_DIFF_FILES` 30) stop a runaway diff; one push keeps it to one test. The tools: `make
|
||||
ARCH=amd64,aarch64,riscv64 init`, plus the HOL-Library heap the CI image has (`ci/runner-image`).
|
||||
|
||||
**v4 is the default build (Captain Bob, 2026-10-14: "v4 is the default build ... no, qemu to v4
|
||||
|
||||
@@ -175,3 +175,16 @@ So:
|
||||
sake.
|
||||
- It is touched only to keep the gates that still run it green: the docs stage's dictionary check
|
||||
(`v4/tools/mkdictionary.py`) and `make -C v4 test`. Ruled "Keep the boot.c change", for that reason.
|
||||
|
||||
## Capsules, keys and trust (Captain Bob, 2026-11-20)
|
||||
|
||||
- **Never a throwaway CA or key**, for a test or anything else: "No throwaway. I never would want that,
|
||||
it's a stupid idea." What needs a real signature is shown in CI, with the real key (#139, ruling 4).
|
||||
- **The root CA's private key is on the CI server**, `/var/lib/starshipos-ca/root/`, beside its
|
||||
certificate. Never mount or copy that directory anywhere. The root's public certificate is in the tree,
|
||||
`ci/pki/starshipos-root-ca.pem`.
|
||||
- **Capsules are becoming trains:** the v4 runtime engine (a `.f18a`) towing named blobs as rolling stock.
|
||||
Each blob is signed by its author and hashed, and the capsule's `MANIFEST.md` holds each blob's hash.
|
||||
Bona fide contributors get their own intermediate certificate under the StarshipOS root; casual users get
|
||||
a snakeoil one, told apart by the chain to the root. For ADR step 4
|
||||
(`docs/v4.0.0/plans/2026-11-20-capsule-trust.md`).
|
||||
|
||||
@@ -75,13 +75,17 @@ jobs:
|
||||
if: failure()
|
||||
run: scripts/nightly.sh diagnose # build only; the failed step stays the job's failure
|
||||
|
||||
# #184 (Captain Bob, 2026-11-20: "A warning only"): only what this run wrote is uploaded -- the logs and
|
||||
# CSVs newer than its start, and the stages' output (scripts/nightly.sh run-logs) -- not every log in
|
||||
# the tree. The upload is a copy for convenience, the evidence is committed: a failed upload is a
|
||||
# warning (continue-on-error), and cannot turn a passing run red.
|
||||
- name: This run's logs and DoE CSVs, gathered
|
||||
if: always()
|
||||
run: scripts/nightly.sh run-logs || true
|
||||
- name: Keep the logs and DoE CSVs
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: acceptance-logs-${{ github.run_number }}
|
||||
path: |
|
||||
logs/
|
||||
experiments/bare_metal/runs/
|
||||
build/nightly/accept-*.txt
|
||||
build/nightly/test-32.txt
|
||||
path: build/nightly/run-logs/
|
||||
|
||||
@@ -65,6 +65,9 @@ jobs:
|
||||
run: scripts/nightly.sh accept stick-high
|
||||
- name: Acceptance 32-bit build
|
||||
run: scripts/nightly.sh test-32
|
||||
- name: A signed kernel refuses an unsigned capsule (#139)
|
||||
if: always()
|
||||
run: scripts/nightly.sh capsule-trust
|
||||
|
||||
- name: Images
|
||||
run: scripts/nightly.sh images
|
||||
@@ -98,11 +101,17 @@ jobs:
|
||||
if: failure()
|
||||
run: scripts/nightly.sh diagnose # build only; the failed step stays the job's failure
|
||||
|
||||
# #184 (Captain Bob, 2026-11-20: "A warning only"): only what this run wrote is uploaded -- the logs and
|
||||
# CSVs newer than its start, and the stages' output (scripts/nightly.sh run-logs) -- not every log in
|
||||
# the tree. The upload is a copy for convenience, the evidence is committed: a failed upload is a
|
||||
# warning (continue-on-error), and cannot turn a passing run red.
|
||||
- name: This run's logs and DoE CSVs, gathered
|
||||
if: always()
|
||||
run: scripts/nightly.sh run-logs || true
|
||||
- name: Keep the logs and DoE CSVs
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: logs-${{ github.run_number }}
|
||||
path: |
|
||||
logs/
|
||||
experiments/bare_metal/runs/
|
||||
path: build/nightly/run-logs/
|
||||
|
||||
@@ -111,11 +111,17 @@ jobs:
|
||||
if: failure()
|
||||
run: scripts/nightly.sh diagnose # build only; the failed step stays the job's failure
|
||||
|
||||
# #184 (Captain Bob, 2026-11-20: "A warning only"): only what this run wrote is uploaded -- the logs and
|
||||
# CSVs newer than its start, and the stages' output (scripts/nightly.sh run-logs) -- not every log in
|
||||
# the tree. The upload is a copy for convenience, the evidence is committed: a failed upload is a
|
||||
# warning (continue-on-error), and cannot turn a passing run red.
|
||||
- name: This run's logs and DoE CSVs, gathered
|
||||
if: always()
|
||||
run: scripts/nightly.sh run-logs || true
|
||||
- name: Keep the logs and DoE CSVs
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: release-logs-${{ github.ref_name }}
|
||||
path: |
|
||||
logs/
|
||||
experiments/bare_metal/runs/
|
||||
path: build/nightly/run-logs/
|
||||
|
||||
@@ -20,6 +20,17 @@ config ENABLE_HOTWORDS_CACHE
|
||||
migration exists to collapse to one source of truth. Set to y
|
||||
to enable; also gates L8 Jacquard's L1_heat_tracking bit.
|
||||
|
||||
config WORD_PHYSICS
|
||||
bool "Compudynamics on a v4 node's words: the loops at call and at each tick (WORD_PHYSICS)"
|
||||
default y
|
||||
help
|
||||
#189 Phase 7 Task 9 (Captain Bob, 2026-11-20, "A Kconfig switch"): a
|
||||
word's heat, its decay, the rolling window, pipelining, inference and
|
||||
L8, run by the kernel at every call and at every heartbeat tick. Off,
|
||||
a word's calls are still counted and charged to the Stadium, and none
|
||||
of the loops runs: the boot the acceptance checks are seen to fail
|
||||
on. The revert, as OPCODE_PHYSICS is the opcodes'.
|
||||
|
||||
config OPCODE_PHYSICS
|
||||
bool "Compudynamics on the 32 F18 opcodes as well as the words (OPCODE_PHYSICS)"
|
||||
default y
|
||||
|
||||
@@ -278,7 +278,7 @@ INIT_PROOFS ?= 1
|
||||
INIT_COMMON := build-essential make git git-lfs python3 curl ca-certificates xz-utils \
|
||||
xorriso mtools gdisk dosfstools fdisk \
|
||||
qemu-user
|
||||
INIT_DOCPKGS := pandoc latexmk texlive-xetex texlive-latex-base texlive-latex-recommended \
|
||||
INIT_DOCPKGS := pandoc latexmk texlive-xetex texlive-latex-base texlive-latex-recommended texlive-science \
|
||||
texlive-latex-extra texlive-pictures texlive-fonts-recommended lmodern \
|
||||
fonts-dejavu fonts-dejavu-extra doxygen graphviz
|
||||
INIT_amd64 := qemu-system-x86 ovmf
|
||||
|
||||
+22
-15
@@ -29,10 +29,12 @@
|
||||
| `sdk.4th` | 5109, 5110, 5111, 5112, 5113, 5114, 5115 | `0x008fdbbb62c94a3a` | n/a |
|
||||
| `turtle.4th` | 5100, 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108 | `0x4d470418ca543365` | n/a |
|
||||
| `user-font-demo.4th` | 4200, 4201, 4202 | `0xce1fd7d1b581a56d` | n/a |
|
||||
| `v4:centre.4th` | 3964, 3965, 3966, 3967, 3968, 3969, 3970 | `0xea5815290d56dff3` | n/a |
|
||||
| `v4:ACL.4th` | 3984, 3985, 3986, 3987 | `0xdba5690fb0ee12a4` | n/a |
|
||||
| `v4:centre.4th` | 3964, 3965, 3966, 3967, 3968, 3969, 3970 | `0x53b1e3df644e8e25` | n/a |
|
||||
| `v4:forth79.4th` | 3948, 3949, 3950 | `0x4609d6ef54166ef8` | n/a |
|
||||
| `v4:hera.4th` | 3960, 3961 | `0x78730b1d6effe892` | n/a |
|
||||
| `v4:physics.4th` | 3972, 3973, 3974, 3975, 3976 | `0x5b0195fc30828bde` | n/a |
|
||||
| `v4:init.4th` | 3980 | `0x13fe8932fa4d2934` | n/a |
|
||||
| `v4:physics.4th` | 3972, 3973, 3974, 3975, 3976 | `0xb26da18d35ce5a84` | n/a |
|
||||
| `v4:starshipos.4th` | 3956, 3957 | `0x1734a8f4fe7483a5` | n/a |
|
||||
| `workload-0.4th` | 2200, 2201 | `0x93f86f60aeba8feb` | n/a |
|
||||
| `workload-1-lite.4th` | 5058, 5059 | `0x44a7a7e3176dcc8d` | n/a |
|
||||
@@ -112,18 +114,23 @@
|
||||
| 3957 | `v4:starshipos.4th` | `0x1734a8f4fe7483a5` | ok |
|
||||
| 3960 | `v4:hera.4th` | `0x78730b1d6effe892` | ok |
|
||||
| 3961 | `v4:hera.4th` | `0x78730b1d6effe892` | ok |
|
||||
| 3964 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3965 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3966 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3967 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3968 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3969 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3970 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3972 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3973 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3974 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3975 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3976 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3964 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3965 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3966 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3967 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3968 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3969 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3970 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3972 | `v4:physics.4th` | `0xb26da18d35ce5a84` | ok |
|
||||
| 3973 | `v4:physics.4th` | `0xb26da18d35ce5a84` | ok |
|
||||
| 3974 | `v4:physics.4th` | `0xb26da18d35ce5a84` | ok |
|
||||
| 3975 | `v4:physics.4th` | `0xb26da18d35ce5a84` | ok |
|
||||
| 3976 | `v4:physics.4th` | `0xb26da18d35ce5a84` | ok |
|
||||
| 3980 | `v4:init.4th` | `0x13fe8932fa4d2934` | ok |
|
||||
| 3984 | `v4:ACL.4th` | `0xdba5690fb0ee12a4` | ok |
|
||||
| 3985 | `v4:ACL.4th` | `0xdba5690fb0ee12a4` | ok |
|
||||
| 3986 | `v4:ACL.4th` | `0xdba5690fb0ee12a4` | ok |
|
||||
| 3987 | `v4:ACL.4th` | `0xdba5690fb0ee12a4` | ok |
|
||||
| 4000 | `ACL.4th` | `0xf8890c05c0d8f921` | ok |
|
||||
| 4001 | `ACL.4th` | `0xf8890c05c0d8f921` | ok |
|
||||
| 4002 | `ACL.4th` | `0xf8890c05c0d8f921` | ok |
|
||||
@@ -387,4 +394,4 @@
|
||||
| 5115 | `sdk.4th` | `0x008fdbbb62c94a3a` | ok |
|
||||
|
||||
---
|
||||
*40 capsule(s) scanned. Re-run `mkcapsule --manifest <dir>` to refresh.*
|
||||
*42 capsule(s) scanned. Re-run `mkcapsule --manifest <dir>` to refresh.*
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
Block 3984
|
||||
\ ACL.4th -- word-level access control: the policy.
|
||||
\ v3's capsules/ACL.4th, as FORTH source the node compiles.
|
||||
\ The capsule supplies an entry's fields and the check
|
||||
\ (acl.f18, compile.f18); what is strict, how long a TTL
|
||||
\ lasts and what is pinned is decided here. Loading it
|
||||
\ switches access control on: its last line runs ACL-BOOT.
|
||||
\ A system that does not load it has none. init.4th loads
|
||||
\ it after POST (MACHINE.md 1.1: the init turns on security).
|
||||
\ The xt these words take is what FIND and ['] give.
|
||||
FORTH DEFINITIONS
|
||||
1 CONSTANT ACL-STRICT-MODE
|
||||
0 CONSTANT ACL-TTL-MODE-VAL
|
||||
\ the TTL of a cold word, tuned 2026-06-15 on v3
|
||||
256 CONSTANT ACL-BASE-TTL
|
||||
65535 CONSTANT ACL-MAX-TTL
|
||||
-->
|
||||
Block 3985
|
||||
\ ( xt -- xt ) for symmetry: the xt is the entry
|
||||
: ACL-ENTRY ;
|
||||
: ACL-STRICT ( xt -- )
|
||||
DUP ACL-PINNED? IF DROP EXIT THEN
|
||||
ACL-STRICT-MODE SWAP ACL-MODE! ;
|
||||
: ACL-TTL-MODE ( xt -- )
|
||||
DUP ACL-PINNED? IF DROP EXIT THEN
|
||||
ACL-TTL-MODE-VAL SWAP ACL-MODE! ;
|
||||
\ ( xt -- ttl ) a hotter word earns a longer TTL:
|
||||
\ heat/4 + 256, at most 65535
|
||||
: ACL-TTL-COMPUTE
|
||||
ACL-HEAT@ 4 / ACL-BASE-TTL + ACL-MAX-TTL MIN ;
|
||||
-->
|
||||
Block 3986
|
||||
\ ( xt -- ) what the check runs when a word's TTL is 0.
|
||||
\ STRICT: allow, and leave the TTL 0 so that every use
|
||||
\ comes back here. TTL: compute a TTL from the word's
|
||||
\ heat; allow.
|
||||
: ACL-RECHECK
|
||||
DUP ACL-PINNED? IF DROP EXIT THEN
|
||||
DUP ACL-MODE@ ACL-STRICT-MODE = IF
|
||||
1 OVER ACL-ALLOW! 0 OVER ACL-TTL! DROP EXIT
|
||||
THEN
|
||||
DUP ACL-TTL-COMPUTE OVER ACL-TTL! 1 SWAP ACL-ALLOW! ;
|
||||
\ the system CA's public key; placeholders, as in v3
|
||||
0 CONSTANT ACL-CA-KEY-LO
|
||||
0 CONSTANT ACL-CA-KEY-HI
|
||||
-->
|
||||
Block 3987
|
||||
\ ( req-hi req-lo -- allow? ) the fabric asks this word
|
||||
\ whether a channel may be opened. The default approves
|
||||
\ every request; a policy edits this.
|
||||
: HERMES-CHANNEL-OPEN? 2DROP 1 ;
|
||||
\ ( -- ) default fields on every word; the words that
|
||||
\ enforce the policy pinned; the recheck switched on
|
||||
: ACL-BOOT
|
||||
ACL-INIT-PRIMITIVES
|
||||
['] ACL-RECHECK ACL-PIN ['] ACL-INIT-PRIMITIVES ACL-PIN
|
||||
['] ACL-RECHECK ACL-HOOK !
|
||||
LOG-INFO" ACL: active" ;
|
||||
' ACL-BOOT ACL-PIN
|
||||
ACL-BOOT
|
||||
@@ -38,6 +38,11 @@ Block 3966
|
||||
: (LINES) ( baddr u -- ) CAPSULE-OPEN 0= IF (FAIL) THEN
|
||||
BEGIN PAD CAPSULE-LINE DUP 0< 0= WHILE PAD SWAP (TELL) REPEAT
|
||||
DROP ;
|
||||
( a capsule of FORTH blocks into this node: its lowest LOADed )
|
||||
: CAPSULE-INCLUDE ( baddr u -- )
|
||||
CAPSULE-OPEN 0= IF -1 NODE-ERROR ! EXIT THEN
|
||||
PAD CAPSULE-LINE 0< IF EXIT THEN
|
||||
0 0 PAD 1- CONVERT DROP DROP LOAD ;
|
||||
-->
|
||||
Block 3967
|
||||
( Who it is, where its printing goes, which of its ports )
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
Block 3980
|
||||
( init.4th -- the system's init, run after POST and COLD. )
|
||||
( MACHINE.md 1.1 and 3, step 5: everything after POST is )
|
||||
( init.4th's. docs/v4.0.0/plans/2026-11-18-v4-init.md. )
|
||||
( Step 2, security on: the ACL policy, ACL.4th. )
|
||||
S" v4:ACL.4th" CAPSULE-INCLUDE
|
||||
( The words that create or end nodes, pinned: their fields )
|
||||
( cannot be changed, so no policy can deny them. )
|
||||
' BIRTH ACL-PIN ' BIRTH-AS ACL-PIN ' UNIT ACL-PIN
|
||||
' KILL ACL-PIN ' UNIT-KILL ACL-PIN
|
||||
' PAUSE ACL-PIN ' RESUME ACL-PIN
|
||||
' NODE-BORN ACL-PIN ' NODE-KILL ACL-PIN
|
||||
' NODE-SLEEP ACL-PIN ' NODE-WAKE ACL-PIN
|
||||
( Step 1, the search order: STARSHIPOS, then FORTH. Last, )
|
||||
( since ACL.4th ends in FORTH DEFINITIONS. )
|
||||
STARSHIPOS
|
||||
@@ -23,6 +23,8 @@ Block 3973
|
||||
-32 KERNEL-WORD INFER-VARIANCE@ ( -- d )
|
||||
-33 KERNEL-WORD INFER-FIT@ ( -- d )
|
||||
-34 KERNEL-WORD INFER-EARLY-EXIT@ ( -- flag )
|
||||
-41 KERNEL-WORD L8-CARD@ ( -- card changes )
|
||||
-42 KERNEL-WORD L8-HOLD ( card -- ; -1: L8 chooses )
|
||||
( v3's DECAY_RATE_PER_US_Q16, its compile-time constant )
|
||||
1 CONSTANT DECAY-RATE@
|
||||
-->
|
||||
|
||||
@@ -81,3 +81,25 @@ set HDR-NFA here ", ACL-HEAT@ #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LIN
|
||||
\ ( xt -- n ) a number for the word that never changes: its address
|
||||
set HDR-NFA here ", ACL-WORD-ID #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
: ACL-WORD-ID (ACL-XT) ;
|
||||
|
||||
\ ( xt -- ) a call from code defined at run time that the kernel sent here
|
||||
\ (v4/system/mesh.c, on_call) because the word's TTL is 0 or it is denied.
|
||||
\ As v3's inner interpreter, and as (ACL?): the recheck, or the TTL counted
|
||||
\ down; then a denied word refused with v3's line -- by its own name, from
|
||||
\ its entry (WORD's buffer is the running code's, not this) -- the stack
|
||||
\ emptied and the line ended; an allowed word is jumped to, so it returns to
|
||||
\ the caller as the call would have (docs/v4.0.0/plans/2026-11-19-acl-at-call.md).
|
||||
: (ACL-CALL)
|
||||
dup -3 + a! @ \ xt flags
|
||||
dup $FFFF0000 and if ZERO
|
||||
drop -65536 + ! jump TEST \ one use fewer
|
||||
ZERO: drop drop dup (ACL-RECHECK)
|
||||
TEST: dup -3 + a! @ 32 and if OK
|
||||
drop
|
||||
$33335B1B (EMIT4) $6D (EMIT4) $4E524157 (EMIT4) $203A (EMIT4) $6D305B1B (EMIT4) \ v3's line: WARN: in yellow
|
||||
$3A4C4341 (EMIT4) $6E656420 (EMIT4) $20646569 (EMIT4) $27 (EMIT4)
|
||||
-2 + a! @ 4* COUNT TYPE 39 EMIT CR \ the word's own name
|
||||
DSTACK-DEPTH b! a !b \ as v3, the stack is emptied
|
||||
pop drop jump (ABANDON)
|
||||
OK: drop push ; \ on to the word
|
||||
|
||||
|
||||
+16
-13
@@ -113,22 +113,25 @@ macro ROT push SWAP pop SWAP endmacro
|
||||
\ bits 16 .. 31 the TTL, a count of uses left before the next recheck
|
||||
\ A new entry has all of them zero: allowed, not pinned, TTL mode, TTL 0.
|
||||
\
|
||||
\ (ACL?) is run by INTERPRET for every word it is about to execute or
|
||||
\ compile. As v3: if the TTL is 0 the word is rechecked, otherwise the TTL
|
||||
\ is counted down; then a denied word is refused. The recheck is the word
|
||||
\ whose address is in (ACL-HOOK) -- ACL-RECHECK, once ACL.fth has loaded --
|
||||
\ and with none there the word is allowed and given the longest TTL.
|
||||
\ (ACL?) is run by INTERPRET for every word it is about to execute. As v3:
|
||||
\ if the TTL is 0 the word is rechecked, otherwise the TTL is counted down;
|
||||
\ then a denied word is refused. The recheck is the word whose address is in
|
||||
\ (ACL-HOOK) -- ACL-RECHECK, once ACL.4th has loaded -- and with none there the
|
||||
\ word is allowed and given the longest TTL.
|
||||
\
|
||||
\ v3 checks every execution, inside definitions too. v4 code is native: a
|
||||
\ compiled call goes straight to its word. So v4 checks a word when it is
|
||||
\ compiled as well as when it is interpreted -- a denied word cannot be
|
||||
\ built into anything new -- but a call compiled while the word was allowed
|
||||
\ is not checked again.
|
||||
\ As v3, every execution is checked, inside definitions too (2026-11-19,
|
||||
\ docs/v4.0.0/plans/2026-11-19-acl-at-call.md): a call from code defined at
|
||||
\ run time is checked by the kernel at the call -- counted down there, or,
|
||||
\ at a TTL of 0 or a denied word, sent to (ACL-CALL) (acl.f18), which runs
|
||||
\ (ACL?). A word being compiled is not checked, as in v3. While the policy
|
||||
\ rechecks a word, (ACL-BUSY) is 1 and the kernel checks nothing, as v3 runs
|
||||
\ its policy with the check off.
|
||||
|
||||
\ ( xt -- ) recheck
|
||||
: (ACL-RECHECK)
|
||||
(ACL-HOOK) a! @ if NONE push ex \ call it with the xt
|
||||
;
|
||||
(ACL-HOOK) a! @ if NONE
|
||||
1 (ACL-BUSY) a! ! push ex \ call it with the xt, the kernel's check off
|
||||
0 (ACL-BUSY) a! ! ;
|
||||
NONE: drop -3 + a! @ 65535 and -33 and $FFFF0000 + ! ;
|
||||
|
||||
\ ( xt -- xt ) as above; a denied word ends the line
|
||||
@@ -202,7 +205,7 @@ set HDR-NFA here ", INTERPRET #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LIN
|
||||
STATE a! @ if INTERP
|
||||
drop 1 and if COMP \ compiling: immediate words still run
|
||||
drop (ACL?) jump (GO)
|
||||
COMP: drop (ACL?) (COMPILE,) jump (IL)
|
||||
COMP: drop (COMPILE,) jump (IL) \ compiled, not checked: the call is, when it runs (as v3)
|
||||
INTERP: drop 16 and if RUN
|
||||
drop drop (.WORD) \ ": compile-only"
|
||||
$6F63203A (EMIT4) $6C69706D (EMIT4) $6E6F2D65 (EMIT4) $796C (EMIT4) CR
|
||||
|
||||
@@ -35,5 +35,9 @@ store (IMG) &(IDLE)
|
||||
store (IMG)+1 &(FAULTS)
|
||||
store (IMG)+2 &KEY
|
||||
store (IMG)+3 &CR
|
||||
\ the ACL's check at call: where the kernel sends a call to be checked; and the
|
||||
\ policy not running
|
||||
store (ACL-CALLX) &(ACL-CALL)
|
||||
store (ACL-BUSY) 0
|
||||
|
||||
start (IDLE)
|
||||
|
||||
@@ -120,6 +120,8 @@ constant RSTACK-DEPTH 32752
|
||||
constant HEAT-OP 29216
|
||||
constant (EXEC) 30047
|
||||
constant (RUNX) 29954
|
||||
constant (ACL-CALLX) 29956
|
||||
constant (ACL-BUSY) 29925
|
||||
constant ANTICLOCK 29248
|
||||
constant CFBASE 32672
|
||||
constant CFEND 32704
|
||||
|
||||
@@ -120,6 +120,8 @@ constant RSTACK-DEPTH 32752
|
||||
constant HEAT-OP 29216
|
||||
constant (EXEC) 30047
|
||||
constant (RUNX) 29954
|
||||
constant (ACL-CALLX) 29956
|
||||
constant (ACL-BUSY) 29925
|
||||
constant ANTICLOCK 29248
|
||||
constant CFBASE 32672
|
||||
constant CFEND 32704
|
||||
|
||||
@@ -59,6 +59,31 @@ ss -ltnp | grep 7681 # the ttyd of starshipos-demo, not
|
||||
|
||||
The service expects the checkout's `demo/` at `/opt/starshipos-demo/demo` (step 1 put it there).
|
||||
|
||||
**The transcripts (#192, ruled 2026-11-21: "Write-only drop box").** Each session writes what the
|
||||
visitor typed and what the machine answered to `/var/lib/starshipos-demo-transcripts`, one file per
|
||||
session, mode 0600 (`console.py`). The directory is yours, group `starshipos-demo`, mode 1730: a
|
||||
session can add a file, but cannot list the directory or read anything in it. A root timer hands each
|
||||
file to you and deletes every one older than 7 days (`transcripts-tidy.sh`). The Try it page says so.
|
||||
Before (re)starting the service, with `OWNER` your own login:
|
||||
|
||||
```bash
|
||||
OWNER=<your login>
|
||||
install -d -o "$OWNER" -g starshipos-demo -m 1730 /var/lib/starshipos-demo-transcripts
|
||||
sed "s/^Environment=OWNER=CHANGE-ME$/Environment=OWNER=$OWNER/" \
|
||||
demo/starshipos-demo-transcripts.service > /etc/systemd/system/starshipos-demo-transcripts.service
|
||||
cp demo/starshipos-demo-transcripts.timer /etc/systemd/system/
|
||||
systemctl daemon-reload && systemctl enable --now starshipos-demo-transcripts.timer
|
||||
systemctl restart starshipos-demo # its unit now writes the transcripts directory
|
||||
systemctl list-timers starshipos-demo-transcripts --no-pager
|
||||
```
|
||||
|
||||
Then the check: open a session, type a line, close it; within 5 minutes its file is in
|
||||
`/var/lib/starshipos-demo-transcripts`, owned by you, mode `-rw-------`, and `sudo -u
|
||||
starshipos-demo ls /var/lib/starshipos-demo-transcripts` is refused. A file older than 7 days
|
||||
(`touch -d '8 days ago' FILE.log`) is gone at the next run (`systemctl start
|
||||
starshipos-demo-transcripts` runs it at once). Apache must not serve the directory: nothing in
|
||||
`apache-demo.conf` maps it, and nothing should.
|
||||
|
||||
## 5. TLS and Apache for try.starshipos-f18.com (~10 min)
|
||||
|
||||
DNS: `try.starshipos-f18.com` must point at this server (an A record) before certbot.
|
||||
|
||||
@@ -21,6 +21,9 @@ XWiki "Try it" page (iframe) -> Apache: TLS, websocket -> ttyd -> start-session.
|
||||
| `console.py` | Joins the visitor's terminal to the machine only once it runs, discarding keys typed while it loads |
|
||||
| `qemu-args.sh` | The machine, shared by the two above: a resumed machine must match the saved one exactly |
|
||||
| `starshipos-demo.service` | ttyd as a systemd service, on localhost; two guests at once, a busy message for the rest (#114, #116) |
|
||||
| `transcripts-tidy.sh` | Hands each session's transcript to its owner, mode 0600, and deletes those over 7 days (#192) |
|
||||
| `starshipos-demo-transcripts.service`, `.timer` | Runs `transcripts-tidy.sh` as root every 5 minutes (#192) |
|
||||
| `test_transcripts.py` | Tests the transcript and the tidy, with a stand-in machine: `python3 demo/test_transcripts.py` |
|
||||
| `DEPLOY.md` | Putting it on the server, step by step |
|
||||
| `apache-demo.conf` | Example vhost: TLS, the websocket, framing allowed for the `.com` only (#115) |
|
||||
| `xwiki-try-it.xwiki` | The "Try it" page, its own page on the `.com` XWiki (`TryIt`), in the landing page's style |
|
||||
@@ -33,6 +36,10 @@ seccomp sandbox (no spawning, no privilege changes), as an unprivileged user, in
|
||||
that fences memory, CPU and the file system. A session lasts at most `DEMO_SESSION_LIMIT` seconds
|
||||
(1800).
|
||||
|
||||
What is kept: a transcript of each session -- what the visitor typed and what the machine answered
|
||||
-- for up to 7 days, readable by the server's owner only, then deleted (#192; `DEPLOY.md`, step 4).
|
||||
The Try it page and the session's first lines say so.
|
||||
|
||||
## Setting it up
|
||||
|
||||
From a checkout of the most recent green commit -- the latest that passed acceptance, `master`
|
||||
|
||||
@@ -10,6 +10,13 @@ A resumed machine takes a moment to load. Anything typed meanwhile would reach a
|
||||
whose state is about to be replaced, and be lost half-way through a line ("3 4 + ." arriving as
|
||||
"4 + ."). So: wait until QEMU says the machine is running, throw away what was typed before,
|
||||
say so, and only then pass bytes both ways. Ends when either side closes.
|
||||
|
||||
The transcript (#192, ruled 2026-11-13 and 2026-11-21): what the machine sends -- its prompt, the visitor's
|
||||
line as it echoes it, what it prints -- is also written to DEMO_TRANSCRIPTS
|
||||
(/var/lib/starshipos-demo-transcripts), one file a session, named by its UTC start and this process, mode 0600.
|
||||
The directory is a drop box this user can write in but not list or read (DEPLOY.md); transcripts-tidy.sh
|
||||
hands each file to its owner and deletes it after 7 days. The Try It page says so. If it cannot be written,
|
||||
the session goes on without one.
|
||||
"""
|
||||
import json, os, select, socket, sys, termios, time, tty
|
||||
|
||||
@@ -38,6 +45,14 @@ while True: # until the machine runs
|
||||
time.sleep(0.1)
|
||||
|
||||
con = connect(con_path)
|
||||
transcript = None
|
||||
try:
|
||||
tdir = os.environ.get("DEMO_TRANSCRIPTS", "/var/lib/starshipos-demo-transcripts")
|
||||
name = os.path.join(tdir, time.strftime("%Y%m%d-%H%M%S", time.gmtime()) + "-%d.log" % os.getpid())
|
||||
transcript = os.open(name, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
||||
os.write(transcript, ("# StarshipOS demo session, %s UTC\n" % time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())).encode())
|
||||
except OSError:
|
||||
transcript = None # no transcript, the session as before
|
||||
stdin, stdout = sys.stdin.fileno(), sys.stdout.fileno()
|
||||
saved = None
|
||||
if os.isatty(stdin):
|
||||
@@ -56,7 +71,13 @@ try:
|
||||
data = con.recv(4096)
|
||||
if not data: break
|
||||
os.write(stdout, data)
|
||||
if transcript is not None:
|
||||
try: os.write(transcript, data)
|
||||
except OSError: transcript = None
|
||||
except OSError:
|
||||
pass # the visitor's terminal went away
|
||||
finally:
|
||||
if saved: termios.tcsetattr(stdin, termios.TCSADRAIN, saved)
|
||||
if transcript is not None:
|
||||
os.write(transcript, ("\n# ended %s UTC\n" % time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())).encode())
|
||||
os.close(transcript)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# starshipos-demo-transcripts.service -- the demo's transcripts (#192, ruled 2026-11-21: "Write-only drop box").
|
||||
# Each session (console.py) writes its transcript, mode 0600, into /var/lib/starshipos-demo-transcripts:
|
||||
# owned by Captain Bob, group starshipos-demo, mode 1730, so a session can add a file but not list or
|
||||
# read the directory. This hands each file to the owner and deletes every one older than 7 days.
|
||||
# Run by starshipos-demo-transcripts.timer. Set OWNER below to the owner's login (DEPLOY.md, step 4).
|
||||
[Unit]
|
||||
Description=StarshipOS demo transcripts: hand them to their owner, delete those over 7 days
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Environment=OWNER=CHANGE-ME
|
||||
ExecStart=/opt/starshipos-demo/demo/transcripts-tidy.sh /var/lib/starshipos-demo-transcripts ${OWNER}
|
||||
@@ -0,0 +1,10 @@
|
||||
# starshipos-demo-transcripts.timer -- runs starshipos-demo-transcripts.service every 5 minutes (#192).
|
||||
[Unit]
|
||||
Description=StarshipOS demo transcripts, every 5 minutes
|
||||
|
||||
[Timer]
|
||||
OnBootSec=5min
|
||||
OnUnitActiveSec=5min
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
@@ -14,6 +14,8 @@ Group=starshipos-demo
|
||||
Environment=DEMO_STATE=/var/lib/starshipos-demo
|
||||
Environment=DEMO_SESSION_LIMIT=1800
|
||||
Environment=DEMO_MAX_GUESTS=2
|
||||
# each session's transcript (console.py, #192): a write-only drop box, kept 7 days
|
||||
Environment=DEMO_TRANSCRIPTS=/var/lib/starshipos-demo-transcripts
|
||||
# the guests' slot locks (start-session.sh): /run/starshipos-demo, made for this user, gone at stop
|
||||
RuntimeDirectory=starshipos-demo
|
||||
# --max-clients: the guests and a few more, so a visitor over the limit reaches the busy message
|
||||
@@ -30,6 +32,7 @@ ProtectHome=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
ReadOnlyPaths=/var/lib/starshipos-demo
|
||||
ReadWritePaths=/var/lib/starshipos-demo-transcripts
|
||||
# Sized for this server (3.8 GiB, two cores; both wikis, Gitea, Nexus, CI). Since #151 an idle guest
|
||||
# halts (1% of a core at the prompt, was 100%), so a session costs CPU only while its visitor runs
|
||||
# something. All sessions together get 1.5 cores at the lowest priority (Captain Bob, 2026-11-08):
|
||||
|
||||
@@ -42,7 +42,8 @@ trap 'rm -rf "$tmp"' EXIT
|
||||
cp "$dir/vars.fd" "$tmp/vars.fd"
|
||||
demo_qemu_args "$dir" "$tmp/vars.fd"
|
||||
|
||||
printf '\r\nStarshipOS -- starting a throwaway machine, yours for up to %d minutes. Nothing you do is kept.\r\n' $((limit / 60))
|
||||
printf '\r\nStarshipOS -- starting a throwaway machine, yours for up to %d minutes. Nothing you do is kept on it.\r\n' $((limit / 60))
|
||||
printf 'A transcript of this session is kept for up to 7 days, then deleted.\r\n'
|
||||
printf 'Try: 3 4 + . : SQUARE DUP * ; 7 SQUARE .\r\n\r\n'
|
||||
# QEMU is a tracked child, not exec'd, so that whatever ends the session ends the machine: ttyd
|
||||
# hangs up (it signals this script only), the service stops, or the time runs out. Its console is
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: LicenseRef-Starship-1.0
|
||||
# Copyright (c) 2023-2026 Robert A. James
|
||||
"""test_transcripts.py -- the demo's transcripts (#192, ruled 2026-11-13 and 2026-11-21): console.py writes each
|
||||
session's console into DEMO_TRANSCRIPTS, one dated file a session, readable only by its writer; and
|
||||
transcripts-tidy.sh hands each to the directory's owner and deletes those older than 7 days. No QEMU: a fake QMP
|
||||
socket that says the machine runs, and a fake console that echoes. Prints PASS:/FAIL: and RESULT:."""
|
||||
import json, os, socket, subprocess, sys, tempfile, threading, time, glob
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
ok = True
|
||||
def check(what, cond):
|
||||
global ok
|
||||
print(("PASS: " if cond else "FAIL: ") + what)
|
||||
ok = ok and bool(cond)
|
||||
|
||||
def qmp_server(path):
|
||||
s = socket.socket(socket.AF_UNIX); s.bind(path); s.listen(1)
|
||||
def run():
|
||||
c, _ = s.accept(); f = c.makefile("rw")
|
||||
f.write(json.dumps({"QMP": {}}) + "\n"); f.flush()
|
||||
for line in f:
|
||||
f.write(json.dumps({"return": {"status": "running"}} if "query-status" in line else {"return": {}}) + "\n"); f.flush()
|
||||
threading.Thread(target=run, daemon=True).start()
|
||||
|
||||
def console_server(path):
|
||||
s = socket.socket(socket.AF_UNIX); s.bind(path); s.listen(1)
|
||||
def run():
|
||||
c, _ = s.accept()
|
||||
c.sendall(b"[zuse@Hera] ok> ")
|
||||
while True:
|
||||
d = c.recv(1024)
|
||||
if not d: break
|
||||
c.sendall(d) # the machine echoes
|
||||
if b"\r" in d: c.sendall(b"7 ok\r\n[zuse@Hera] ok> ")
|
||||
threading.Thread(target=run, daemon=True).start()
|
||||
|
||||
with tempfile.TemporaryDirectory() as t:
|
||||
tr = os.path.join(t, "transcripts"); os.mkdir(tr, 0o730)
|
||||
qmp_server(os.path.join(t, "qmp.sock")); console_server(os.path.join(t, "con.sock"))
|
||||
env = dict(os.environ, DEMO_TRANSCRIPTS=tr)
|
||||
p = subprocess.Popen([sys.executable, "-I", os.path.join(HERE, "console.py"), os.path.join(t, "qmp.sock"), os.path.join(t, "con.sock")],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=env)
|
||||
time.sleep(1.0); p.stdin.write(b"3 4 + .\r"); p.stdin.flush(); time.sleep(1.0); p.stdin.close()
|
||||
out = p.stdout.read(); p.wait(timeout=10)
|
||||
files = glob.glob(os.path.join(tr, "*.log"))
|
||||
check("the visitor still sees the session: %r" % out[-40:], b"7 ok" in out)
|
||||
check("one transcript for the session (%d)" % len(files), len(files) == 1)
|
||||
if files:
|
||||
f = files[0]; text = open(f, "rb").read()
|
||||
check("named by its date, UTC: %s" % os.path.basename(f), os.path.basename(f)[:8].isdigit())
|
||||
check("it holds what was typed, as the machine echoed it, and what it printed", b"3 4 + ." in text and b"7 ok" in text)
|
||||
check("readable by its writer only (mode %o)" % (os.stat(f).st_mode & 0o777), os.stat(f).st_mode & 0o777 == 0o600)
|
||||
# a directory it cannot write: the session goes on, without a transcript
|
||||
ro = os.path.join(t, "nowhere")
|
||||
env2 = dict(os.environ, DEMO_TRANSCRIPTS=ro)
|
||||
os.unlink(os.path.join(t, "qmp.sock")); os.unlink(os.path.join(t, "con.sock"))
|
||||
qmp_server(os.path.join(t, "qmp.sock")); console_server(os.path.join(t, "con.sock"))
|
||||
p = subprocess.Popen([sys.executable, "-I", os.path.join(HERE, "console.py"), os.path.join(t, "qmp.sock"), os.path.join(t, "con.sock")],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=env2)
|
||||
time.sleep(1.0); p.stdin.write(b"3 4 + .\r"); p.stdin.flush(); time.sleep(1.0); p.stdin.close()
|
||||
out = p.stdout.read(); p.wait(timeout=10)
|
||||
check("with no directory to write in, the session still works", b"7 ok" in out)
|
||||
|
||||
# transcripts-tidy.sh: handed to the owner, the old deleted
|
||||
box = os.path.join(t, "box"); os.mkdir(box)
|
||||
new, old = os.path.join(box, "20261121-000000-1.log"), os.path.join(box, "20261101-000000-2.log")
|
||||
for f in (new, old): open(f, "w").write("x"); os.chmod(f, 0o600)
|
||||
eight_days = time.time() - 8 * 86400; os.utime(old, (eight_days, eight_days))
|
||||
r = subprocess.run(["bash", os.path.join(HERE, "transcripts-tidy.sh"), box, "nobody"], capture_output=True, text=True)
|
||||
check("the tidy succeeds: %s" % (r.stderr.strip() or "ok"), r.returncode == 0)
|
||||
check("a transcript older than 7 days is deleted", not os.path.exists(old))
|
||||
check("a newer one is kept", os.path.exists(new))
|
||||
if os.path.exists(new):
|
||||
import pwd
|
||||
st = os.stat(new)
|
||||
check("and handed to the directory's owner (%s), mode 600" % pwd.getpwuid(st.st_uid).pw_name,
|
||||
pwd.getpwuid(st.st_uid).pw_name == "nobody" and st.st_mode & 0o777 == 0o600)
|
||||
print("RESULT: " + ("PASS" if ok else "FAIL"))
|
||||
sys.exit(0 if ok else 1)
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: LicenseRef-Starship-1.0
|
||||
# Copyright (c) 2023-2026 Robert A. James
|
||||
# transcripts-tidy.sh DIR OWNER -- the demo's transcripts (#192): each handed to OWNER, mode 0600, so only OWNER
|
||||
# reads it (the session's user wrote it, and cannot list the directory); every one older than 7 days deleted.
|
||||
# Run as root by starshipos-demo-transcripts.timer every 5 minutes. Tests: demo/test_transcripts.py.
|
||||
set -euo pipefail
|
||||
dir=${1:?usage: transcripts-tidy.sh DIR OWNER}
|
||||
owner=${2:?usage: transcripts-tidy.sh DIR OWNER}
|
||||
[ -d "$dir" ] || { echo "transcripts-tidy: no $dir" >&2; exit 1; }
|
||||
find "$dir" -maxdepth 1 -type f -name '*.log' -mmin +10080 -delete # 7 days
|
||||
find "$dir" -maxdepth 1 -type f -name '*.log' ! -user "$owner" -exec chown "$owner:" {} + -exec chmod 0600 {} +
|
||||
@@ -13,7 +13,8 @@ This is a real StarshipOS machine, started just for you and already at its promp
|
||||
simulation of StarshipOS and not a recording: the console below is the serial console of an
|
||||
amd64 machine running the same image the project publishes every night. You are logged in as
|
||||
**Zuse**, the superuser -- of a machine that exists only for your session. There is nothing to
|
||||
break, and nothing you do is kept. Close the page and it is gone.
|
||||
break, and nothing you do is kept on it. Close the page and it is gone. A transcript of your
|
||||
session -- what you type and what the machine answers -- is kept for up to 7 days, then deleted.
|
||||
|
||||
{{html clean="false"}}
|
||||
<iframe src="https://try.starshipos-f18.com/" title="StarshipOS console"
|
||||
|
||||
@@ -6847,3 +6847,39 @@ What the record asks beyond POST, each gap put to Captain Bob one at a time:
|
||||
tag"): PR #197 merges once its Acceptance passes, and a tag on `master` marks the line. New work starts
|
||||
after it.
|
||||
|
||||
|
||||
## XLIX. Capsule trust: the intermediate is the anchor, and a signed kernel refuses an unsigned capsule (#139, 2026-11-20)
|
||||
|
||||
### 1. Found
|
||||
|
||||
XLVI left two things open (2026-11-07). The kernel does not check the image's signing certificate against
|
||||
the StarshipOS Root CA. And an unsigned capsule (`CAPSULE_SIG_MISSING`) is only a warning, as ruled on
|
||||
2026-08-26, when CI had no key. Since XLVI, CI signs every build, and the gate into master and a release
|
||||
refuse an unsigned one (#174).
|
||||
|
||||
### 2. Ruled (Captain Bob, 2026-11-20; `docs/v4.0.0/plans/2026-11-20-capsule-trust.md`)
|
||||
|
||||
1. **"Intermediate is the anchor; no root check."** The "StarshipOS Capsule Signing" certificate in the
|
||||
image (XLVI) is what capsules are trusted by. No root key goes in the kernel or in CI. First ruled
|
||||
"verify at boot"; withdrawn when asked where CI would take the root's certificate from: "Actually we
|
||||
decided to include an intermediate certificate in the kernel". On the way it was found that the root's
|
||||
private key is on the CI server beside its certificate, in `/var/lib/starshipos-ca/root/` (mode 700),
|
||||
so mounting that directory into CI jobs, one way to reach the certificate, would have exposed it.
|
||||
2. **"Refuse on signed builds."** A kernel built with the signing key refuses an unsigned capsule. A
|
||||
developer build, without the key, warns and boots.
|
||||
3. **"NO_ROOT_KEY, by build."** A signing certificate missing from the image, or one that cannot be read,
|
||||
is refused on a signed build and warned of on a developer build.
|
||||
4. **"Left to CI."** The boot of a signed kernel with an unsigned capsule is CI's to show, since only CI
|
||||
has the key.
|
||||
|
||||
### 3. Built
|
||||
|
||||
- `capsule_sig_refused()` (`kernel/src/capsule/capsule_sig.c`): the one decision. INVALID always;
|
||||
MISSING and NO_ROOT_KEY on a signed build (`CAPSULE_SIGNED_BUILD`, set by `kernel/Makefile` and
|
||||
`v4/Makefile` exactly when they sign). v4's boot and v3's three births ask it.
|
||||
- `kernel/tests/test_capsule_sig.c`, built twice, unsigned and signed: written first, it did not build
|
||||
without the function. It now passes 4 checks each way.
|
||||
- `scripts/nightly.sh capsule-trust`, a step of `nightly.yml`: a signed build with `v4:centre.4th` left
|
||||
unsigned (`CAPSULE_TEST_UNSIGN`, `scripts/capsule_unsign.py`, for the test only), booted on amd64. It
|
||||
must say `missing (unsigned)` and stop with `POST: FAILED`, and give no prompt. It is not a protocol
|
||||
stage, since a developer has no key. It is first seen in the nightly after this merges.
|
||||
|
||||
@@ -208,6 +208,8 @@ IS ( xt -- ) IS xxx: make the deferred word xxx run xt; compiled when compiling.
|
||||
J ( -- n ) Compile-only: the index of the next outer DO loop.
|
||||
KERNEL-WORD ( n -- ) KERNEL-WORD xxx: define xxx, a word that asks the kernel to do request n (as BYE, BLOCK).
|
||||
KEY ( -- c ) Wait for a key and leave its character.
|
||||
L8-CARD@ ( -- card changes ) L8's current card on this node, 0 to 63, and how many times it has changed: more than 0 once L8 has run.
|
||||
L8-HOLD ( card -- ) Holds L8 on the card given, 0 to 63, its gates applied; -1 lets L8 choose again.
|
||||
LATEST ( -- xt ) The newest entry of the CURRENT vocabulary.
|
||||
LEAVE ( -- ) Compile-only: leave the innermost DO loop at its next LOOP or +LOOP.
|
||||
LFA ( xt -- addr ) The link field of the entry (>LINK).
|
||||
@@ -389,6 +391,7 @@ BIRTH-AS ( number port childport baddr u -- place ) BIRTH, and given the capsule
|
||||
CAPSULE-CELL ( -- w flag ) The next cell of the capsule of F18 code this node has open, and true; 0 0 at its end. A kernel request.
|
||||
CAPSULE-LINE ( baddr -- u | -1 ) The next line of the capsule of FORTH blocks this node has open, copied to baddr: its length, or -1 at its end. A kernel request.
|
||||
CAPSULE-OPEN ( baddr u -- flag ) Find the named capsule, check its hash and signature, and open it to be read from its start by this node. A kernel request.
|
||||
CAPSULE-INCLUDE ( baddr u -- ) Load the named capsule of FORTH blocks into this node: CAPSULE-OPEN places its blocks in RAM, block n at n - R, and its lowest block is LOADed; what runs after it is the capsule's own (-->, LOAD, THRU). init.4th loads the ACL policy so. centre.4th.
|
||||
CENTRE ( n -- ) Hera only: a second centre, node n, from its port 6 to Hera's port 6, given centre.4th; it births its own unit, n+1 to n+4.
|
||||
KILL ( n -- ) Hera only: node n is removed, whatever it was doing; every node is told it is gone, and Hera forgets the way to it.
|
||||
NODE-BORN ( number -- place | -1 ) A node is born, empty, and entered in the registry with this node as its parent: its place, or -1 if there is no room. A kernel request.
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 11 and column 3.
|
@@ -0,0 +1,206 @@
|
||||
# The F18 ABI -- draft contract, for ruling
|
||||
|
||||
Written 2026-11-19. Step 1 of `ADR-2026-11-19-F18-ARTIFACTS.md` §7: "Define and document the minimal ABI
|
||||
contract". It builds on the rulings in `plans/2026-11-19-f18-artifacts.md`:
|
||||
1. compiled artifacts are allowed beside the ROM;
|
||||
2. Hermes is the messaging role;
|
||||
3. Artemis owns persistent memory;
|
||||
4. a word's identity is its capsule plus its name.
|
||||
|
||||
**Nothing here is built.** The choices left open are numbered in §9, and each will be put to Captain Bob on
|
||||
its own.
|
||||
|
||||
## 1. Terms
|
||||
|
||||
| Term | Meaning |
|
||||
|---|---|
|
||||
| **Word** | The unit of interface and access control (ADR §1). It has a name, an entry point, a stack effect and its ACL fields. |
|
||||
| **Capsule: a train** | The unit of packaging, distribution and deployment (ADR §1). It is content-addressed, so its ID is its hash, and it is signed, as now (`kernel/include/starkernel/capsule.h`). **Ruled 2026-11-19, "One train per capsule":** each capsule is a train. Its *engine* is its `.f18` code, assembled by the host tool into one artifact. Its *rolling stock* is the named blobs coupled behind the engine: `.4th` source, data, and whatever else it carries, each with its own identity and provenance. A system is many trains; the nucleus is one of them. |
|
||||
| **Artifact: the engine** | A train's compiled F18 unit: code cells, and the records of §4 that make them placeable and checkable. It is assembled from all of that capsule's `.f18` files. |
|
||||
| **Rolling stock** | The named blobs behind an engine (MACHINE.md §1's trailer). The engine's code is what acts on them: the ROM's types, `.f18` assembled and `.4th` handed a line at a time, now carried by each train. |
|
||||
| **Identity** | Ruling 4: a word's identity is (the hash of the capsule that defines it, the word's name). Addresses, word IDs and places are local resolution only. |
|
||||
| **Loader** | Whoever places an artifact in a node. As today, that is the node itself, through words like `CAPSULE-INCLUDE`, or the kernel at boot. No central linker (ADR §6). |
|
||||
|
||||
## 2. The hardware contract (unchanged; kept apart, ADR §3.2)
|
||||
|
||||
The engine's contract is what it is today, and the ABI does not change it:
|
||||
- **Instruction words** of six slots (`v4/include/v4/iword.h`). A branch (`jump`, `call`, `next`, `if`,
|
||||
`-if`) carries its target in the bits to the right of its slot, page-relative, with a reach of 27, 22, 17
|
||||
or 12 bits.
|
||||
- **The return stack and the data stack** are rings, with their depths set by the build (`V4_DATA_RING`,
|
||||
`V4_RET_RING`). A call pushes its return address.
|
||||
- **Ports and messages** between nodes, as MESH.md has them. The ABI adds nothing between nodes: "inter-core
|
||||
communication shall continue to use the established message architecture" (ADR §3.2).
|
||||
- **The call hook** (2026-11-19, `exec.h`) may redirect a call. The ACL uses it now; §6 may use it.
|
||||
|
||||
**What this means for artifacts:** compiled code holds addresses in its branch fields. An artifact placed
|
||||
anywhere but where it was compiled needs those fields fixed (§5).
|
||||
|
||||
## 3. The word contract
|
||||
|
||||
**The entry** is as `dict.f18` has it today:
|
||||
|
||||
| Cell | Holds |
|
||||
|---|---|
|
||||
| `xt - 4` | the word ID, local |
|
||||
| `xt - 3` | the flags: 1 immediate, 2 hidden, 4 data, 8 in-line, 16 compile-only, 128 deferred, plus the ACL fields (bit 5 denied, bit 6 pinned, bits 8–15 the mode, bits 16–31 the TTL) |
|
||||
| `xt - 2` | the name |
|
||||
| `xt - 1` | the link |
|
||||
| `xt` | the code |
|
||||
|
||||
**What the ABI adds is recorded, not run.** Each exported word has:
|
||||
- **its stack effect:** how many cells it takes and leaves on each stack. This is the "stack effects" of
|
||||
ADR §3.2. It is derived by the host tool from the compiled code (choice 2), checked when the artifact is
|
||||
placed and in the proofs, never at run time.
|
||||
- **its capabilities:** the kernel requests it may make (`KERNEL-WORD` numbers) and whether it touches ports.
|
||||
- **its ACL defaults:** pinned or not, and its mode. They are applied at placement, through the same fields.
|
||||
|
||||
**The calling convention:** a call with a return address on the return stack, as now. A word returns with
|
||||
`;`. Arguments and results travel on the data stack only, in the declared counts. There is nothing else.
|
||||
|
||||
## 4. The artifact
|
||||
|
||||
**The records are in 32-bit units, low byte first, and the code is in the build's cells** (`ARTIFACT.md`
|
||||
§1, ruled 2026-11-19, "32-bit units"). A node reads the records as it reads a block, four bytes to a
|
||||
cell. *Corrected 2026-11-19: this line said "All of it is in cells, so an F18 node can read it".*
|
||||
|
||||
| Record | Holds |
|
||||
|---|---|
|
||||
| **Header** | a magic number; the ABI version; the cell width (32 or 64); the record counts |
|
||||
| **Provenance** (ADR §3.1) | the source capsule's hash; the compiler's identity (the host tool's hash, choice 1); the build configuration's hash (the knobs, `V4_NODE_WORDS`, the rings); the target |
|
||||
| **Exports** | for each word: its name, its entry's offset in the code, its flags, its declared stack effect, its capabilities |
|
||||
| **Imports** | for each word used from another capsule: (that capsule's hash, the name), and the stack effect it is expected to have |
|
||||
| **Relocations** | every cell of the code whose branch field holds an address, with how to fix it: internal (add the base), or import *k* |
|
||||
| **Code** | the compiled cells, as if placed at address 0 |
|
||||
| **Verification** | the identity of the proof that covers this exact artifact, and the assumptions it holds under (ADR §5), or none |
|
||||
|
||||
**Integrity and authorship** are the capsule's: its content hash and its Ed25519 signature, as now. The
|
||||
artifact repeats neither, and, as ADR §5 says, a hash is not correctness.
|
||||
|
||||
## 5. Placement: resolution without a linker
|
||||
|
||||
A loader places an artifact in one pass, in order:
|
||||
1. **Check:**
|
||||
- the header is one this ABI version and cell width take;
|
||||
- the capsule's hash and signature check, as `CAPSULE-OPEN` already does;
|
||||
- every import's capsule is present in this node, and the imported word is exported by it with the
|
||||
stack effect expected. **Fail closed:** if any check fails, nothing is placed.
|
||||
2. **Place:** the code cells are copied to the node's dictionary space at its `HERE`, the base.
|
||||
3. **Fix:** each relocation's branch field is patched, adding the base, or putting in the import's
|
||||
resolved address. A field whose patched address does not fit its slot's reach is refused (fail
|
||||
closed). Patching happens at placement only, once, with no lazy binding and no later resolution.
|
||||
4. **Enter:** an entry is made for each export, as `(HEADER)` makes one, and the kernel is told
|
||||
(`(WORD-DEFINED)`). The word accounts, the ACL fields and the defaults of §3 apply from here.
|
||||
|
||||
This is the work FORTH's compiler already does when it compiles a reference to a word. It is done here
|
||||
from records, not from source. It is not dynamic linking in the ADR's sense: there are no shared libraries,
|
||||
no lazy binding, no global address space and no linker running beside the program.
|
||||
|
||||
## 6. Activation and retirement (ADR §4)
|
||||
|
||||
**A replacement** is a newer capsule exporting a word of the same name. Its identity differs, because its
|
||||
capsule hash differs. Activation must make the code that calls the old word reach the new one. The call
|
||||
sites compiled into other definitions hold the old address (§2). Choice 5 is how they reach it.
|
||||
|
||||
**A safe boundary** is a heartbeat at which no node is inside the old word: no return address into it is
|
||||
on any return stack, and no message for it is waiting. Choice 6 is how that is known.
|
||||
|
||||
**Retirement:** the old code is freed only when nothing can reach it. Until then both versions coexist
|
||||
(ADR §4).
|
||||
|
||||
**Rollback** is activating the old one again, as long as it is not retired. Artemis keeps the staged and
|
||||
recovery copies (ruling 3).
|
||||
|
||||
## 7. Compatibility
|
||||
|
||||
**A replacement is compatible** when, for every word the old artifact exported:
|
||||
- the new one exports a word of the same name;
|
||||
- with the same stack effect;
|
||||
- needing no capability the old did not.
|
||||
|
||||
Anything else is incompatible, and activation is refused. A verified artifact is not compatible because it
|
||||
is verified (ADR §5); compatibility is checked against the old artifact's records.
|
||||
|
||||
## 8. What stays as it is
|
||||
|
||||
- POST, the protocol, and CI's gates (ADR §7).
|
||||
- Source capsules and the boot as it is: the ROM still assembles the system at boot (ruling 1).
|
||||
- The ACL's check at call, and the word accounts: an artifact's words are words like any other.
|
||||
- Messages between nodes.
|
||||
|
||||
**Captain Bob's image, 2026-11-19:** "the .f18 assembler assembles all .f18 files it finds. Now here's a
|
||||
thought. That 'assembled' code can be the 'engine' for a train of named blobs as metaphorically rolling
|
||||
stock." Ruled "One train per capsule" (§1).
|
||||
|
||||
**The rail yard: the SDK and CI's model** (Captain Bob, 2026-11-19, recorded as given; nothing built):
|
||||
> "When we build the SDK, we can naturally think of a railroad yard for staging outgoing artifact capsule
|
||||
> 'trains' from first order preexisting 'cars' prior to writing new ones.. That would be the model and on
|
||||
> the CI side we can use messaging as semaphores in our staging yard with inbound and outbound trains and
|
||||
> the artifacts are the persistent part. Signed, sealed and versioned."
|
||||
|
||||
Read here as:
|
||||
- **The yard stages trains.** An outgoing train is made up first from cars that already exist, which are
|
||||
first-order and already built. New cars are written only for what is missing.
|
||||
- **In CI, messages are the semaphores.** They signal inbound and outbound trains through the yard: what
|
||||
may move, and when.
|
||||
- **What persists is the artifacts:** signed, sealed and versioned. The yard's moves are transient.
|
||||
|
||||
It ties in `(-`, the build marker that asks CI to clear a block for the next image (`plans/2026-11-18-
|
||||
capsule-blocks.md` §5), and Artemis keeping what is kept (ruling 3).
|
||||
|
||||
## 9. Open, for ruling one at a time
|
||||
|
||||
1. ~~Where artifacts come from~~ **Ruled 2026-11-19: "A host tool".** A C tool beside `mkcapsule` compiles
|
||||
`.f18` to artifacts on the build machine. It is a second assembler beside the ROM's, so the two must
|
||||
agree: the tool's output is checked against what the ROM assembles from the same source, cell for cell,
|
||||
in the build and in CI. The compiler's identity in the provenance record is the tool's own hash.
|
||||
The cell-for-cell check was added in drafting; confirmed by Captain Bob, 2026-11-19 ("Yes").
|
||||
2. ~~The stack-effect declaration~~ **Ruled 2026-11-19: "Derived by the tool".**
|
||||
- A first answer, "the ( -- ) comment, strict", was withdrawn the same day. Captain Bob: "I think I may
|
||||
have made a bad assumption. I had the idea of that after (- was aliased to ( is for SDK special. We're
|
||||
working on something more fundamental."
|
||||
- **There is no declaration in the source.** The host tool computes each exported word's stack effect
|
||||
from its compiled code, by static analysis of the F18 opcodes, and records it in the artifact. The
|
||||
proofs check it. Comments stay comments.
|
||||
- **2c, ruled 2026-11-19: "Refused as an export".** A word whose effect depends on its data (a loop
|
||||
leaving a count of values, branches that leave different depths, `EXECUTE`, a `DEFER`red word) has no
|
||||
fixed count. It cannot be exported by an engine: it stays internal to its train, or is restructured.
|
||||
Every export has a fixed effect, derived by the tool; a word with none stays internal, and the build
|
||||
does not fail for it (`plans/2026-11-19-f18-artifact-build.md` §6.4). *Corrected 2026-11-19: this
|
||||
said "which the tool derives and the build fails without".*
|
||||
3. ~~What a capsule carries~~ **Ruled 2026-11-19: "No, by reference".** A train's engine carries only the
|
||||
hash of the `.f18` source it was assembled from, in its provenance record. The source stays in the
|
||||
repository and in its own capsule. To check an engine against its source, the source is fetched by
|
||||
that hash.
|
||||
4. ~~Imports by capsule hash~~ **Ruled 2026-11-19: "Exact hash".** An import names the exact build of
|
||||
the train it imports from: (its capsule hash, the word's name). If that train is rebuilt or updated,
|
||||
its hash changes, so its importers are rebuilt too, and a live update replaces the whole dependent set
|
||||
of trains together. Placement refuses an import whose hash is not present.
|
||||
**Ruled 2026-11-19 (step 3, `plans/2026-11-19-f18-artifact-build.md` §10.4):** a train's hash is its
|
||||
`.f18a`'s capsule ID. The nucleus has none, so a word imported from it has hash 0 and is resolved by name
|
||||
in the node's dictionary at placement; exact hashes hold between artifact trains only.
|
||||
5. ~~How callers reach a replacement~~ **Ruled 2026-11-19: "Jump at the old entry".** At activation, each
|
||||
replaced word's first code cell, at its xt, is overwritten with a `jump` to the new word: one cell per
|
||||
word, and every caller, compiled at run time or not, follows at once. The old code stays in place,
|
||||
unreachable but for that cell, until it is retired. The new word must be within the jump's reach from
|
||||
the old entry (27 bits in slot 0, which covers a node's memory), or activation is refused.
|
||||
6. ~~The safe boundary~~ **Ruled 2026-11-19: "Scan at a heartbeat".** At a heartbeat tick the kernel
|
||||
scans every node's P and return stack for an address inside the old words' code. When none is there, it
|
||||
writes all of a set's jumps in that one tick. While some are there, it tries again on later ticks. A
|
||||
message waiting for an old word is not code on a stack and does not hold the set back: the word it
|
||||
reaches is the new one. That last point was added in drafting; confirmed by Captain Bob, 2026-11-19
|
||||
("Yes").
|
||||
7. ~~Proofs first~~ **Ruled 2026-11-19: "Safe activation first".** The first Isabelle/HOL property:
|
||||
- the jump at each old entry is written only at a tick when no node's P or return stack holds an address
|
||||
inside the old code (choice 6);
|
||||
- after it, every call to an old word, from any caller, reaches the new word.
|
||||
|
||||
Placement's checks, compatibility and the soundness of the derived stack effects come after.
|
||||
|
||||
## 10. Status
|
||||
|
||||
All seven choices are ruled, plus 2c (no fixed effect means no export). This draft is the minimal ABI
|
||||
contract, the ADR's step 1, as ruled.
|
||||
|
||||
The next step is the ADR's step 2, the artifact representation in detail: the exact cell layout of §4's
|
||||
records, a design for ruling before any code.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user