Four bugs found live verifying the 8 identity thumbdrives (FABRIC-3.md §IX)
All found by actually running the identity workflow §VII/§VIII made possible, not by code review: 1. Zuse/WIREBIND cross-contamination on detach: capsule_zuse_boot_logout() and capsule_wirebind_unclean_detach() both had no device parameter, so an unrelated device detaching (while the real owner's own stayed attached) incorrectly tore down the wrong session. Both now compare the departing device against their own tracked one, mirroring capsule_wirebind.c's pre-existing g_wirebind_attached_dev precedent. 2. Dictionary-entry memory leak: vm_create_word()'s sf_malloc()'d DictEntry (plus a second per-entry allocation for transition_metrics) was never freed by vm_cleanup(), in both the hosted and kernel implementations. Caused a real kernel PANIC after 8-9 repeated VM birth/kill cycles in one boot. Fixed by walking vm->latest in both. 3. sf_malloc/sf_free (alloc_kernel.c) was a 4MB bump arena with a deliberate no-op free, sized on "VM born once, never killed" -- fix #2 alone didn't stop the panic because free() itself discarded the pointer regardless. Given a real free list (first-fit reuse). 4. Headless-console gate didn't re-engage after a mid-boot logout: the original fix (sk_console_mark_login(), one-way sticky) only gated the first login of the boot. Replaced with a live check (sk_console_identity_present()) re-evaluated continuously, including inside sk_console_readline()'s own blocking idle loop -- the console is normally sitting blocked there when a hot-unplug logout happens, so checking only at the top of the REPL loop wasn't enough. Also: MINT now verifies its own write (verify_mint(), capsule_mint.c) by reading back through the same check a real attach performs, rather than trusting blkio_write()'s BLK_OK alone -- logged via log_message(), not console_println(), per direct instruction. Verified live, amd64: the full 8-identity repeated attach/detach cycle that previously panicked at the same point every time now completes clean, and a full serial-log sweep found zero bare unauthenticated prompts anywhere in the run. Three-arch clean-qemu acceptance passed. Still open, not fixed here: a 3+-simultaneous-device USB enumeration failure found in a separate live test, not yet root-caused. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018EjXFo7mPXjUMjfJeuUUz4
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
0bae928aad
commit
2c1b3cd695
+25
-31
@@ -131,46 +131,40 @@ int sk_console_key_available(void);
|
||||
* prompt line is their own (shim.c's fgets(), i.e.
|
||||
* QUERY/EXPECT/ACCEPT) pass 0 so "ok> " never gets stamped
|
||||
* onto their mid-word input context.
|
||||
* @return number of characters placed in buf, not counting the NUL
|
||||
* @return number of characters placed in buf, not counting the NUL, or -1
|
||||
* (2026-09-06) when reanchor_prompt is nonzero and the attached
|
||||
* identity logged out while this call was blocked waiting for
|
||||
* input with nothing typed yet -- see repl.c's own doc comment
|
||||
* on this function for what a caller must do with -1.
|
||||
*/
|
||||
int sk_console_readline(char* buf, int size, VM* active_vm, int reanchor_prompt);
|
||||
|
||||
/**
|
||||
* sk_console_mark_login - Record that a real identity has logged in via an
|
||||
* attached thumbdrive, decided in conversation 2026-09-05: no console for
|
||||
* the running system unless a thumbdrive is present -- headless until the
|
||||
* first successful login, regardless of which path performs it (a regular
|
||||
* user's WIREBIND console-VM birth, capsule_wirebind.c, or Zuse's own
|
||||
* attach/genesis-mint, capsule_zuse_boot.c). Both call this on their own
|
||||
* success path; neither is treated as special here, per direct instruction
|
||||
* ("nothing special about zuse as a user except zuse has no ACLs") --
|
||||
* this is one shared signal, not a Zuse-specific carve-out. Idempotent
|
||||
* (a second login, e.g. a second WIREBIND user later, is a harmless no-op).
|
||||
*/
|
||||
void sk_console_mark_login(void);
|
||||
|
||||
/**
|
||||
* sk_console_login_occurred - Whether sk_console_mark_login() has ever
|
||||
* been called this boot. Read by sk_repl_headless_wait()'s own exit
|
||||
* condition; exposed publicly for anything else that needs to know
|
||||
* whether the console is unlocked yet.
|
||||
*/
|
||||
int sk_console_login_occurred(void);
|
||||
|
||||
/**
|
||||
* sk_repl_headless_wait - Idle-service loop with no interactive surface
|
||||
* at all: no banner, no prompt, no console_getc()/readline. Runs
|
||||
* heartbeat_service() and the same SK_IDLE_BEAT_INTERVAL-gated
|
||||
* sk_repl_idle(mama) cadence sk_console_readline()'s own idle branch
|
||||
* uses -- so USB/WIREBIND/Zuse-attach detection, the heartbeat, and all
|
||||
* other idle-tick subsystems keep running -- until sk_console_login_
|
||||
* occurred() becomes true, at which point it returns. Called from
|
||||
* kernel_main.c in place of an immediate sk_repl(mama) call when
|
||||
* EMERGENCY_CONSOLE_ENABLED is off (the new default, 2026-09-05): no
|
||||
* thumbdrive, no prompt, per direct instruction. When
|
||||
* EMERGENCY_CONSOLE_ENABLED is on (the debug/recovery escape hatch),
|
||||
* kernel_main.c skips this and calls sk_repl(mama) immediately instead,
|
||||
* exactly as before this change.
|
||||
* other idle-tick subsystems keep running -- until a real identity is
|
||||
* currently attached (Zuse's own session, or a WIREBIND user), at which
|
||||
* point it returns.
|
||||
*
|
||||
* Revised 2026-09-06: originally exited on a one-way sticky "has anyone
|
||||
* ever logged in this boot" flag (sk_console_mark_login()/sk_console_
|
||||
* login_occurred(), both retired) -- that let a real gap through, found
|
||||
* live: once the flag tripped once, it never reset, so a later full
|
||||
* logout (nobody attached at all) fell through to a bare, unauthenticated
|
||||
* prompt instead of going silent again. This now checks live attach
|
||||
* state instead (repl.c's own sk_console_identity_present()), and is
|
||||
* called from two places: once from kernel_main.c in place of an
|
||||
* immediate sk_repl(mama) call when EMERGENCY_CONSOLE_ENABLED is off (the
|
||||
* default, 2026-09-05) -- no thumbdrive, no prompt, at boot -- and again
|
||||
* from inside sk_repl_run()'s own main loop, every time nobody is
|
||||
* currently attached, so the same silence re-engages after any later
|
||||
* logout mid-boot too. When EMERGENCY_CONSOLE_ENABLED is on (the debug/
|
||||
* recovery escape hatch), neither call site applies -- the console shows
|
||||
* immediately and stays visible regardless of attach state, exactly as
|
||||
* before this change.
|
||||
*
|
||||
* @param mama Hera's own VM instance -- the idle-dispatch target,
|
||||
* same as every other sk_repl_idle() caller uses.
|
||||
|
||||
Reference in New Issue
Block a user