Skip to content

kernel: make ProcessTable the sole task identity authority#979

Open
brandonpayton wants to merge 1 commit into
mainfrom
fix/kernel-owned-task-identity-abi42
Open

kernel: make ProcessTable the sole task identity authority#979
brandonpayton wants to merge 1 commit into
mainfrom
fix/kernel-owned-task-identity-abi42

Conversation

@brandonpayton

Copy link
Copy Markdown
Member

Why

Kandelo process and thread identities must come from authoritative kernel state. PR #966 removed one top-level spawn race, but the host still retained a JavaScript PID counter, selected process identifiers, and passed them into Rust. Thread-channel registration likewise accepted numeric thread identifiers from host callbacks. That split authority could create collisions or attach host transport state to the wrong task.

The Rust ProcessTable should be the only allocator and dispenser of process identifiers (PIDs) and thread identifiers (TIDs). Hosts should only consume identifiers returned by the kernel.

What changed

  • Allocate every top-level process, fork child, posix_spawn child, and pthread TID from one monotonic ProcessTable sequence; PID 1 remains the synthetic init process.
  • Introduce capability-based task identity construction and make process identity and thread-group membership immutable.
  • Return allocated identifiers from kernel creation operations and remove host-side allocators, watermarks, and caller-selected identities.
  • Validate exact task bindings and make clone channel attachment one-shot.
  • Update lifecycle, signal, wait, and exec paths to preserve the single-authority invariant.
  • Keep the Node.js and browser hosts on the same worker protocol.
  • Bump the incompatible host/kernel contract from ABI 41 to ABI 42 and update generated ABI evidence, libc fork-child state refresh, package harnesses, tests, and documentation.

Validation

Run on this PR head:

  • scripts/dev-shell.sh bash scripts/ci-run-test-suite.sh cargo-kernel — 1,202 tests passed.
  • scripts/dev-shell.sh bash scripts/check-abi.sh — ABI snapshot, C header, TypeScript bindings, and ABI_VERSION are consistent.
  • Focused host Vitest suites for spawn authority, clone authority, host parity, process/wait lifecycle, and Node teardown ordering — 74 tests passed.
  • git diff --check — passed.

Run on the equivalent pre-restack code before the documentation-only conflict resolution:

  • Full host Vitest — 1,548 tests passed; one package-artifact test timed out in the full run and passed alone in 3.2 seconds.
  • Chromium browser CI — 49 passed, 5 intentionally skipped.
  • Cross-browser suite — 57 passed.
  • Rust documentation compile enforcement — 6 passed.
  • musl rebuild — completed successfully.

The full libc, POSIX, and Sortix conformance suites and manual ./run.sh browser verification were not run.

ABI and artifacts

This is an incompatible ABI 42 transition. Existing kernel packages, programs, and VFS images must be rebuilt and published through the normal ABI release path. This change intentionally does not add a compatibility shim for ABI 41 artifacts.

Allocate every top-level process, fork child, spawn child, and pthread TID from one monotonic Rust ProcessTable sequence. Remove host-selected identity APIs, validate exact task/channel bindings, and make process/thread identity construction capability-based.

Bump the incompatible host/kernel contract to ABI 42, update libc fork-child state, host adapters, package harnesses, generated ABI evidence, documentation, and Node/browser regression coverage.
@github-actions

Copy link
Copy Markdown

Phase B-1 matrix build status — pr-979-staging

ABI v42. 71 built, 0 failed, 71 total.

Package Arch Status Sha
icu wasm32 built c3be8b38
libcurl wasm32 built 3ca49a27
libcxx wasm32 built 84f474c8
libcxx wasm64 built aa65876d
libiconv wasm32 built 4679d9f9
libpng wasm32 built d9d70b09
libxml2 wasm32 built f9ee5238
libzip wasm32 built 474655ff
openssl wasm32 built 2bc83c2a
openssl wasm64 built d0e14beb
sqlite wasm32 built 62e57ce0
sqlite wasm64 built ec44ee5d
zlib wasm32 built a4795fce
zlib wasm64 built 5b8b74f5
bc wasm32 built b3c85d98
bzip2 wasm32 built 9b236419
coreutils wasm32 built a2c25f4a
curl wasm32 built 181dfa78
dash wasm32 built 528d8154
diffutils wasm32 built 3a9f570e
dinit wasm32 built b4804903
fbdoom wasm32 built fb4f11cf
file wasm32 built 2350e713
findutils wasm32 built f902f30a
gawk wasm32 built f09ed1bf
git wasm32 built a0b8c426
grep wasm32 built fdc0e908
gzip wasm32 built 2d7a4acd
hello wasm32 built 484451f8
kandelo-sdk wasm32 built b689e510
kernel wasm32 built c540fd98
less wasm32 built 494d36b0
lsof wasm32 built b470771f
m4 wasm32 built 0f442d94
make wasm32 built 0734de42
mariadb wasm32 built 929eed6a
mariadb wasm64 built 0e20857d
modeset wasm32 built 5845e800
msmtpd wasm32 built 6fb3d8d7
nano wasm32 built e2503717
ncurses wasm32 built 4d410941
netcat wasm32 built 51ee2dd8
nginx wasm32 built 40dd007a
php wasm32 built 4db9b8be
posix-utils-lite wasm32 built bb45d861
ruby wasm32 built 2e575709
sed wasm32 built 375b5e4c
spidermonkey wasm32 built 7e9dc2a0
tar wasm32 built 6616c692
tcl wasm32 built 318f8daa
unzip wasm32 built b7c2351b
userspace wasm32 built 8485c073
vim wasm32 built 40189e7e
wget wasm32 built 26bc158c
xz wasm32 built e72c461d
zip wasm32 built 6ded321c
zstd wasm32 built 63d7ed99
bash wasm32 built e089fa28
mariadb-test wasm32 built e9147224
mariadb-vfs wasm32 built 198719db
mariadb-vfs wasm64 built 0ecc96f2
nethack wasm32 built e15aea37
node wasm32 built d7671179
spidermonkey-node wasm32 built d6a40d3d
vim-browser-bundle wasm32 built 3757c205
nethack-browser-bundle wasm32 built 7d5d286f
rootfs wasm32 built b38fe87d
shell wasm32 built e0fc80cc
lamp wasm32 built 79bce7b8
node-vfs wasm32 built 5cff1d67
wordpress wasm32 built 95380b6f

Auto-generated; replaced on each push. Raw data in the publish-status workflow artifact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant