Commit Graph
2 Commits
Author SHA1 Message Date
CUBELinux build 3ee59dafff CUBELinux.0.6: cube(2) — the coordinate interface
The write path was proven but unreachable: its operations lived behind a device
node. This is the interface the decision chose (DESIGN-cube-interface.md) — one
syscall number, an opcode, and a versioned argument block, with operations that
are the verbs the command language already defines: put, get, del, sync.

  long cube(unsigned int op, struct cube_args __user *args)

`size` comes first and is checked, because syscall numbers are permanent and an
interface that cannot grow would have to be replaced. A coordinate is the space and
its three axes; nothing here resolves a name and nothing enumerates.

Split deliberately: the entry point, the user copies and the argument validation are
in C (cube_syscall.c) because `SYSCALL_DEFINE*` is a C macro this kernel has no Rust
equivalent for; everything that touches the store's bytes is in Rust, which passes
the coordinate to the format code as its parts so that Morton encoding stays in the
one module that must get it exactly right. A read that does not fit returns the size
it needs rather than truncating — a short read would be worse than an error.

Number 548: the x86_64 table says numbers 548 and above are available for
non-x32 use.

Gate (kernel/verify-syscall.sh): a static client in the initramfs does four writes
(including an empty value and a second space), reads one back *through the same
interface*, and folds with `sync`. Three different failures are separated — the
calls failing (a broken ABI), a read not returning what a write stored (a wrong key
encoding or index), and the folded image differing (a wrong format, order or merge).

  put 7,0,0 ok (21 bytes)
  put 8,0,0 ok (0 bytes)
  put 9,0,0 ok (28 bytes)
  put 1,2,3 ok (13 bytes)
  get 7,0,0 21 bytes: the kernel wrote this
  sync ok

and the image left on the device is byte-identical to the one userspace writes from
the same mutations, with the log empty. The interface's store is the same store.

All nine gates pass on 0.6.
2026-09-18 22:18:18 -04:00
CUBELinux build cee3e554d9 CUBELinux.0.2: the kernel reads the CUBE store off a block device
The first CUBE code in the kernel, and deliberately only a reader: the write
authority has not moved yet, and PLAN-kernel-cubelinux.md records both that
decision and the hazard that makes the order matter — a kernel writing while a
userspace daemon still holds the same image loses one of the two writers' work,
silently. A reader cannot do that.

- drivers/cube/: a Rust module exposing /dev/cubelinux. Reading it reads the
  pinned image from the block device through the kernel's own file layer
  (filp_open + kernel_read — the path this kernel version binds for Rust, and
  the reason no C helper was needed), parses the records, and returns one line:

    digest curve=0 bytes=8400896 records=35318 value_bytes=6139148 fnv1a64=5e20f98455387b08 errors=0

  The work happens on read, not at init, so there is no initcall ordering to get
  wrong against the block driver that provides the device.

- The format is restated in the kernel (32-byte space, 24-byte key, 8-byte LE
  length, value), including the two rules the userspace parser documents: a value
  that runs past the buffer is a truncated record, and an all-zero frame ends the
  records only when every remaining byte is zero — the rule that keeps a real
  record at the origin from being read as padding.

- The digest is the point. A record count alone lets two different images agree;
  folding the bytes in means the kernel and userspace are *compared* rather than
  assumed to agree. `cube-image digest` prints the same line in the same field
  order, and the QEMU gate fails if they differ by a byte.

Gate, on both images:
  curated  11 records,      4,096 bytes, fnv1a64=161113085b1573b2  — match
  snapshot 35,318 records, 8,400,896 bytes, fnv1a64=5e20f98455387b08 — match

The tree carries CONFIG_CUBELINUX_STORE=y on top of defconfig + RUST; a tree
without it boots and simply has no /dev/cubelinux.
2026-09-18 20:22:02 -04:00