A new *noconscreen= plan9.ini flag keeps putstrn console output off the
display while the serial console stays live, so the GUI profiles boot
from firmware into the rendered Rill desktop with no kernel or rc text
on screen; panics still reach the display. Text-mode boots keep the
screen console. desktop-boot-smoke passes on the rebuilt kernel
(1024x768 rendered-desktop assertion).
The status and windows-plan documents record this revision: trixie
namespace with Wine 10, the linuxrun epoll fix that stopped the X
server spin, and the refined wine rfork reading (thread children
inherit SG_SHARED segments via sameseg; the fault is inside the
rfork-from-note-context itself and still wants the live kernel
debugging round).
fetch-debian.sh (was fetch-xfce.sh) and fetch-wine.sh take SUITE and
default to trixie: Xvfb/xterm/x11-apps/dash/nano base with the Xfce
remnants dropped, and Wine 10 (wine, wine32, libwine) preinstalled
from trixie i386. Text Editor launches nano in xterm because trixie
no longer ships xedit; the matrix follows. debian_version records the
real suite (13.7) while os-release keeps the TaijiOS identity.
QEMU runs under nice -n 19 (Q9_QEMU_NICE= to disable) so development
boots do not compete with real work. The kryon smoke regenerates
kryon's build/plan9 (k2c runtime modules, embedded assets, icon
tables) on the host before booting, raises its timeout for the larger
library build, probes the current theme catalog, and the workflow
initializes utf8proc beside raylib.
The wire selftest now runs under a 30-second alarm so an unanswered
request ends the test instead of hanging the boot, and the unified
smoke retries it once: trixie's Xvfb intermittently drops the
selection dance under churn (traced to the epoll spin, fixed
separately), and one retry separates the residual flake from real
clipboard damage.
Connected bridge sockets returned EPOLLOUT on every epoll_wait scan
regardless of the registered mask, so any IN-only watch produced a
spurious event per poll. Xorg's main loop woke continuously and the
emulated Xvfb burned a full CPU doing nothing (700+ epoll_wait traces
in a 25-second soak). Report EPOLLOUT only when the registration
includes it; EPOLLIN stays data-driven as the dbus fix requires.
After the change the same soak logs three epoll_wait traces.
Verified against the bookworm wine32 package contents: Debian ships no wine-preloader (only wine, wineapploader, wineserver32), so the probe trace exec failure of wine-preloader followed by the direct wine exec is normal. The frontier remains the round-18 rfork fault.
Checked against sys/src/libc/9syscall/sys.h: the faulting stub loads RFORK, the clone dispatch own rfork call executed from note-handler context, faulting on a read of the guest stack inside the Stackbase segment. The documented mechanism hypothesis (int80 note state referencing guest sp, child fork-rebuild detaching the stack segment) requires live kernel debugging to confirm and fix.
The crash-report guest-stack dumps now check guestok first, so the diagnostic itself can no longer mask the underlying fault (verified: the wine probe now dies at the real fault, not in the dump). The faulting native stub decodes to syscall 19 (stat or rfork depending on the table indexing) - a native call receiving a guest stack pointer from a context where the segment is absent; the fork-rebuild copy loop is the documented prime suspect for live debugging. Verified: taiji-linuxrun-smoke-ok, taiji-unified-smoke-ok.
loadelf now prints (capped) the entry point, program-header count, and every LOAD segment vaddr+memsz for each loaded image, so an exec whose segments target unmapped guest memory is identifiable before it kills the process. Measured with the wine display probe: every image layout is sane (ld.so at 0x68000000, the X-transport helper at 0x7d000000); the 0xdfff GUESTPTR reads belong to an earlier phase and the final fault at 0x6001d874 is a native-syscall read of a parent-mapped region from a context where the segment is absent - the remaining investigation for a live kernel-debugging session. Verified: taiji-linuxrun-smoke-ok, taiji-unified-smoke-ok.
The execve argument copy now backs the argv/env region (and each string) on demand, so Wine execs with stacks in its 0xdfff reservation area no longer read unmapped memory during the copy. Measured: the GUESTPTR traces persist and are now understood as ELF LOAD vaddr targets at 0xdfff from loadelf readat - the exec path is loading an image whose phdrs land there, so the next increment is validating and tracing execpath plus program headers in sysexecve before loadelf runs. Verified: taiji-linuxrun-smoke-ok, taiji-unified-smoke-ok.
Round 14 of the Wine path:
- readat now validates its guest buffer against the mapped segments
and names unmapped pointers (GUESTPTR) instead of dying silently -
the round-13 decoded stub is now attributable.
- Clone children with a requested thread stack (CLONE_SETTLS path)
back the stack region on demand (ensurestack) from the post-rfork
context: Wine creates threads with stacks anywhere in its reserved
area (observed at 0xdfff0000), outside every segment.
- Measured with the diagnostics in place: Wine's own guest stack sits
in the 0xdfff region and reaches readat during exec-argument copying
in a forked child before any backing exists - the GUESTPTR traces
pin it. The next increment is to back that region at fork/exec
entry (the same ensurestack treatment at the copyguestenv call
sites), after which the argument copy succeeds.
Verified: taiji-linuxrun-smoke-ok, taiji-unified-smoke-ok (default
memory).
The faulting pc 0x13fdf disassembles from the binary to mov eax,0x13; int 0x40 - a native Plan 9 syscall stub receiving a guest pointer whose segment is absent. The windows application plan records this and redirects the next increment to validating guest pointers at the native call sites (file readat, socket paths, exec/fork child re-attach ordering).
The clone/fork child block re-attaches the opt-in low segment right
after rfork - the post-rfork context is the one where registernotestack
and atnotify already succeed, and Wine's clone children run low-address
code immediately. Gated by LINUXRUN_LOW as before, so nothing changes
for ordinary guests.
Measured: the display probe's next fault is unchanged (a guest-stack
read at 0x6001d874 from pc inside linuxrun's early child path, before
the note handlers are registered - FAULTCODE stays silent for it). The
windows application plan records this as the next investigation: the
fault lands in the pre-atnotify window of the exec/clone child.
Verified: taiji-linuxrun-smoke-ok, taiji-unified-smoke-ok (default
memory, no opt-in).
Round 11 of the Wine path:
- segattach from the trap handler always fails ("virtual memory
allocation failed") regardless of size - the low segment now attaches
at the initial load, outside note context. This is also why every
in-syscall attach attempt failed in earlier rounds.
- Low guest memory [0x200000, 0x8000000) (the notestack's shared
segment sits at 0x8000000) enables Wine's low fixed mappings; with it,
under Q9_MEM=2G and LINUXRUN_LOW=1, the notepad probe shows Wine
executing code at low addresses - the furthest yet - before the next
fault (a stack-region read, consistent with the documented
notestack-missing failure mode when Wine's signal_init ordering is
still pending).
- The eager attach is opt-in (LINUXRUN_LOW in the host environment):
attaching it unconditionally destabilized ordinary guests - the
unified smoke's Xvfb child died with note-stack pointers leaking into
syscalls (0xdeffef24/220, matching the round-3 signature). The wine
display probe opts in; every other path is unchanged, verified by
taiji-unified-smoke-ok with taiji-unified-cleanup-ok and
taiji-linuxrun-smoke-ok at the default memory size.
The notepad probe with signal delivery in place surfaced Wine's real
next requirement and two genuine bugs:
- virtual_init builds its views area from many small fixed mappings at
low addresses (0xe40000 onward); linuxrun's mmap only accepted
[0x40000000, +512MB). Giant anonymous PROT_NONE mappings (256MB+) are
now recorded as virtual reservations materialized by mprotect, and a
low-memory segment attaches on demand for low fixed mappings (fork
children reset the flag; segments do not survive rfork).
- mprotect no longer zeroes its target unless it was a recorded
reservation: the first cut wiped loaded libraries - libc's version
tables - breaking every dynamic program with 'undefined symbol: free'.
Caught by the unified smoke before shipping; re-verified clean.
- Measured limit recorded in the windows application plan: the 1GB VM
cannot host a second large segment next to the 512MB main guest
segment (every size from 1GB to 127MB fails segattach); the next step
is more VM memory or one segment spanning both regions. Wine now
exits cleanly instead of crashing.
Verified: taiji-linuxrun-smoke-ok; taiji-unified-smoke-ok with
taiji-unified-cleanup-ok (an initial flaky xbridge snapshot failure did
not reproduce on retry).
Implements the subsystem the decoded Wine fault requires:
- rt_sigaction (174) records each signal handler and restorer instead
of discarding them; registrations are traced (SIGACTION).
- Trap-class faults now deliver SIGSEGV to a registered handler by
building an i386 rt_sigframe on the guest stack (pretcode doubling as
the handler return address, sig/pinfo/puc as its stack arguments,
128-byte siginfo, ucontext with the full register set, and the
popl/movl $173/int $0x80 trampoline), then resuming the ureg in the
handler.
- rt_sigreturn (173) restores the frame context after the dispatcher,
including a redirected pc when the handler dispatched a thunk.
Measurement: the wine notepad flow still faults before Wine registers
any SIGSEGV handler (only SIGABRT/default passes through), so the next
investigation is the ordering between wine signal_init and the first
hlt thunk — possibly inside the forked wineserver child; SIGACTION
tracing is in place for it.
Verified: taiji-linuxrun-smoke-ok, taiji-unified-smoke-ok with
taiji-unified-cleanup-ok.
The corrected full-log probe (cat, not tail) shows traphandler running
and FAULTCODE firing; the earlier never-reaches-handlers claim was a
tail-truncation artifact. The faulting instruction at pc=0x4082531a is
hlt (0xF4): Wine i386 uses deliberate privileged faults as dispatch
points and services them from SIGSEGV handlers registered via
rt_sigaction, which linuxrun stubs without bookkeeping. The windows
application plan now specifies the prerequisite subsystem precisely:
rt_sigaction recording, i386 rt_sigframe construction with siginfo,
ucontext, mask, and the rt_sigreturn trampoline, and rt_sigreturn
context restore.
Verified: taiji-linuxrun-smoke-ok.
An unconditional, capped print at the top of traphandler stays silent
while the forked wine child dies with the general-protection violation:
the trap note is swallowed by the foreign-process note-delivery path
before any atnotify handler runs, so FAULTCODE cannot observe it. The
windows application plan now names the prerequisite fix precisely
(kernel postnote/notify handling for up->foreign processes, or the
child note-stack re-registration in registernotestack).
Verified: taiji-linuxrun-smoke-ok.
The earlier commits in this series staged modified tracked files plus a
handful of new paths; several new files that the committed binaries and
mkfiles depend on were never added and remained untracked local work:
- sys/src/cmd/xbridge: the complete bridge sources (xbridge.c, x11.c,
x11.h, mkfile) — the installed binary was committed without them.
- sys/src/cmd/rio9/overlay.c: the desktop overlay implementation the
window server builds.
- sys/src/cmd/linuxrun/environment.{c,h}: required by the committed
mkfile (environment.$O).
- doc/unified-desktop.md and doc/unified-desktop-status.md: the desktop
notes and status/plan pages all session commits refer to.
- rc/bin/linux-app: the Debian application launcher.
- cfg/q9 probe scripts from the D-Bus/XFCE debugging sessions
(gtk-probe, kbuild-test, xfce-bisect, xfce-min, xfce-shot series)
referenced by the status history.
Also records this round's verifications: the desktop renders at both
1024x768 and 1280x1024, and the legacy-reference sweep is clean.
- cfg/q9/wine-display-probe.rc drives notepad against a live Xvfb
display and captures the X screen through xbridge: Xvfb starts, wine
stays alive through startup, and Wine's PE initialization proceeds
until a child faults with a general-protection violation at
pc=0x4082531a — the new measured frontier, recorded in the windows
application plan.
- linuxrun's note handler now dumps the instruction bytes around any
faulting pc inside the guest image (FAULTCODE), so the next session
can decode and emulate the exact instruction instead of guessing.
Verified: taiji-linuxrun-smoke-ok after the changes; the display probe
completed with Xvfb ready, a captured X screen, and the fault recorded.
Wine 8.0 now runs through the syscall translation layer: wine --version
prints, ntdll.so loads, and the notepad process survives startup. The
measurements that got there, in order:
- statx (383): all argument forms — absolute, AT_FDCWD, dirfd-relative
via /proc/pid/fd, and AT_EMPTY_PATH with the flags argument in its
correct (third) position; ld.so's library search completes with it.
- readlink/readlinkat answer /proc/self/exe and /proc/<pid>/exe with the
guest-visible executable path, absolute paths only: relative native
invocations keep the realpath-compatible answer so busybox-style
multi-call binaries still fall back to argv[0] (caught by the
linuxrun regression before it could ship).
- /proc/self is rewritten to /proc/<pid> for stat64/lstat64/fstatat64/
statx/access because the native /proc has no self entry and Wine's
realpath probes every component.
- faccessat (307) and faccessat2 (439) implemented for ntdll's path
verification.
Verified: taiji-linuxrun-smoke-ok (full regression after each change),
wine --version output, notepad liveness probe.
Track 4 groundwork, measured end to end:
- scripts/fetch-wine.sh stages Debian bookworm's i386 wine, wine32, and
libwine closure (115 packages) into the Debian root, following the
fetch-xfce.sh staging pattern.
- cfg/q9/wine-measure.rc drives Wine through linuxrun and captures each
stage; classic rc lacks break/head, so the probe guards its loops and
uses sed.
- linuxrun implements statx (i386 nr 383): absolute paths, AT_FDCWD,
dirfd-relative through /proc/pid/fd, and AT_EMPTY_PATH with the flags
argument in the right position. Wine's ld.so dependency search and
libc/libwine loading now complete; the measured frontier is Wine's own
ntdll.so load, which needs dynamic-loader TLS support.
- The windows application plan and status page record the measured
stage table and the next implementation target.
Verified: taiji-linuxrun-smoke-ok (no regression from statx), wine
measurement logs in the session evidence.
- rio9: the desktop surface may synthesize keyboard input through
/dev/kbdin, like the simulated keyboard window; ordinary applications
still may not.
- window smoke now injects the Ctrl+Tab chord (Kctab) and asserts focus
cycles to the next window through the taskbar activation path.
- xbridge: a title-bar minimize control hides the window through wctl;
the taskbar and Ctrl+Tab restore it.
- linux-app prints progress dots while the private display starts.
- unified smoke asserts no linuxrun, xbridge, or Xvfb processes survive
teardown (taiji-unified-cleanup-ok).
- Groundwork for the remaining plan: windows-application-plan.md records
the representative application (Wine notepad), requirements, and
measured blockers; the 64-bit architecture decision and the application
isolation policy are recorded in the desktop notes and status page.
Verified: taiji-window-smoke-ok (with the chord test), taiji-unified-
smoke-ok with taiji-unified-cleanup-ok.
Completes the one-desktop integration and adds the everyday-use features
from the remaining-work plan:
- rio9 window server integration; the legacy rio desktop implementation,
flavor selector, namespace/window-manager tables, theme/display
controllers, and stale Lola manual are removed; rio delegates to rio9.
- Keyboard task switching: Ctrl+Tab cycles application windows through
the taskbar activation path, restoring hidden windows.
- xbridge: RandR resize negotiation (1.2 RRSetScreenSize with the 1.0
RRSetScreenConfig fallback, CRTC detach, size-range clamping); text
clipboard raised to 1 MiB with chunked property writes and INCR
reception; extended selftest covering 300 KiB round trips, INCR, and
the close protocol. linux-app boots Xvfb at 1920x1080 for shrink
headroom and reports launch failures with the application's log tail.
- About opens as a normal window (rill --about); Text Editor registers
without a default document.
- Document opening: rill-open resolves file-name suffixes through
/lib/rill/associations (user overrides honored) and translates $home
paths into the Debian runtime's /home/user view.
- Harnesses: unified/window/linuxrun smokes, desktop-boot-smoke cold GUI
boot check, driver-smoke payload checks, web image payload additions.
- linuxrun session-environment and syscall refinements from the bridge
debugging; application matrix and refreshed status documentation.
- Rill submodule pointer: upstream-first commits 8132a17 (--about
window) and 49aa57d (tolerate stray unmasked fp notes).
Verified on the rebuilt kernel and desktop: taiji-fp-exception-ok,
taiji-window-smoke-ok, taiji-unified-smoke-ok, taiji-linuxrun-smoke-ok,
driver-smoke, taiji-desktop-boot-ok, make site.
fpssesave0 uses FXSAVE, which leaves pending exceptions in the live FPU,
so FPOFF's WAIT re-triggered the exception inside its own handler
(fpssesave0 -> matherror -> trap). Clear the live exception after
saving the state. Verified by the exception regression in make
window-smoke and by cold GUI boots.
kbtabctrl now emits a distinct rune (Ctab/Kctab, KF|0x19) for Ctrl+Tab
so rio9 can implement keyboard task switching; xbridge maps it back to
Tab for X clients.
startsession() wrote the launch command to the pre-forked launcher,
then blocked in waitsession() while STILL holding /dev/mouse. The
launcher's waitmousefree() times out after 5s and execs the window
manager anyway - its einit then failed with '/dev/mouse already in
use' and the whole desktop boot dropped to a shell ('draw: einit'
right after 'q9: gui ready' in every graphical console boot).
- libdraw gains eshutdown(): closes mousefd/cursorfd so an app can
release the event devices before handing the session over.
- nsselect's startsession() calls eshutdown() before waitsession().
- together with the previous heap-corruption fix in splitfields,
the graphical console boot now reaches and keeps the chooser.
When a namespaces/wms line had fewer separators than the requested
field count, splitfields stored a pointer INTO the line buffer as
the last field; freefields then free()d it - a stack address - which
tripped the libc pool 'D2B called on non-block' panic, corrupted the
heap, and crashed nsselect with a null-read fault right after 'gui
ready'. Every field is now an owned malloc'd copy.
THE FINDING (harness, t565): g_main_context_is_owner() returns TRUE
from the MAIN for the gdbus worker's shared context - glib's
owner==G_THREAD_SELF comparison matches because per-thread
pthread-key storage (glibc 2nd-level specific blocks in the shared
heap) aliases across the emulator's thread-processes. The main
therefore (a) suppresses the attach wakeup write (worker sleeps in
poll forever) and (b) wrongly 'acquires' the context (worker blocks
in the acquire cond - FTXW val=0).
- libglib binary patch (offset 0x4f8b6, je->nop): the attach
wakeup now signals whenever owner!=NULL, even when owner==self -
the confused match no longer suppresses it. Verified in t570:
post-BEGIN activity for the first time (NEGOTIATE_UNIX_FD
round-trip + eventfd wakeup writes).
- poll(): spurious 0-return after 500ms for infinite polls that
include an eventfd stand-in only (blanket version broke the
plain-socket SASL); lets glib loops re-run prepare().
- harness: GError dump, is_owner probe, owner-slot dumps,
pthread_self/g_thread_self comparison (distinct - the aliasing is
in the KEY blocks, not the descriptor).
Added send()/sendmsg()/recvmsg() interposition and thread-default
context tracing. Full decoded sequence under the emulator (matches
glib 2.74.6 source):
- main runs the whole SASL via send() (all 5 lines traced, BEGIN last)
- _g_dbus_worker_new attaches '[gio] _g_dbus_worker_do_initial_read'
(an IDLE source, prepare==TRUE unconditionally) to the shared worker
context 0x4001add0 - g_source_attach TRACED, and
g_main_context_push_thread_default TRACED from the worker confirms
the SAME context address the worker runs
- the attach's internal wakeup is written (fd6, traced) and consumed
by the worker (traced)
- the worker's loop then re-polls fd6 forever: g_main_context_prepare
does NOT see the attached idle source - if it did, prepare would
return ready (idles are always ready) and dispatch would run the
initial read, then the Hello send would follow via
schedule_writing_unlocked's own idle (never attached - only 4
attaches total, all traced)
- the main correctly waits on its own context's wakeup (fd20, 1h) for
the GTask completion that can never happen
So the wedge is now precisely: an idle source attached to a running
GMainContext from another thread is invisible to that context's
prepare() under the emulator - a glib source-list visibility/locking
question. Needs qemu-i386 + gdb on the host (sudo) to single-step
g_main_context_prepare in the worker.
A 60-line C program linking the rootfs's own i386 glib, with a
hand-rolled _start (no multilib crt needed), reproducing xfwm4's
exact stall in a 7-minute boot: full SASL (BEGIN on the wire, OK +
AGREE_UNIX_FD read back), then the connection's write-source is
attached to the worker context (g_source_attach traced), the wakeup
eventfd is written by the main and consumed by the worker - and the
worker re-polls without ever dispatching (the dbus socket never
enters its poll set). Natively on the host the same binary completes
(conn=0x... err=0), so the wedge is emulator-specific.
Interposition layer: exe-defined write/writev/poll/read (raw-int80
forwarding) trace libgio's I/O decisions; dlsym-forwarded wrappers
for g_source_attach/g_main_context_invoke_full/prepare/check/
dispatch/is_owner/acquire and g_socket_condition_check (the latter
turn out to be intra-libgio and thus invisible).
Build: gcc -m32 -nostdlib, link -l:libgio-2.0.so.0 etc. against
debian/rootfs/usr/lib/i386-linux-gnu. Next step this enables:
qemu-i386 user-mode + gdb on the host against the same binary/libs
for a real single-step of the worker's context iteration.
Key negative results: the rootfs has no glib client tools (gdbus/
gsettings/dconf absent), and xfconfd - a glib main-loop dbus SERVICE -
completes g_bus_get_sync + Hello + name ownership fine under the
emulator, so the GDBus sync pattern itself works. The WM's wedge is
narrower: its gdbus worker thread is never created (no fifth clone;
no thread ever polls the dbus socket) - the stall is inside
g_bus_get_sync between auth completion (BEGIN verified on the wire)
and worker spawn, before any syscall.
The /proc note-poke sampling failed (only the parent may write
/proc/N/note), so the dispatcher now re-arms a 2s alarm and every
note prints the guest's live context - samples land in userspace
loops that no syscall-level probe sees. First distribution from the
parked gdbus worker: ~all samples at the ld.so syscall stub =
the worker spins through the syscall boundary (busy poll loop),
never dwelling in glib's check/dispatch long enough to sample.
A/B test at the park: the gdbus-worker dispatch wedge is identical at
8x and 1x - the clock multiplier is exonerated (as is efdwr
coalescing: the worker consumes its wakeup). Keep the base-relative
clock structure (it fixes the int64 overflow) at 1x as the safer
default.
Names the wait topology directly: the WM main parks polling ONLY the
gdbus worker channel (fd25, single-fd poll, never ready), while the
worker polls its wakeup eventfd (fd14) - the worker consumed its one
wakeup (8 bytes read) but never dispatched the queued work and went
back to polling. Everyone-waits-for-everyone confirmed from the poll
sets themselves; the remaining wedge is glib's post-wakeup GSource
dispatch inside the worker.
sysaccept returns (rf<<16)|wf and both accept wrappers only ran
socknewslot when the value was >= 0x10000. When the acceptor's
stdin had been closed, the adopted read-end pipe landed on host fd 0,
collapsing the packed value to wf - the guard then skipped socket
registration entirely and the connection stayed forever unreadable:
epoll readiness lookups failed (qffff), dbus-daemon never read
xfwm4's connection, xfconfd starved, and the WM parked.
With registration on r >= 0, the WM's full SASL goes through
(AUTH EXTERNAL -> DATA -> NEGOTIATE_UNIX_FD -> BEGIN, daemon replies
OK + AGREE_UNIX_FD verified on the wire).
Also: ticket reaping (dead-client tickets no longer hold listeners
perpetually ready; broken adoptions consumed), CLOSE/LQREADY/FTXW
probes.
The /proc ps-state watchdog (wdog.rc: periodic ps + /proc/*/syscall
dumps in the session log) named the parks: dbus-daemon busy in NSS
opens (fixed host-side with a files-only /etc/nsswitch.conf), while
the WM and xfconfd sit in Sleep with zero syscalls - parked inside
epoll_wait for GSource events that never fire. RDBLK proves the WM
is NOT blocked in any socket read: the dbus reply simply never
arrives because xfconfd's glib main loop never dispatches. Main-
loop-driven glib processes wedge under the emulator while plain
libdbus clients (dbus-send) complete full round trips - the frontier
is the glib worker-thread wakeup chain.
t524-t532 chase of the post-selection-claim park:
- 'Missing data from default files' is FATAL in xfwm4 (main.c status
-2 -> exit): the WM was exiting after the theme warning all along.
The rootfs shipped NO xfwm4 themes - installed the default theme
from the upstream tarball - and xfwm4 requires a working xfconf,
so n20 now launches xfconfd after dbus.
- xfconfd died 'Xfconfd failed to start: Timeout was reached' inside
g_bus_get_sync (glib's 25s GDBus default): binary-patched the
single 25000ms constant in libgio-2.0 to 3600000ms (backup kept).
With that xfconfd starts clean.
- guest clock 8x multiplier (clock_gettime 265/403), scaled around a
boot-time base - a bare multiply overflows epoch-nanoseconds and
glib aborts on the 'non-monotonic' negative clock.
- fileread(): readahead cache for guest file reads - freetype reads
fonts 512 bytes at a time, ~1s per read through ufs (25 min per
font); 8x64KB per-fd cache, invalidated on close and seek.
- /srv scans enlarged to 512KB with stale-ticket GC: leaked x.c
tickets pushed fresh connects past the read buffer, so Xvfb never
accepted xfwm4's later connections and their writes blocked.
- probes: OPENCHK (pre-open path), RDCHK/RDFILE (blocking-read
identity), fileqlen.
THE WM dbus freeze, finally: the stale-hit refresh in sockslot read
the .f marker published when the dbus socket was created unconnected
(packed=0, fd numbers <= 2) - reading a marker dups the stored fd, so
the refresh dup'd fd 0 and blocked reading STDIN forever, wedging the
WM inside sockslot mid-sendmsg (the SASL \0 write never reached
sockwr; the daemon's auth timeout then killed the connection).
- publication (sockmapfd + socknewslot) skips packed==0 entirely
- connect handlers now store through sockmapfd so the markers are
republished with the connected pipes (the old bare store left them
absent/stale, starving sibling-thread adoption)
- the stale-hit refresh skips parsed fd numbers <= 2 defensively
With this the WM's dbus \0 completes, xfconf reaches its (expected)
failure against the missing xfconfd, and xfwm4 proceeds into theme
loading - its deepest state yet.
- dbus-run.conf auth_timeout 30s->2h (emulator needs minutes between
SASL writes; the daemon's timeout killed every WM connection).
- EPOLL_CTL_DEL keeps the fd (libdbus splits one fd into read+write
watches; the write DEL after the read ADD erased all interest).
- epoll readiness for connected bridge sockets is data-driven
regardless of registered mask.
- probes: sendmsg/writev dumps, connect-store traces, GDBUS_DEBUG.
- dbus-probe.rc: dbus-send completes a FULL ListNames round trip
against the daemon cross-process - bridge/auth/pipes all work; the
remaining xfwm4 stall is its own multithreaded fd-slot state.
t498-t503 forensics on the post-selection-claim freeze:
- writes/sends/writev on a sockmap slot with packed==0 (a plain
socket() whose connect was refused or never made) fell through to
host fd 0 - the guest's gdbus retry data went to stdin and the
write could block on the console forever. These now fail with
-ENOTCONN immediately, like real Linux.
- socknewslot now takes the eventfd trait as a parameter and records
it BEFORE publishing the x.m .f marker: the old flow published the
marker first and set isefd[] afterwards, so the marker always said
'not an eventfd' and every adopter (and the main process after fd
reuse) lost the trait - efdwr then never engaged and the wakeup
write blocked (EFDDBG probe proved isefd==0 at the frozen write).
- the fork/clone parent's forkready park is a polled, bounded wait
(2 min) instead of a blocking read: a swallowed alarm note makes
plan9 resume a blocked read, so a child dying before its release
parked the parent forever.
- close no longer removes the shared x.m markers (thread-group keyed:
a sibling closing its copy yanked them from under other processes -
ADOPTFAIL noise); entries leak per session within the 64K scan.
- diagnostics: RAWW (raw-fd write with marker present), ADOPTFAIL,
EFDDBG, WUNCONN.
t491-t497 nailed the recurring xfwm4 freeze: a guest write to a glib
wakeup eventfd (pipe stand-in) entered a blocking host write; the
3-second guard alarm's note was swallowed by the trap handler, and a
swallowed note makes plan9 RESUME the interrupted write - one alarm
per arming left the writer stuck inside dosyscall forever (the
dispatcher's 60s userspace-silence alarm never armed because we never
left the call). The nondeterministic stall depth came from where the
freeze happened to land.
- efdwr: eventfd writes with a wakeup already pending (peer pipe
qlen > 0) discard the new value instead of writing - the counter
semantics coalesce wakeups, so nothing is lost and the write can
never block. Routed through the write and send paths.
- isefd[] tracks which bridge pipes are eventfd stand-ins, set at
eventfd/eventfd2 creation and propagated through the x.m .f marker
(flag bit 2) so adopted siblings keep the trait; peerqlen/drain
now consult it, so socket pipes (live protocol data) are never
drained.
- ALARMSPIN probe: the dispatcher re-arms a 60s alarm after every
syscall; a pure-userspace spin finally shows its pc/stack when the
note lands.
- with this, xfwm4 for the first time reliably claims WM_S0
(SetSelectionOwner op 22 + verify seen in t497) and proceeds into
theme loading.
Also: q9 scripts n17/n18/n19 (long-window WM sessions with periodic
screenshots, GLX-off Xvfb, dbus-first).
Progress from t476-t480 on the xfwm4 startup stall:
- dofutex rewritten: FUTEX_WAIT/WAIT_BITSET now honor their timeouts
(relative resp. absolute CLOCK_MONOTONIC deadlines, 1ms polling)
instead of returning instant ETIMEDOUT/spurious wakeups, which had
collapsed every glib/glibc timed wait into a zero-delay spin;
FUTEX_WAKE_OP now performs its atomic op and comparator on the
second word (it desynced glibc's lowlevellock protocol as a no-op).
Signature widened to six futex args (a6 = ur->bp).
- sockwr: a write that blocks three seconds on a full pipe drains the
peer end and retries, so an unread glib eventfd-style wakeup pipe
can no longer freeze the writing thread forever.
- probes: futex op dump, sockmapfd trace, fcntl F_DUPFD socket trace,
sysconnect sockaddr dump.
- established with t480: with these fixes xfwm4 reliably completes
the whole gdk_display_open request stream (formerly stalled inside
it); the remaining blocker is a single-threaded guest userspace
spin after an abstract-socket connect refusal - no clone/mmap/
syscalls at all afterward (xfwm4 never creates threads under the
emulator yet).
Forensics for xfwm4 startup under the emulator (t458-t473):
- XWR/XRD: full per-connection write and read byte dumps for X client
sockets (byte-order-char detection), plus a DUP trace for socket fds;
request/reply streams can now be reconstructed offline. Established
that xfwm4's X stream always ends at the end of gdk_display_open
(XFIXES SelectSelectionInput + GetSelectionOwner on _NET_WM_CM_S0)
and the gtk_win is never realized or mapped - the stall is guest-side
glib/gdbus scheduling, not X transport (transport is byte-exact;
xfce4-panel, a plain GTK3 client, maps and paints fine).
- sysconnect: sockaddr dump probe + diagnostics on pipe()/postsrvfd
failures (previously silent early returns left gdbus retrying
forever with nothing queued for the listener).
- sysaccept/listenqueued: /srv directory scans enlarged 4K->64K and
made static (the on-stack 64K buffers smashed host stacks after the
first enlargement - same class as the old splice bug).
- q9 scripts: dbus-first session runs (n13-n16) with -extension GLX on
Xvfb (swrast/libLLVM loading under the emulator starved the server
for the whole session), stale ticket-marker cleanup, and a GTK
discriminator run (n11) that proved GTK startup works.
The WM's root select-redirect request - its bytes name the target
window and the attribute mask (0x200000 must appear).
Git-Id: f9dbd2b87c5c55a9519eb6b1b16f74e7ba93a99a
The WM's last action before idling is a write to stderr whose
content was never logged - it likely names what stops it before
the window tree scan.
Git-Id: e7343f25bf9860b2e1e8c96753e094498883f3ab
The probe's own blocked 1-byte read was interrupted by its alarm
and the resume at the ld.so stub's ret trapped invalid-opcode,
killing the calling thread. The WM died exactly here after an
EAGAIN recvmsg - every one of its 8+ connection retries ended
this way. Empty nonblocking reads now return EAGAIN directly;
EOF detection stays with the blocking read path and the poll/epoll
write-end checks.
Git-Id: 3e9710b302e4e1d78bda6a1975a3ecae6a92a9be
Serving the probe's 1-byte read duplicated bytes at chunk
boundaries (32-byte reply followed by a spurious n=1 read, next
reply misaligned at n=31), desyncing XCB's parser - the WM tore
down its connection and retried forever at the same split. The
probe byte now goes back to the front of inq and the caller sees
EAGAIN, keeping the stream byte-exact.
Git-Id: b7c8154f7f21d4f34c9e5144db801858909a3d1b
Opcode 140's request bytes name the extension negotiation (the
WM resends it 4x per attempt) and the reply's version fields are
the suspect.
Git-Id: 31d73a91a55d9987dbfb83ba3c5be2cbd9d4c0d8
The server's setup bytes are verified perfect; concatenating the
client's read chunks against them names any chunking defect.
Git-Id: f0574d1a30b57c0c2fa15ab6c861022fb65d4ca1
The setup continuation write (9548 bytes) carries the root window
around continuation offset 60 - 16 bytes was not enough to see it.
Git-Id: 1c50a417f7ce7280ba33a1da1d3d3ba71d77a1d0
The 'setup' the probe caught was actually the ListExtensions reply
(reply header, seq 14) - the real setup write never matched the
old conditions. First-10-writes heads show where the setup lands
and its root-window bytes.
Git-Id: a5b9e33186a6dbc66379586d385c81a1cd9d3d2d
Computed field offsets disagreed with the wire twice; read vendor
length, format count, and the root window straight off the dump.
Git-Id: f4d42f36879d5a2e835299c34f40acca97791ee9
Vendor length lives at 24-25 and format count at 30-31 of the
connection setup; the first screen starts at 32+8*formats+vendor.
Git-Id: 4b0992f529be45eb47a5cbe3c1a0939a37a4fa3
The first write per socket carries the setup; the first screen's
root window sits after vendor+formats. Comparing across the WM's
retry connections shows whether any delivery parses root as 0.
Git-Id: d7bd3976934c99bea85a3bdec896b88de1c2a39d
The WM's two X connections interleaved under one guest-fd label,
mixing two sequence counters - now each print carries its sockmap
slot so the streams separate and replies map to requests.
Git-Id: 6418f8044a2ff405a7316d1f6f51c04b45b90c6
Xvfb answers focus=None until a WM sets the focus; gdk's focus
tracking takes the None path badly (xfwm4 went on to query
attributes of window None - BadWindow/BadDrawable - and its
startup stalled before the tree scan that discovers client
windows). Real servers commonly return PointerRoot here and gdk
handles it cleanly: the bridge now seq-matches GetInputFocus
(op 43) requests and rewrites a None focus field in the reply.
Git-Id: 26cbe3f2cb8e8dcbaa1ec6a4ff74237a46a9a1a8
The WM's requests at seq 60+ were invisible (cap consumed by
earlier processes) - those name the window that drew BadWindow.
Git-Id: 046baea8db35657ba0b76870985be63300e9157c
Window-bearing request heads (GetWindowAttributes/QueryTree/
GetSelectionOwner/InternAtom) and the full bytes of short replies
- the owner/window fields are the corruption suspects behind the
WM's BadWindow/BadDrawable.
Git-Id: b518079f0a8ceea52a48649cf32a291be1a74f39
The WM received op=0 (X error) replies at seq 70/71 - the code
and major-opcode bytes name which request failed.
Git-Id: 8902c6655a39498a42378357fc932a5270d0a56
write and writev report when the delivered count differs from the
requested - a request the guest believes complete but the pipe
never fully delivered would leave it waiting forever.
Git-Id: 53b6e86881d3e0e2ba4b6ed1c99fa40debe86ef6
A thread re-registering a guest fd number (the WM's second X
socket landing on a number other host procs still mapped to the
first connection) sent its writes out the wrong pipe: the server
saw conn2 forever empty while conn1's outgoing queue grew 12
unread bytes. The .f publication now carries the live packed
value; a rate-limited stale-hit check re-adopts the endpoints
when the published value differs from our copy.
Git-Id: e0dcde2c8d94345b8d3ea2a1dd2edfe465ee8c0e
Watch the second accepted connection's readiness in the late
session without waiting 1000 calls between samples.
Git-Id: 86e91ea897464deaf5d94e98bcbdb546db9a6f74
The /proc/#p channel path cannot work here (that /proc/N/fd is a
text listing), and the fd-mutation theory was printf garbage. With
true qids, the .b OWRITE open's result is now measurable directly.
Git-Id: 04614b582486b178ae60f4ef8a99f9ab47838b4
qid.vers is a ulong; printing it with %llux consumed the next
vararg word in plan9's 32-bit ABI, corrupting every qid pair
after the first - the earlier match/mismatch conclusions were
built on garbage. All three probes now cast explicitly.
Git-Id: 41ad8f8e1cf729e4d7d0ab3ec8f7467c49a3d0b
Completes the identity chain: connect-side qids, post-time fd+qid,
accept-side opened qids - any mismatch or stale fd number is now
visible in one place.
Git-Id: 5e2f0f00c74a6fe14d33908a1bcdf70ff9f92d97
/proc/<pid>/fd resolves into the rootfs's empty /proc directory in
the debian namespace; the #p device path bypasses the bind.
Git-Id: c30fa2e95c46e1c4bd98304f8ad4b8757e8f0f1e
The qid probe proved the OWRITE (and ORDWR) open of the .b ticket
does NOT share the client's pipe - wf was another object, so every
server reply vanished before reaching the client. The marker file
now carries the client's s2c[1] fd number and the acceptor opens
/proc/<cpid>/fd/N instead - the same channel-sharing path the
thread adoption already uses successfully.
Git-Id: 8f5be35c66e69fa60e8488e8453ea7cafd7c8ea4
The qid probe proved the asymmetry: the OREAD open of .a shares
the client's pipe channel (qids match), but the OWRITE open of .b
does not - it is the POSTING side of devsrv's fd sharing, so wf
was the /srv file itself and every server reply was written into
the ticket file instead of the client's pipe. Open ORDWR first
(fall back to OWRITE only if refused).
Git-Id: f6a5b1f9c64a9c39fbb22749c2d7309611cb22d3e
CONNECT prints the qids of the posted ends (.a=c2s[0], .b=s2c[1]),
ACCEPT the qids of the ends it opened - a mismatch would prove the
/srv open produced a copy instead of sharing the channel, which is
the suspected reason reply bytes vanish server->client.
Git-Id: 31d4ca2b2ff8e4b9a0437a04bf32b1ba9f62b20e
The re-scan fix made blocking waits long, so the 1000th-call
sampling printed once per session - useless for watching the
server's accepted-connection readiness.
Git-Id: 2c7df0aa89f0f28b25b20d0eeb30b2878dcd5b4e
The WM polls its X fd POLLIN-only with bytes pending in the pipe
yet never wakes - the poll's readiness check must be looking at a
different host fd than the one holding data.
Git-Id: ebe54016990b76b17d34ee78f5a32bea0e97ef4e
PBLOCK prints fd/events/queue-length after the first empty 20ms
slice - the WM's final block hides in one of these.
Git-Id: a97f41cbd50b34ed2c6730e930c8bd8b4af8b15f
getsockopt zeroed optval for every option, so dbus's EXTERNAL
SASL auth saw ucred {0,0,0}; the handshake never completed and
the daemon closed the connection at auth_timeout (30s), killing
the xfconf activation path. Both getsockopt paths (socketcall
and direct) now fill {pid=guestprocid, uid=0, gid=0} for
SO_PEERCRED (optname 17) and log it.
Git-Id: e03b1f995787f9e5e5c13bc1ed69b8a537f0ac9c
The empty snapshot returned once and slept: a caller blocking in
epoll_wait with data arriving after the first scan never saw it
(the dbus daemon's client fds held unread bytes while its loop
spun on clock_gettime64+epoll_wait). Blocking and timed waits now
re-scan every 20ms; timeout-0 callers still return immediately.
Git-Id: 26c8b544cb7876bd286820a73efae0fa95910b6c
Hidden EINVALs from stubs masquerade as application errors - one
line per negative return names the culprit syscall directly.
Git-Id: 71d5327de00e4c8724bb9b88e666baa7392a4bf1
i386's struct rlimit carries rlim_cur and rlim_max as 64-bit
fields; the stub filled only the first 8 bytes, leaving rlim_max
garbage - dbus-daemon then rejected its own fd limit ('Failed to
get fd limit: Invalid argument') and the xfconf activation path
never ran.
Git-Id: 77032946cf299bcbf7727bf3b2dc6b8eb0911e11
Case 214 was glued onto the splice label group when splice was
added: setresuid32's stack-pointer fourth argument failed the
splice fd sanity check, every call returned EINVAL, and Xorg's
Popen child - which _exit(127)s when setuid(getuid()) fails -
killed xkbcomp's spawn, so Xvfb died at 'Failed to activate
virtual core keyboard' and never accepted a client. Also new:
exit-127 dumps the guest scene (pc/stack/sysring - this found
the Popen _exit(127) site directly) and set*id results log.
Git-Id: 0d0f4b5d5058e35e43b876e58a58f23eb53abda8
The xkbcomp spawn child dies silently: the forktrace probe (80
uncapped syscalls after a snapshot copy) shows BOTH spawn
generations executing exactly set_robust_list, set_tid_address,
setgid32(0), exit_group(127) - a glibc posix_spawn child failing
in userspace BEFORE execve (which would have printed). sysexecve
now logs entry/ok/failure with the reason for every exec.
Also: bridge connect markers moved out of /srv (devsrv files are
fd-sharing entries; readers got fd dups, not content) to plain
<path>.t.<pid>.<seq> files beside the .req marker, matched by
existence in accept and listener readiness.
Git-Id: c2fa990d2946e024dd8b90367139c0b9738db5c
Moving the host cwd made Xvfb's xkb lookups resolve from the
wrong root and the server died at 'Failed to activate virtual
core keyboard' - which also explains the zero-accept regression:
the listener never reached its loop. Report success, move
nothing; the guest's own paths are absolute.
Git-Id: 31b058ae95b7029d20e9d4908bf23e2c7a1a2b52
Diagnostic build: LISTEN/TKSKIP prints in the ticket scan - the
.t-gated accept finds no tickets to even check in t410, so the
next step is dumping the raw /srv listing from the scan.
Git-Id: 41aa99d7be9e5f16ea0b3ec7a2d8dd52392d4403
Connection tickets were anonymous: ANY listener's accept ate ANY
pending connect. The dbus daemon's accept loop consumed the X
server's clients (ACCEPT p142 client=<xeyes/xfwm4> for X connects)
and vice versa - every cross-server connection since the ticket
rework was a lottery. connect() now posts a .t file with the
target path; accept and the listener readiness check match it
against their boundpath before taking a ticket.
Git-Id: 4f075f14be83e0e4c0829ea99d2bf70d8b0b2bb3
A 32KB stack frame inside dosyscall (which runs on the 32KB note
stack) faulted the first guest that called splice.
Git-Id: e5b3d97b0ec9ad61465cd1d227e610bc89201a4c
splice(340) was dbus-daemon's last ENOSYS (one bounded
pipe-to-pipe move per call); chdir(12) removes Xvfb's 'Couldn't
change directory' warning class. accept() now prints which guest
proc each accepted bridge pair belongs to, so server-side reply
writes can be attributed to the right client.
Git-Id: 7d9c3f02ee37c678ac355e2b2ff4373e1a062d5b
xfwm4 waits on its dbus fd while the daemon's listener never
reports ready - the probes record whether the connect reached the
ticket stage and under what path, deciding between a lost connect
and a missed ticket scan.
Git-Id: 2c8e0f80a2b8e2e4bc2e478fb56506de7e9c86d5
dofutex returned ENOSYS for WAIT_BITSET and the other modern
operations; glibc's locks use them and dbus-daemon aborted its
startup step with 'Failed to get fd limit: Function not
implemented'. A spurious-wakeup zero is legal futex behavior the
callers already tolerate by re-checking.
Git-Id: 6d9acaf62391185dfe651890a3fd7fbdfbf04ba1
dbus-daemon reads its fd limit through prlimit64 and aborted the
step with 'Failed to get fd limit: Function not implemented' once
the rest of its startup ran. Old limits are reported with the
same values getrlimit uses (stack 8MB, nofile 1024, rest
unbounded); set requests are accepted silently.
Git-Id: a489341f44d522279e49a54baf6bf7ab6fdecaa1
pipe() stand-ins are unregistered host fds; the unknown-fd rule
reported them always-ready, so sd-event woke on its empty wakeup
pipes, took their blocking read, and dbus-daemon froze at boot -
never accepting, xfconfd never activated. Raw fds now report
EPOLLIN/POLLIN only when dirfstat shows queued data (POLLOUT
stands - plan9 pipes barely block).
Git-Id: 71103b3fe91f1c17b81e56968d00c7debbc8ba77
The adoption path was forkppid-gated, so a group leader never
adopted connections its own threads created. dbus-daemon's leader
epoll-registered its thread-made eventfd stand-ins, missed them in
its sockmap, and the unknown-fd rule reported them always-ready:
sd-event woke on both, took the blocking read, and the daemon
froze for the whole session - never accepting, xfconfd never
activated, the WM waiting on dbus forever. socksync stays
parent-only; the /srv adoption is keyed by the group-wide
guestprocid.
Git-Id: 6e733e83099a5fa4b80b43ba8e2e67766b3787ce
The frozen dbus-daemon's last calls were read(fd=7)/read(fd=8)
with no way to know what those fds were. open() logs fd and path
(capped) so a stall scene names its file directly.
Git-Id: 503e2be54b623a44ea0877b381bb4bd3f2f0ea5f
A pipe write that took only part of the buffer returned that
partial count, and Xorg honored it: one 32-byte fragment per
dispatch cycle, so a 3MB GetImage reply would have needed ~100k
POLLOUT flush rounds. sockwr now loops until the whole buffer is
pushed (reader and writer are separate host processes, so waiting
for the queue to drain cannot self-deadlock) and reports the first
few short writes with the fragment size.
Git-Id: 89c1e2b5f730f65582241531491ba923a0bc90a2
syswritev summed the REQUESTED iovec lengths and returned that,
so a short pipe write reported success for bytes that never left
the process - Xorg believed a 2KB GetProperty reply was delivered
when only its 32-byte header landed, and the client blocked on the
missing value bytes forever. Partial counts are returned now (the
caller buffers the rest, per writev semantics).
Git-Id: 1a447d3e1a4227da7c33cf2ca529c55b49dc4c0a
sockpredrain pulled up to a megabyte of pending replies into the
WRITING process' buffer on every guest write. With CLONE_FILES
threads being separate host processes, one thread's ChangeProperty
pre-drained the reply another thread's read was waiting for -
bytes stranded in the wrong process' inq, both sides stalled, the
WM never reached its frame setup (the op histogram showed xfconf's
property sync going quiet mid-exchange with the server-side pipe
empty). Plan9 pipes have no limit so writes never block: the drain
served nothing. The PLOG peek no longer drains either.
Git-Id: 3dbbd8413e11e2361bb1cf6659064a3e97ec2725
The server's epoll reports no client ready while clients logged
successful writes - the probe now shows each registered fd's pipe
qlen from the server's side, deciding whether the stat or the
write is the liar.
Git-Id: 559671b705a61708b5752aa9f3cf8c76cba08cc3
The 2s postnote pokes on every guest correlated with processes
dying at the int80 stub's ret (692 such invalid-opcode traps in
one session; the xwd client itself died that way mid-capture).
The profiler did its job - it found the RLIMIT_NOFILE walk - so it
is gone; the UD-crash dump stays.
Git-Id: e8fe69456ba9c5ea9adcb38a5fd0c4c7283476cc
The TrapUD fallthrough returned silently - a guest that jumped to
garbage died with nothing but the suicide note (dbus-daemon at
pc=0xe70a took the whole desktop with it). Registers, the syscall
ring, segments and stack words are dumped before the default
disposition, same as the fault path.
Git-Id: b15b58b8dcd5d6b5b9206c1b96e4ee7a4c7ac7f0
xfce-shot-n9 launches dbus-daemon before the X stack (its config
read hangs when launched later), using a fixed-path session bus
config written into the rootfs; dbus-test isolates the daemon; n8
dumps /proc state for stall forensics.
Git-Id: 2ff4d00b6b1e0d1a0f9389be3bd5f85da62c8db1
A note-poked sampling profiler (RFMEM sibling postnote + a handler
that prints the interrupted guest pc) finally caught the dbus-daemon
startup spin: glibc's __close_nocancel walking the whole fd space
one fcntl at a time because getrlimit reported RLIMIT_NOFILE as
infinite - a million note round-trips before main() ever ran, on
every dbus-daemon invocation including --version. The limit is
1024 now, matching the stack-limit fix before it.
Also new: BIND/BINDABS probes, an enter-trace for blocking-candidate
syscalls, and the sampler itself (capped, silent unless sampled).
Git-Id: d5394d560ba5dcb59e6b97fb470722696e2b6254
The eventfd/eventfd2 stand-in closed its write end right away, so
the read end sat at EOF - permanently POLLIN-ready. glib polls its
GMainContext wakeup eventfd; that fake readiness spun xfwm4's main
loop flat out forever (the fd22 poll, ready with no data, in every
sample). The stand-in is now a registered bridge socket: both pipe
ends stay live, guest writes to the eventfd reach the pipe, poll
reports readable only after a signal, and the endpoints publish in
/srv like every other bridge.
Git-Id: b85e83563b52c02c4f590f37d84e0e0354427958
socknewslot (the accept/socketpair allocator) never wrote the
x.m.* /srv entries - only the connect path did - so sockets that
arrived through accept stayed unadoptable by sibling threads.
Git-Id: 4677896818b8e6a1f048745840ec8135607921fa
Nested clones get #c/ppid of a sibling thread, not the group
leader, so a forkppid-keyed lookup missed the leader-published
endpoints. guestprocid is identical across the whole thread group
(one image, one getpid), so it keys the x.m.* files everywhere.
Git-Id: 2a5e5d1d1b78f68b1ce49787a25d44d5685fc7ca
The parent-only socksync missed connections a sibling thread opened
after the clone - xfwm4's fd stayed 'not a socket' in the spinning
main loop. Every new bridge socket now publishes its pipe ends as
/srv/x.m.<tgid>.<fd>.r/.w (devsrv channel sharing, same trick as
the connect tickets) plus an .f flag file kept current on SETFL;
a lookup miss in a thread adopts the connection from there. close
removes the three files.
Git-Id: 86a9a2b8c7ad84e8f8a0858df3d2b62ea9d5c0ec
The fork bounce wiped every child's host-side sockmap - including
CLONE_FILES threads, which share the guest fd table. A connection
opened after the clone then resolved to 'not a socket' in the
thread, and the poll layer's passthrough rule (non-socket fds are
always ready) made the fd permanently POLLIN-ready: xfwm4's main
loop iterated forever on real, unread data (RLOG showed the parent
reading fd 5 while the thread spun polling fd 22 - the same guest
connection under diverged views).
Threads now keep their inherited map, and connections the parent
opened since the clone are pulled in from its live memory via
/proc/<ppid>/mem, with the pipe ends re-opened locally through
/proc/<ppid>/fd/N (socksync, also re-tried lazily on lookup
misses). Snapshot forks keep the old wipe - they exec away.
Git-Id: 8d5c56c066b6d5eb8769090824103a2ff5b3944d
clock_nanosleep_time64 read the timespec64's seconds-low and
seconds-high words as (sec, nsec), collapsing every guest sleep to
about a millisecond - glib's and Xorg's timer loops then spun flat
out (xfwm4's main thread: 1h02 CPU in user mode, zero syscalls;
Xvfb: an epoll_wait+clock_gettime64 churn). The 64-bit fields are
read whole now.
epoll_wait with a real timeout also sleeps for it now (capped at
50ms) instead of returning empty 63 times out of 64; timeout-0
callers still get an immediate answer.
Git-Id: 55e2d7d51a1eab4e58dd84e57334a5aa4c35e1b7
xfwm4 without xfconf pops a startup-failure helper dialog whose
paint stalls under the emulator (the frozen half-drawn dialog in
every screenshot so far). The run script now launches dbus-daemon
on a fixed pathname socket; every guest gets
DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/dbus-1 so xfconf (and the
rest of the xfce stack) can activate over it.
Git-Id: e5f241b17f7e9b2538b9017bd2ec8c0bdc68b6ad
The probe stored its byte through inq[i], but inq is allocated
lazily by sockdrain - a socket that never pre-drained had inq[i]
nil, and the probe's byte-store faulted at addr 0x0. That killed
Xvfb in some sessions and the xwd client in others (t358-t362 all
ended in 'fault write addr=0x0' suicides right after a probe that
found data). The byte is now served straight to the caller's
buffer.
Git-Id: 4294a0399f66b67cb35b43f65a5fd79b7ad51e96
Re-arming on every alarm note stormed: each re-arm fired again one
millisecond later, so the first probe left a permanent 1ms note
chain that drowned the process (t360 froze solid mid-capture).
alarmnote now re-arms only while the EOF probe's read is actually
in flight.
Git-Id: 1f8ab77e8897088e94892643c1a95e93c22ae2d9
If the 1ms alarm note landed between alarm(1) and the probe read
entering the kernel, the note was consumed and the read blocked
forever on a live writer - t359's xwd wedged exactly there, one
GetImage request sent and never a read after. The handler now
re-arms alarm(1) before returning, so even a late-blocked read is
interrupted by the follow-up note.
Git-Id: 5c68bb60a35662d6c5f2d31d2b90724b40199c40
The unconditional 1ms-alarm probe on every empty nonblocking recv
taxed the XCB poll loop into a crawl (t358: the whole desktop
stalled, no X traffic for minutes). The probe now runs at most
once per 50ms per socket: hot loops pay nothing, a dropped
connection is still reported as EOF within ~50ms.
Git-Id: 9c72ff8e5ec1e4f6153baf95a30f8914661a01bb
xfwm4's XCB connection spun on recvmsg returning EAGAIN forever:
when the server drops a client, the pipe's write end closes, but
sockread's nonblocking shortcut answered EAGAIN for any empty pipe
without ever finding out whether a writer was still attached - a
dead connection was indistinguishable from a quiet one.
The empty-nonblocking case now probes with a 1-byte read under a
1ms alarm: interrupted means the writer lives (EAGAIN), zero means
EOF (soeof set, return 0). A probe that finds a real byte serves
it immediately, and a known-EOF socket short-circuits to 0.
Git-Id: 60657635dbbaed8c1a78ec5853b2ff8fa4d9f605
GTK3's X11 backend probes GLX for its windows; under the emulator
the probe's context teardown retries forever (glXDestroyContext in
a loop via the glvnd entry check - the pure-getpid spin). GDK_GL=
disable makes gdk skip client GL entirely, which xfwm4 does not
need for window management.
Git-Id: 1b6a2d2a17f3ff481dbe6f6f0a1e3aa4baef42a9
Xvfb logged _XSERVTransSocketUNIXAccept: accept() failed and at-spi
reported 'Could not open X display': sysaccept deduped pending
connections by client pid (servedpids), so a client's SECOND X
connection - glvnd/mesa opens one for GLX, at-spi/dbind another -
was never accepted and the server's accept spun on EAGAIN.
Connection tickets are now x.c.<pid>.<seq>.a/.b (connseq per
client), and accept consumes them by removing the /srv entries it
serves. The servedpids table and the readiness gate's dedup are
gone - a pending ticket now always means a waiting client.
Git-Id: 3e6e3ea6757587305b417f8688799dd644fe63f3
The pidcache theory was wrong (0x106 hex == 262: the cache always
held the right pid). What remains true: xfwm4's main thread re-
enters glX entrypoints forever (one getpid each, pure userspace in
between) and stalls mid-paint. To name the looping caller above
glX, the probe now walks the saved-ebp chain (guarded by the guest
segment table) at every spin hit.
Git-Id: 47c73f23327a45bb21a83a4a79f6b3daa0f80da4
The lazy first-getpid assignment still let a clone thread adopt its
own host pid: the thread was cloned before the parent had ever
issued a getpid, so it inherited guestprocid=0 and self-assigned.
t344 showed the same 262-vs-106 cache thrash as before. Both
!started blocks (int80 and ud2 entries) now set guestprocid=getpid()
before any guest code - and thus before any clone - can run.
Git-Id: 6d1a6f654288b6326a99aa7d38f3474e75b4518a
The widened spin probe caught the xfwm4 freeze red-handed: the
glvnd libGLX entry prologue stores getpid() in a shared pid cache
and runs __glDispatchReset whenever it changes between entries;
probe samples showed getpid returning 262 while the cache held 106
forever - two different host pids. Each clone thread is its own
host process here, so threads sharing one guest image saw each
other's pids as an endless stream of forks and reset the GL
dispatch forever (a tight getpid-only syscall loop, exactly the
freeze).
getpid (nr 20) now returns guestprocid: CLONE_VM threads inherit
the parent's value through the rfork copy, real fork/vfork/clone-
without-VM children adopt their own new pid in the fork child
branch. gettid (224) keeps the host pid so tids stay unique.
Git-Id: 1c1a437a3f389469e6c31d55cc37b7010655e282f
The freeze loop at pc=0x6801b5a0 is now fully mapped: that pc is
ld.so's raw int80 stub reached via %gs:0x10, the return address in
[sp] lands inside libc's getpid, and the real caller is glvnd
libGLX.so 0x3b50 - the fork-check prologue every glX* entrypoint
executes (getpid, entry-count++, pid-cache swap, and on mismatch
__glDispatchReset + teardown, on match a sched_yield drain-wait).
epoxy pulls libGLX into xfwm4. sched_yield (nr 158) was ENOSYS; it
now returns 0. The spin probe fires on getpid/getuid/sched_yield
from the interp stub and dumps the result, glvnd's pid-cache and
entry-count (0x42bd10dc/0x42bd10e4 this session), and 16 stack
words to name the looping caller above glX.
Git-Id: 42f8e0e91d1c58ce2a878a54c8f0351e9c2b3ec0
syssetthreadarea succeeds (-> 0) for every clone child, and the child
now gets its segment register loaded the way a kernel CLONE_SETTLS
would (glibc's i386 TLS lives in %gs; the bounced child had nothing
loading it). That said, t341 shows the getpid spin persists unchanged
- and crucially the spin runs in the MAIN thread (p277), at ld.so's
raw int80 stub, while the seven clone children install TLS cleanly.
So the TLS-descriptor theory for the spin is disproven; the loop is
ld.so-side in the main thread (lazy-PLT or version-resolution path
suspected) and identifying it needs the guest's register state or
memory at the freeze, not more syscall tracing.
The pc-tagged TAIL probe places the window manager's stall at
interp+0x1b5a0 - disassembly shows that is ld-linux's 'int $0x80; ret'
raw syscall stub (the same address the closed-pipe notes have carried
all along as their second pc). A thousand getpid calls from the
dynamic linker mean the guest is looping inside ld.so - most plausibly
a TLS fixup/relocation re-entry, e.g. the FcInit worker's TLS descriptor
never installed so every thread-local access re-enters the resolver.
Next: log syssetthreadarea's success in clone children and inspect the
lazy TLS resolution path (bp values sit in the guest heap).
The widened syscall-tail probe (16 entries) settles what the window
manager does at its freeze: its entire syscall stream becomes getpid,
sixteen for sixteen at every 2000-syscall checkpoint - a userspace
spin loop (the 'cheap syscall yield' idiom), not a block in any I/O
call. The X pipe even holds a byte for it. The spin most plausibly
waits on a condition our emulation never satisfies (a glib/at-spi wait
on shared state); identifying the loop needs a guest backtrace - the
next session should dump the WM's pc/bp chain at the freeze rather
than its syscall stream, since syscalls no longer distinguish it.
The FLOW lines now carry the last six syscall numbers, so the window
manager's client-side block (server alive, one byte pending) is
identifiable from the next session's log directly.
With the full (previously truncated-at-260-lines) xvfb.log, the server
tells a different story than assumed: its xkbcomp fork chain completes
(FMEM copy done, twice), it stays alive cycling recvmsg polls, and it
wrote 70 reply batches to the window manager's socket - while the WM's
read flow froze at 1323 with ONE byte still pending in the pipe. The
server is not the one withholding a reply; the window manager blocks in
some non-socket syscall of its own after its 1323rd read, with data
waiting. Next probe: print the client's last syscalls (sysring tail)
alongside its FLOW lines to name the blocking call.
Bisecting the window manager's remaining freeze: every one of xfwm4's
startup forks (the g_spawn'd helpers) completes the full handshake -
child bounces, (snapshot only for non-CLONE_VM), forkready posted,
parent resumes - seven in a row in t336. The write-flow freeze that
follows (wr~35, pipe empty) is therefore NOT a fork handshake hang.
The probes committed here (FBOUNCE/FCHILD/FMEM lifecycle, E11 for
every -11 syscall, MAP for every mmap with mapbump, CLONE with flags)
pin the next search to the server's reply path; note for the next
session: the script's xvfb-log dump is truncated at 260 lines and the
server's SEQ trace likely lies beyond it - widen the dump first.
The EAGAIN probe found the last blocker before a live window manager:
pthread_create mmaps the default thread stack derived from RLIMIT_STACK,
and our getrlimit answered infinity for every resource - so glibc asked
for a 2GB stack (mmap len=0x80001000, observed failing with ENOMEM),
reported it as 'creating thread: Resource temporarily unavailable', and
GLib aborted pango's FcInit worker, killing xfwm4 during GTK init in
every progressing session. RLIMIT_STACK (resource 3) now reports 8MB;
t334 is the first run of the whole effort with no GLib error and no
guest abort - the window manager survives GTK startup.
The frame map still does not complete (captures show the client window
undecorated; the WM's write flow still freezes after ~35 batches with
the pipe empty) - that protocol-level question is what remains.
The 'observed epoll_ctl variants' 266 and 406 were never epoll at all:
266 is __NR_clock_getres - the trace's 'garbage' ctl args were a
stack buffer pointer - and 406 is __NR_clock_nanosleep_time64, whose
ENOSYS return aborted pango's FcInit worker and took the whole window
manager down with 'creating thread: Resource temporarily unavailable'
(t329: the last guest action before the GLib abort). clock_getres now
reports 1ns into the caller's timespec, and clock_nanosleep_time64
sleeps per its (clk, flags, request, remain) argument order - t330's
host crash read the clock id as the request pointer.
The FcInit thread still fails with EAGAIN from another source
(t331: no unimplemented syscall precedes it now); the next probe is
logging every -11-returning call in the window manager during thread
creation.
The fork snapshot now detaches the child's guest segments, reattaches
them fresh, and pulls the parent's pages through /proc/<ppid>/mem -
RAM speed instead of a ufs-backed file that trickled 200MB at ~500KB/s.
The parent stays parked only for the seconds that copy takes: the child
runs guest code (dash) on the image before exec, and a torn copy
null-derefs (t324), so the early-release experiment is reverted.
t326 is the payoff, the first fully-progressing session since the
stall appeared: the xkbcomp children compile the keymap and exit 0,
the server enters its accept loop (listener gates cycling on both
listeners), clients complete full X setup (233 traced exchanges), and
the captures render a live xeyes window again. The window manager
still has not mapped its frames - that hunt continues - but the
non-deterministic parked-server stall that consumed the last dozen
sessions is gone.
The parent no longer parks on forkready while the child grinds the
image snapshot - the child posts the handshake first, because the
detach/reattach touches only its own mappings and every fork in this
workload execs (which discards the copy). t323 then showed the whole
truth in the server's own log: Xvfb registers its listeners (epoll_ctl
ADD fd 5, fd 9) and blocks reading xkbcomp's OUTPUT pipe - so the
server is gated on the child finishing a snapshot measured at 200MB
(the map segment's touched pages, not the earlier 60MB estimate)
trickling through the ufs /tmp. No linuxrun-side trick can make that
fast: the child must run guest code between fork and exec, so the
image must be live. The honest fix is kernel-level lazy COW for
segattached memory segments on rfork without RFMEM - a plan9 port
change, recorded here as the named next step.
The fork-handshake probes closed the case: the X server forks xkbcomp
twice at startup (FPARK) and parks on forkready while the child copies
its 60MB image snapshot page-by-page through the ufs-backed /tmp -
observed growing at ~500KB/min, i.e. hours - or, when the snapshot
create fails outright, the child exited WITHOUT posting forkready and
the parent parked forever. That single mechanism produced the zero-
accept, zero-epoll 'early stall' and the parked-Pread server state.
The child now posts forkready on every snapshot-failure exit, so the
parent can never be orphaned on the handshake whatever the snapshot
costs. Making the snapshot itself fast remains open: segattach of a
RAM scratch is refused both inside the child's note handler and (when
attached at startup) it starves the note stack's own attach; a kernel-
COW fork (private 'memory' segments + RFMEM for CLONE_VM) was built
and ran but left the server equally quiet, so it is reverted here in
favor of the stable snapshot machinery.
Probes on the epoll_ctl store, the epoll_wait listener gate, and
listenqueued's verdict settle the early stall's shape further: in a
stalling run Xvfb executes no epoll_ctl of any variant, the listener
gate never even runs, and no accept happens - while the clients post
their connections and wait. The server's wait loop must be going
through select (case 142, unprobed) or it is parked before the socket
loop entirely; instrumenting select's entry and its listener handling
is the next one-run step.
The accept4 (syscall 364) probe settles where Xorg's accepts go - and
exposes the non-deterministic early stall's shape: in stalling runs
Xvfb executes accept() not even once (ACC4 never prints) while the
clients complete their handshake write and then wait forever for the
setup reply. In progressing runs the same binary accepts normally.
The listener-readiness gate in epoll_wait (listenqueued: /srv scan
for unserved x.c.<pid>.a twins) is the remaining suspect for the
missing wakeup - the next step is logging the gate's verdict inside
Xvfb's epoll waits.
plan9 notes delivered while a bridge write is blocked (the handled
closed-pipe note among them) interrupt the write; returning an error
there made libxtrans abandon half-written replies and the client wait
forever for the rest of a big reply. Writes now retry on 'interrupted',
as POSIX intends. Trace prints carry the host pid and log small reads
regardless of opcode, which exposed the stall's true shape: the window
manager spends its last activity reading a big reply body in 160-byte
chunks (first byte stepping 165,166,...) before the stream stops with
the pipe empty on both sides - the server abandons the reply some
other way than interruption, so the hunt continues server-side.
Guest writes through bridge sockets now first drain the process's own
readable pipes into per-socket receive buffers (served to subsequent
reads, counted as readable), so a peer blocked on a full pipe always
completes - the two-pipe write deadlock cannot form without any
nonblocking-write primitive. Poll also reports POLLHUP|POLLIN once a
read gives EOF, so a closed connection surfaces to xcb instead of
hanging it silently.
The instrumentation added along the way (per-socket flow counters with
buffer/pipe occupancy) overturned the working theory: at the window
manager's stall the pipe is EMPTY on both sides - the server simply
stops replying with the connection open, pointing the next
investigation at the server's request processing (GrabServer is among
the last requests sent), not at transport deadlock.
Per-socket output buffering flushed at the wait loops was built and
tested: guest writes enqueue and never block, but the flush write can
still block, and with the server and the client each mid-flush on the
other's full pipe they wedge exactly as before (t304: the window
manager's read flow stops at a tenth of its previous run). plan9
pipes simply offer no nonblocking write. The honest fix is to change
the bridge transport itself - a shared-memory ring both endpoint
processes poll and drain without blocking - recorded here as the
fourth and remaining approach.
Guest writes through the AF_UNIX pipe bridge can block the whole
emulator when the pipe is full; with the X server mid-reply and a
client mid-request this wedges both sides (traced live: the window
manager's extension queries stop, the server's reply stream stalls,
then all traffic). Two remedies were built and tested to failure:
qlen-capped partial writes (a writer cannot stat the opposite end's
queue) and alarm-interrupted writes (the alarm note derails the nested
syscall-note handling). The comment left at the write path names the
viable design: per-socket output buffering in the emulator, flushed by
readiness signaled over a control channel between the endpoint
processes.
Every guest fork in this workload execs immediately (xkbcomp, dash,
g_spawn helpers, xterm's shell), so the child closing its inherited
bridge descriptors on the bounce is safe - and it removes the race
where a child still holding the parent's pipe ends could steal its
replies or close the connection underneath it. Exec keeps the
CLOEXEC-precise close; captures verified stable twice.
The blanket close of bridge descriptors on execve broke captures
outright; the precise rule is what Linux does - fcntl F_SETFD marks
are now remembered per descriptor, and exec closes only the bridge
fds the guest actually marked. Captures land again with all session
processes surviving, and the dbus/at-spi helper inheritance fix
stands ready for helpers that use the flag.
The sequence trace settled the stream-corruption mystery: every reply
read and every request written by xfwm4 appeared exactly TWICE - its
forked helpers (the dbus-launch/at-spi children GTK spawns at startup)
inherit the X socket placeholder and the bridge pipe ends. Both
processes then race on the same pipes: the helper steals replies the
window manager is waiting for, both read the same data across the two
readers, and the helper's exit closes the pipes under the parent (the
closed-pipe notes). Linux marks X sockets CLOEXEC for exactly this
reason: execve now closes every bridge descriptor and clears the
socket table in the exec'd image.
The trace also shows the capture slowness: each GTK-side fork copies
its ~70MB of touched pages through the u9fs-backed /tmp (lrsnap.*
files), which stalls the session under load - the snapshot needs a
fast scratch (a pre-reserved segment or a ramfs path) next.
Trace the frame-management ops a window manager issues: the first
byte of every request written (MapWindow, MapSubwindows,
ReparentWindow) and every event read back (Expose, MapNotify,
ReparentNotify, ConfigureNotify), plus periodic per-socket byte-flow
counters, all landing in each process's stderr for post-mortem.
What the trace shows so far: events do flow back to xfwm4 (it receives
the full Map/Reparent/Configure sequence), but its outgoing request
flow freezes after ~35 requests while reads continue - it blocks
waiting for a reply that never arrives - and intermittently the pango
FcInit worker-thread creation still fails with EAGAIN and aborts GTK
at startup. Both are now precisely observable for the next round.
The 128MB map region exhausted under a full GTK stack: the pango
FcInit worker's pthread_create failed with EAGAIN and GLib aborted the
program ('GLib-ERROR: creating thread', surfaced as the mysterious
late-session death of every XFCE component). Restore the 512MB map
with ld-linux at 0x68000000 - the combination that previously held a
full desktop session for fifty minutes.
With that, xfwm4 runs stably through whole sessions: it takes over
the root, reparents the existing client windows (the captures turn
empty as the client is unmapped into its frame), and both xwd
captures complete cleanly. The frame re-map after reparenting is the
remaining gap before decorations appear in screenshots.
The closed-pipe note handler now prints when it matches, so survival
across dead-client writes is observable.
stat64/fstat64 claimed every regular file is r--r--r--, so xterm's
shell validation (a regular file with an executable bit) rejected
/bin/sh itself and exited at startup, and any helper search that
checks executability saw a rootfs with no programs at all. The mode
now carries the x bits of the underlying file.
The kernel's "write on closed pipe" note took its default disposition
and killed whichever process touched a dead client's socket - on
Linux every toolkit ignores SIGPIPE and expects EPIPE, so the note is
now handled. (One delivery path still escapes the handler and kills
GTK clients late in a session; the trigger and a remaining X-reply
parse corruption are under investigation.)
Also ship an /etc/shells and fix the rc test-negation in the capture
script: plan9 rc lexes '!test' as one word, which silently skipped
every guarded xwd retry.
The kernel reports "no ancillary data, no flags" by clearing
msg_controllen and msg_flags on recvmsg return; leaving the caller's
values in place let CMSG_FIRSTHDR walk uninitialized stack as a
cmsghdr - when the stale bytes looked like SCM_RIGHTS, xcb copied a
garbage fd-count into its fd array and died of the wild pointers that
followed. With both fields zeroed, xwd captures the root window while
a GTK client (xfwm4) is connected, which never survived before.
xterm exits at spawn when seteuid/setegid fail; the setresuid32 and
setresgid32 calls now succeed like the rest of the identity group.
The X bridge used to report every polled fd ready; xcb then read
before writing its setup request and both ends of the connection
blocked forever. Readiness for a bridge socket now comes from the
pipe's stat length (pipestat reports qlen), poll(2) blocks until
something is actually ready, select(2) was rewritten with the same
honesty instead of clearing caller bits, and epoll_wait no longer
replays registration flags like EPOLLET back as events (Xorg read
them as socket errors and dropped every client). Socket reads honor
the guest's O_NONBLOCK and return EAGAIN instead of blocking.
The listen/setsockopt socket calls no longer fall through into
getsockopt's optval write, which used to dereference stale stack
beyond the two-word listen argument array and zero the first word of
whatever pointer lived there - on Xvfb that was the listener's
transptr, crashing TRANS(Accept) with a NULL+0x20 fault. getsockname
and getpeername answer with the bridge path, sendmsg/recvmsg work
through the direct syscalls as well as socketcall, and dup/dup2 keep
the socket table mapped.
To make a full desktop session viable: the guest map segment grows to
128MB, ld.so loads clear of it, clone children install their CLONE_SETTLS
descriptor (without one the first stack-canary access trips the
protector), the fork snapshot copies only touched pages through a
scratch file (a 500MB+ guest can no longer malloc or segattach a
spare copy in the note handler), and statfs64 fills exactly the
84-byte i386 buffer - the previous 120-byte fill smashed the caller's
stack and aborted every GTK program at startup. Fake ptys (two pipe
pairs through the socket table), termios ioctls, inotify, eventfd and
friends let xterm spawn a shell and GLib start its worker threads.
Verified in QEMU boots: Xvfb serves clients through the bridge, xwd
captures a 1024x768 root screenshot with xterm's window visible at
+120+120, and xfwm4, xfdesktop and xfce4-panel all initialize and stay
alive for the length of a session. A remaining bug garbles the reply
stream when a client sends while a large GetImage reply is still in
flight, which kills xwd in the full-session screenshot; the
capture-by-single-client path is the reliable workaround.
The marshaled /srv directory stream carries NUL bytes in its
qid/type fields, so the listener-readiness strstr stopped at the
first one and never saw the client's x.c.<pid> queue entries -
the observed 'LSRV n=522 hit=0' while ls /srv showed the entries
present. Both the readiness check and the accept scan now use a
length-delimited memfind over the bytes actually read.
readv/writev bypassed the socket-descriptor table and wrote X
requests into the placeholder file descriptor instead of the
bridge pipe, so a connected client never actually sent anything;
they now run through sockreadfd/sockwritefd like read/write.
Also bounds the epoll idle yield to after 64 consecutive empty
polls. linuxrun-smoke stays green.
The exit-status trace showed the silent exits were Xvfb aborting at
transport open: parking socket placeholders at 200+ via dup failed
inside the guest, so every socket() call died. Placeholders are
again the first real fd, bumped past 0-2 so a placeholder never
lands on stdio (fd 0 routed every stdin read through the socket
map). With that, Xvfb again reaches its server loop with a
compiled keymap, the xkbcomp children exit 0, and server and
client both stay alive across long runs.
epoll_wait with a zero timeout now sleeps a millisecond when it
has no events: the X server's scheduler polls epoll_wait(0) in a
tight loop and starved every other guest process, wedging the
boot before the test script could finish. linuxrun-smoke stays
green.
The client posts its pipe ends as /srv/x.c.<pid>.a and .b, but both
the epoll listener-readiness check and the accept scan searched for
the string 'x.a.' from an earlier design - the listener was never
reported ready and the accept never found the queued connection, so
the X server sat in an empty epoll loop while the client waited.
Both now scan for x.c.<pid>.a with its x.c.<pid>.b twin.
Socket placeholders are parked at descriptor numbers 200+ (via dup)
instead of the first free fd: a placeholder landing on fd 0 put
every stdin read through the socket map (observed as 'RD 0 to 0'
reading a zero packed pair). linuxrun-smoke stays green.
Guest socket descriptors are real plan9 fd numbers backed by a
translation table to the bridge's pipe pairs: synthetic high ids
leaked into guest pointer slots and crashed libc writes through
them. socket/accept allocate the slot (a #c/pid placeholder),
connect fills in the packed pair, close releases it, and the
read/write decoders consult the table.
poll now honors its timeout - a negative timeout means block, and
returning instantly from such polls made X clients spin at 100%
cpu and starve the server. sendmsg/recvmsg follow msg_iov at
msghdr offset 8 instead of treating the msghdr itself as the
vector array, and getsockopt writes its optval only through sane
pointers (SO_ERROR checks after a nonblocking connect).
With this, Xvfb accepts a client, survives, and both server and
client sit properly blocked in their event loops. linuxrun-smoke
stays green.
Modern i386 glibc also issues the direct socket syscalls (359-371),
so socket/bind/connect/listen/accept4/sendto/recvfrom now route to
the same handlers as the socketcall multiplexor - without this the
X server's accept() went to an unimplemented syscall and failed on
every call.
accept no longer blocks or leans on the host filesystem: the client
connect posts both of its pipe ends to /srv (x.c.<pid>.a/.b), and
the accept scans the /srv directory - kernel-global and never
blocking - for a pending client, returning EAGAIN when none is
queued, exactly what the X server expects of its listener. The
epoll listener entry is reported readable only while such an entry
exists, and with a directory buffer large enough to see past the
stock /srv entries (they sort before x.*). Client descriptors now
pack the client's own pipe ends: read from s2c[0], write to
c2s[1]; the opposite ends are the server's.
With this an X client connects, the server accepts, and the X
exchange begins (xwd spins up 8+ minutes of CPU processing the
session). linuxrun-smoke stays green.
epoll_create handed back a real plan9 fd whose number could collide
with the guest's own descriptors, so the epoll_ctl registrations and
the epoll_wait calls ended up keyed to inconsistent epoll ids and the
X server's wait never reported its listener. Synthetic high ids keep
them stable, and with that an xterm connects to Xvfb through the
AF_UNIX bridge.
The int 0x80 gate posted its 'linux sys' note and returned without
delivering it, so the guest re-executed the int 0x80 and queued note
after note; once NNOTE filled, postnote failed and the kernel killed
the process with 'suicide'. Shells died this way right after their
signal setup. Both gates now call notify() right after posting, and
syscalls no longer wait for a timer tick to be delivered.
The socket bridge no longer reaches through /proc/<pid>/fd (devproc
exposes fd as a file, not a directory). The listener posts its pipe
end to /srv via devsrv (write the decimal fd), the request file
carries the srv name, and the client posts both of its pipe ends the
same way; connect and accept exchange names only.
epoll_create/epoll_ctl/epoll_wait (254/255/256) work: ctl now stores
the target fd from the third argument (it stored the op code), and
create hands back a placeholder descriptor. vfork (190) maps onto
the fork implementation (dash vforks for every external command and
reported 'Cannot fork'). Abstract-socket connects return
ECONNREFUSED so Xlib falls back to the pathname transport, and the
guest environment carries DISPLAY.
With this, Xvfb reaches its server loop with a compiled keymap
(Xorg forks, dash runs 'sh -c xkbcomp', xkbcomp exits 0), clients
connect through the bridge, and an exec'd dynamic binary runs end
to end. linuxrun-smoke stays green.
getppid is 64 (case 61 was ustat), and 199-202 are the *32 id
variants: getuid32/getgid32/geteuid32/getegid32. Returning ENOSYS
for those made shells' privilege-drop checks read garbage; _llseek
is 140 and returns ESPIPE on pipes; plus wait4 (reaps via the plan9
wait with the exit status shifted into WEXITSTATUS form), getcwd,
and PATH/HOME in the guest environment.
With these, an exec'd dynamic binary runs end to end: /bin/echo
loads through ld.so, pulls in libc.so.6 from the arena, and writes
its output. linuxrun-smoke stays green.
Forking from inside a note handler needed several coordinated fixes:
- Kernel: notify() now stacks nested notes below the interrupted sp
when it already runs inside the note stack, instead of overwriting
the live outer frame. Fork no longer replays the parent's queued
notes into the child (a delivery before re-registration would set
its notified state and kill it on the next trap note), and the
child inherits the LDT page (foreign TLS entries are per-process
state), fixing 'bad segment selector in noted' in forked children.
- linuxrun: the note-stack segment is attached 'memory', never
'shared' - a forked child resumes at the parent's exact sp and
would otherwise push frames over its live handler pages. Children
inherit the segment COW and only re-register it with the kernel
(segment slots are exhausted by guest memory, which made fresh
attaches fail). The fork child resumes by bouncing off the ud2
starter (noted() without a note kills it), the parent parks on a
pipe until the child is on its own stack, and fd tables are copied
(RFFDG), not emptied.
- execve: argv/path are deep-copied before the image reload detaches
the old stack they live on, the interp is loaded once (a duplicate
load collided with itself and left a corrupted image), the arena
segment is re-attached after the reload, the entry no longer
resumes at entry+2 (the handler's pc+=2 landed mid-instruction,
which pushed a NULL stack pointer into ld.so's bootstrap), and
countargs returns the true argc.
- AF_UNIX bridge: bind/connect read sun_path at its real offset
(sockaddr+2, the family bytes were being used as the path), stat64
reports directories as directories (xtrans' lstat check), abstract
sockets fail cleanly, and packed bridge fds decode their pipe ends
for read/write/send/recv/close.
- Syscall table: setuid32/setgid32 (Popen children _exit(127)
without them), getuid32/getgid32/geteuid32/getegid32 (shells'
privilege-drop logic), _llseek with ESPIPE on pipes, fcntl64,
wait4, getppid, getcwd, umask, PATH in the guest environment.
Verified: Xvfb now forks twice, runs 'sh -c xkbcomp' children with
fully working ld.so+libc loading, and a directly-exec'd dynamic
/bin/echo produces output. linuxrun-smoke stays green.
The i386 socketcall ABI passes the operation number in ebx and the
argument-array pointer in ecx; dosocketcall took a single pointer and
read a[0] from ebx - i.e. from address 1 (SOCKOP_socket) - faulting
the emulation handler as a nested note and killing the process
silently. Split the interface: the operation selects the case, the
arguments come from the ecx array, and every subop now indexes that
array with the correct socketcall layout. (This was the crash we
chased for two turns as a "wild jump into the loader's text" - the
death pc was always inside the handler's own dispatch, misread because
the nested-note path dies before user-space dumps can run.)
Plan 9 delivers notes by building the ureg/message/handler frames below
the interrupted sp - for foreign binaries that is the GUEST stack, and
glibc's lazy PLT resolver keeps live working data below its sp across
the syscalls it makes, so the note frames overwrite resolver state and
leave host pointers in guest-readable scratch (the X stack resolved one
such pointer as a call target - the deterministic jump into the
loader's own text). A process marked via /dev/mark can now also write
the top of a user-attached segment to /dev/notestack; notify() then
builds every note frame on that private stack instead. linuxrun
attaches 32KB at 0x5f000000 and re-attaches a pid-slotted stack in
fork children; nothing below the guest sp is ever touched by the kernel
or the emulation again.
(Attaching the stack from inside the devldt write corrupted the
writing process - the attach must happen in user space; the kernel only
records the address.)
The guest inherits plan9's flat %fs (base 0), so an fs-relative access
would land in low linear memory - this loader's own text - which is
how the Xvfb crash signature reads (a jump to loader+0x2c20 executing
garbage, reading address 1, dying as a nested note). After
set_thread_area installs the descriptor, syscall resumes also load
%fs with the TLS selector like %gs; the starter no longer touches fs
(selector 0x33 before the entry exists makes noted() reject the
frame and kills the process - hello.elf caught that).
Kernel debug scaffolding from the Xvfb chase (fault/register/TCB/
stack-scan dumps, gate trace) removed; the diagnostic facts it
captured: at the crash the TCB is healthy, sysinfo points at ld.so's
int80 shim, gs/fs selectors are valid, and the death is a nested note
on the syscall after uname - the next session should single-step it
under the QEMU gdbstub.
Plan 9's syscall vector is 0x40, so a foreign int $0x80 lands as a
general-protection trap - previously it killed the process unless the
exact site had been rewritten to ud2, which cannot reach the int $0x80
sites inside ld.so's bootstrap or inside libraries ld.so maps itself
(our mmap cannot tell text from data). Processes marked via
/dev/mark (devldt) now have their int-$0x80 GP delivered to the note
handler as "linux sys", which emulates and advances; ld.so loads the
whole Xvfb closure and runs 366 syscalls through this gate. The ud2
rewriting stays for the images linuxrun loads itself - the trap frame
is cleaner and the raw-syscall tests depend on it. execve carries an
LD_BIND_NOW environment; fork children snapshot their guest memory
privately so libc's post-fork state writes do not corrupt the parent
(clone threads keep sharing).
Xvfb's remaining crash is deterministic and narrow: right after
LockServer/uname, one call goes to an unrelocated Xvfb+0x2b47 (a PIE
IFUNC/GOT edge during its own init) - the next milestone, with the
register/stack dump tooling already catching it.
mremap answers MREMAP_MAYMOVE callers by copying into a fresh range
from the arena instead of failing; growing malloc arenas in the X
stack needed it. The Xvfb bring-up frontier is now a single call
during ld.so relocation that jumps to an unrebased offset (crash at
ld.so+0x2b47 after uname) - one linker detail from the server loop.
dup, dup2 and dup3 map onto plan9 dup (with a close of the target for
dup2), and access answers existence. Part of the X11 bring-up
surface; Xvfb's glibc now walks past sigprocmask storms, lock files
and socket setup, and dies at one unresolved call (fault at an
unrebased address) after its uname - the remaining item before the
server loop.
The desktop binaries need a much wider kernel interface than applets
did: AF_UNIX sockets (bridged over plan9 pipes through /proc/fd, with
bind publishing a listener and connect handing over a data pipe pair),
clone/fork (guest segments now attach as shared so children and threads
keep the image whole, and the kernel gives each fork child its own LDT
page), execve (the image is reloaded in place and registers reinstalled
so X's fork+exec of helpers works), getdents64, the epoll family
(registered fds report ready; the single-threaded server blocks in the
read that matters), poll/select, pipe, link (exclusive-create copies
for lock files), stat64 by path, mkdir, nanosleep, fcntl, a polling
futex, ioctl TIOCGWINSZ, and the uid/sid no-op set.
With this surface, ld.so resolves the ENTIRE Xvfb dependency closure
from the Debian archive (thirty-plus libraries: libGL, pixman, Xfont2,
freetype, systemd, gcrypt...) inside the Debian namespace; Xvfb starts
its glibc, passes epoll setup and lock-file creation, and dies at one
unrebased call during startup - the next fix. scripts/fetch-xfce.sh
materializes the staged root (gitignored as fetched payload).
linuxrun now loads PT_INTERP images: the interpreter lands at a fixed
base with its segments, the PIE main lands at its own, and the auxv
carries AT_BASE, a corrected AT_ENTRY describing the main program (the
entry point itself is ld.so's), plus the phdr set. mmap honours
MAP_FIXED with a zeroing allocator, fstat64/fstatat64 report real
sizes and unique st_ino (ld.so dedups libraries by dev:ino - a zero
inode made libc.so.6 alias the main program and "load" it without ever
mapping), and pread64 joins the syscall set.
The proof runs in the Debian namespace, where the interpreter and
libc.so.6 sit exactly where Debian installs them: a stock coreutils
/bin/echo (PIE, dynamically linked against libc.so.6) prints through
ld.so, symbol binding, relocation and libc startup, and exits zero -
invoked both the kernel way (PT_INTERP) and explicitly through
ld-linux.so.2 with --library-path. The smoke asserts the interpreter
path end to end alongside the static tiers.
The auxv carried AT_PLATFORM under type 33, which is AT_SYSINFO_EHDR:
glibc parsed the "i686" platform string as a vDSO ELF header and
walked phdrs through the resulting garbage pointer. AT_PLATFORM is 15;
with that fixed, the real Debian busybox-static package (glibc, TLS,
vsyscall sysinfo trampoline) runs its applets: echo writes, uname
reports "Linux taiji ... i686 GNU/Linux", and cat copies files - the
last one needing openat, which is implemented for the AT_FDCWD form
alongside fstatat64.
The smoke now proves the whole ladder in the guest: build linuxrun,
run raw-syscall static binaries (write/exit, file I/O), exercise real
thread-local storage, then execute the Debian-archive busybox echo and
cat end to end. Debian binaries that need dynamic linking against
ld.so are the remaining tier.
glibc's i386 syscall stub reaches the kernel by calling through the
TCB sysinfo pointer (AT_SYSINFO) rather than int $0x80 for part of its
startup, which our int-80 patching never sees; with no AT_SYSINFO the
pointer is null and the first such call (set_tid_address) jumps to
zero. linuxrun now hands out an AT_SYSINFO trampoline in the mmap
arena holding ud2;ret, so those calls funnel into the same syscall
emulator as the patched sites. Static glibc gets correspondingly
further: past TLS setup, set_robust_list/rseq probes, ugetrlimit and
into brk-driven allocation.
Debugging support for the remaining frontier: guest faults now dump
registers and stack words so the caller of a bad call is visible, and
-p/-P try AT_PHDR as the ehdr base or omitted. The Debian busybox
still faults in static-glibc init reading a phdr through a garbage
pointer (0xc5762d24, first loop iteration, e_phnum picked up as
0x666c) whose source is independent of the auxv - the next milestone,
likely wanting QEMU gdbstub single-stepping through _dl_aux_init.
Linux binaries reach their TLS through %gs, which needs a real segment
descriptor. The kernel grows /dev/ldt: writing 8-byte descriptors
installs per-process entries that are re-staged on every switch back
into the process. Under QEMU the LDT path loads descriptors with a
zero base (LLDT itself works, entries verify, selectors read back, but
segment loads through it come out flat), so the same entries are also
mirrored into the unused APM GDT slots - which is how Linux itself
numbers i386 TLS (entry 6, selector 0x33) - and those work everywhere.
noted() accepts the TLS selectors for fs/gs, and the entries are forced
to user privilege with gates refused.
linuxrun answers set_thread_area by installing the descriptor (the
i386 TCB at positive offsets needs a plain 4GB expand-up segment, not
the wraparound trick), hands back entry 6, and passes a full Linux
auxv: PHDR/PHENT/PHNUM, PAGESZ, ENTRY, uid/gid set, RANDOM, EXECFN,
PLATFORM. Guest argv is passed through. The smoke proves the whole
TLS path with a raw-syscall test binary that installs a canary TCB,
loads %gs and reads it back through %gs:0.
Static glibc gets past TLS allocation and set_thread_area with this
(the Debian busybox-static binary from the archive is staged as a test
asset); its later startup still jumps through a null pointer, which is
the next milestone before Debian-archive binaries run.
linuxrun now runs real static i386 Linux ELF programs instead of only
inspecting them. The loader maps the PT_LOAD segments with
segattach("memory") at their addresses (coalescing adjacent ones, since
the kernel allows only a handful of attachable segments per process),
rewrites every int $0x80 site in the executable bytes to ud2, builds
the Linux initial stack with argv and auxv, and starts the program by
bouncing off a ud2 trap whose note handler installs the entry
registers. Each later ud2 fault is a syscall, emulated from the Ureg
registers: exit, read/write and the iovec variants, open/close with
Linux flag mapping, brk and anonymous mmap carved from one arena,
uname, pid/uid family, llseek, ioctl. The 386 kernel has no NX, so
the mapped pages execute as-is.
The pc kernel config gains the segment driver the loader depends on,
and linuxrun-smoke now proves execution end to end: it builds linuxrun
in the guest and runs two real static Linux binaries from the tree -
one printing through write(2), one doing open/read/write/close on a
file - asserting their output. Dynamic ELF programs (glibc, TLS,
futex) are the next milestone toward Debian-archive binaries.
The selector now works in two stages driven by two registries:
lib/namespaces lists the bootable TaijiOS namespaces (Plan 9, Debian)
and lib/wms lists the window managers each namespace supports (Rill and
Rio for Plan 9, Rill for the Debian root), so the matrix lives in data
instead of session commands. Enter moves from the namespace cards to
the window manager cards (headed by the chosen namespace), Esc goes
back, and the same confirming-click rule as before keeps stray clicks
from starting anything.
The old flat session catalogs are gone: web and local boots now share
the one matrix, and the profile no longer special-cases q9web. Wine
joins the registries when its namespace lands.
The Debian root now bootstraps itself with the TaijiOS toolchain:
/386/bin is unioned behind the rootfs own /bin and /usr/bin, so
commands like tar and gunzip work before any package is installed and
packages extracted later shadow the TaijiOS fallbacks, not the other
way round. deb/install also accepts the data.tgz member name (plan9
gzip compresses data.tar to data.tgz, and the member scan skipped it).
debian-smoke now proves the full lifecycle with a compiled payload: it
builds a C program with 8c/8l in the guest, packs it as a gzip .deb by
the book (debian-binary, control.tar, data.tgz through ar), installs it
with dpkg --root inside the namespace, runs the installed binary and
matches its output. The Debian archive itself still needs xz/zstd
members and Linux ELF execution before its packages install.
debian-session builds an FHS-shaped root and binds it over /, chroot
style, entirely with Plan 9 namespaces: TaijiOS binaries and rc are
grafted at /taiji/bin, the kernel devices (cons, env, proc, srv, disks,
draw, mouse, net) appear under the new /dev and /net, and /lib is
unioned in behind the rootfs so Rill and the Kryon apps find their
config, theme and fonts while Debian payloads still write into the
rootfs. Entering the session sets root@debian identity, the Debian path
and namespace=debian.
Package installs work through the Debian pipeline: a dpkg front end in
the rootfs drives deb/install, an ar+tar .deb unpacker that extracts
data payloads into the root and records control stanzas in
/var/lib/dpkg/status (xz/zstd data members are rejected until the
decompressors exist). debian-smoke builds a real .deb in the guest,
installs it with dpkg, runs the payload and checks the status db.
The namespace selector offers Debian with Rill as its window manager
(debian-session rill), in local boots and in the web image; Rio stays
Plan 9 only. Fixes along the way: a mangled device bind was dropped,
draw/mouse devices are bound so window managers work inside, and the
session command now execs its arguments instead of feeding them to rc
as a script file.
A single click on a session card launched it, so the click that only
focuses the emulator in the browser could start the Plan 9 session by
itself and the desktop booted into rio instead of waiting for a choice.
Clicking a card now just selects it; clicking the highlighted card
again starts it. Enter still starts the highlighted session.
The web image offers the Plan 9 session and carries its desktop menu,
but the binaries the menu launches were not in the root, so Themes,
Control Panel and friends were dead entries in the browser. Add
q9display, q9taskmgr and q9themes next to explorer and rio9, and have
driver-smoke assert the whole desktop binary set.
Explorer, q9taskmgr, q9display and q9themes were libdraw programs that
imitated the Kryon look by scraping the th_ palette images rio publishes.
Run them on the Kryon runtime instead: the system theme drives their
colors, input goes through the runtime's mouse and key queries, and the
th_ scraping goes away. q9themes now reads the palette catalog straight
from the library, so it lists the themes the desktop actually ships
(15) instead of a stale local copy of 12.
Behavior is preserved: explorer keeps the tree, history, list and icon
views, the recycle bin with restore bookkeeping, and wctl window
launches; its menus, prompts and properties dialogs are now states of
the single frame loop instead of nested event pumps. q9taskmgr keeps
the /proc and /dev/wsys actions with one-second refresh, q9display
keeps the wallpaper and saver wctl messages, q9themes keeps the
theme kryon:... wctl message.
The four commands move into their own directories with mkfiles linking
libkryon like the rest of the desktop; the stray binary copies that sat
next to the old flat sources are gone (the installed /386/bin copies
are the real ones).
Replace the hand-rolled libdraw picker with a Kryon runtime app so the
boot selector carries the system theme and the TaijiOS look instead of
its own fixed colors: theme background, surface and button cards, hover
highlight, and Kryon's default font. Input moves to the runtime's mouse
and key queries (arrows, Tab, Enter, Esc; click a card to launch), and
the session launcher keeps the same rfork + rc semantics, including the
web catalog flag. The command moves to sys/src/cmd/nsselect with a
proper mkfile linking libkryon like the other desktop commands.
The kryon plan9 backend now compiles kry_image_decode.c and
libdraw_audio.c against files bundled in the raylib vendor submodule, so
the smoke needs that nested checkout; the other vendor trees stay
unfetched.
The web boot set q9web=1 and glenda's profile answered by exec'ing rill
directly, so the namespace selector never ran there; nsselect and its
catalog were not even shipped in the web image. Ship nsselect, rio9 and a
web session catalog (Rill first as the default, plus the Plan 9 namespace;
Debian needs a rootfs the image does not carry), and let q9web only pick
that catalog instead of skipping the selector.
The boot menu now defaults to the desktop after 3 seconds, so the page no
longer injects keys to pass it; that stray Enter used to dismiss the
selector right after it appeared. An explicit ?boot=N still picks a menu
item.
Drop the hero copy card that overlay the running emulator: the VM
autostarts, so the card only covered the desktop.
Both app mkfiles now include kryon's mk/plan9-app.mk, the Kryon
library carries KryAppDataRoot for the per-user data policy, and both
binaries are rebuilt against them.
Both apps now generate their Plan 9 C directly from the Kryon
compiler's plan9-safe mode - the per-app rewriter scripts are gone and
the binaries are rebuilt from that output.
Boot the tree under QEMU, rebuild libkryon.a with 8c, compile, link,
and run a probe covering SHA-256, JSON, and the theme catalog, and
link Rill to exercise the app-facing library surface end to end. Runs
as make kryon-smoke and in CI: on pushes that touch the desktop stack,
daily against kryon master regardless of the taiji pin, and on demand
for any kryon ref. This is the check that would have caught the kryon
master Plan 9 build breakage immediately.
The web-boot root extractor needs an explicit record for every parent
directory of appended files: carry the Rill registry files and the app
icons with their directory chains, plus the ape library, header, and
script parents whose records were silently failing to extract.
Inner Breeze and Pass join Shelf, Rill, and ktrem as preinstalled
Kryon applications: each builds from its source under /sys/src with a
plan9 mkfile, installs to /386/bin, and appears in the Rill launcher
and the q9 desktop menus. Rill now reads its launcher list from
/lib/rill/applications with icons through /lib/rill/icon.map instead of
a hardcoded list.
The web boot image grows to carry the new applications: the image
builder rewrites the gzfilesystem header and partition map wholesale
and extends the raw image when the preinstalled set outgrows the base
partition, and the whitelist carries the app binaries, the Rill
registry, and the app icons.
Also refresh libkryon.a from kryon master (Plan 9 fixes for the newer
UI toolkit surfaces, cursor calls, rename, SIZE_MAX, ksync crypto) and
teach the Rill build about ktrem's app chrome and the shelf host
symbols.
Picks up the Plan 9 fixes on kryon master (fmaxf/fminf shim, 8c-safe
form rows and scaffold code, rename and SIZE_MAX shims) and the
app_storage object Pass needs.
Teach linuxrun to decode ELF program headers, report load segments and unsupported dynamic/TLS cases, and provide analyze-only and built-in smoke modes.
Add linuxrun smoke helper targets and ignore generated pcvirt/linuxrun build byproducts.
Add APE source compatibility helpers for common Linux/POSIX APIs, introduce linuxrun as the Linux ELF inspection entrypoint, and add a lean pcvirt kernel profile for virtio-backed VM runs.
Add scripts/taiji-support.sh plus Makefile targets to verify the support stack through q9.
- verify.sh boots the VM and pixel-checks the welcome balloon,
live window drag, task manager chord, icon drag with persisted
positions, icon menus and the My Computer launch
- monclick.sh gains hover, right click, double click and drag
helpers plus monkey() for monitor-injected keys, which are far
more reliable than VNC key events
- the smoke suite closes the run dialog and drives the task
manager chord through the monitor channel
- vncsend.py primes the VNC connection before sending keys
- File/Edit/View/Help menu bar with dropdowns: New Window, New
Folder, Close; Cut/Copy/Paste/Select All; Large Icons/List and
Refresh; About
- My Computer special view: Local Disk (C:), Floppy (A:), CD-ROM
(D:), Control Panel, Recycle Bin, My Documents with drive icons;
unreachable drives report 'not accessible' like win2k
- the My Computer desktop icon opens the new view
- desktop icons can be dragged anywhere; positions persist in
$home/lib/deskicons, Arrange Icons re-grids and forgets them
- right click on an icon opens its own menu (Open, Delete Icon,
with deletions remembered in $home/lib/deskdel)
- the Recycle Bin icon shows crumpled paper when the bin holds
anything; Empty Recycle Bin refreshes it
- window moves are live: originwindow blits the window with its
pixels during the drag and a single wresize restores invariants
on release (rubber band is gone)
- tray balloon tips: a welcome balloon after logon and feedback
when the theme or wallpaper changes via wctl
- double click tolerance widened to 900ms for remote/VNC pointers
- fix Ctrl+Shift+Esc: plain Ctrl+Esc no longer swallows the chord
- hourglass cursor while a launch is in progress
- splashdone wakeups cover every waiting thread
Boot 1 of the suite now also checks the desktop icons, the
populated Programs submenu, the Run dialog, the Ctrl+Shift+Esc
task manager and the desktop context menu. monclick.sh gains
hover and right click helpers, vncsend.py can hold modifier keys
for chorded shortcuts.
- /lib/q9/programs feeds Start > Programs (acme, terms, games...)
- /lib/q9/desktop lays out the default desktop icons: My Computer,
My Documents, Recycle Bin, Control Panel, Acme
- Control Panel System no longer says lola; Display launches
q9display
- q9display: win2k Display Properties with Background, Screen
Saver, Appearance and Settings tabs; applies through the new
wctl wallpaper/theme/saver commands
- q9taskmgr: win2k Task Manager with Applications (End Task via
wsys), Processes (End Process via notes) and Performance tabs
graphing /dev/cputime and /dev/swap
- Back/Forward toolbar buttons with a directory history
- right click menus for items and the background
- New Folder and Rename through a win2k style prompt dialog
- delete moves files to $home/.trash with an origin record; the
Recycle Bin tree entry lists them with Restore and Empty
- copy/cut/paste, properties dialog, selection in list and icon
views, Enter opens and Del deletes the selection
- files open in jot instead of acme
- desktop icons from /lib/q9/desktop and $home/lib/desktop, single
click select, double click launch; button 3 on the desktop opens
the win2k context menu (classic rio menu moves to the 1-2 chord)
- generic win2k widgets: popup menus, modal text entry
- Start > Run dialog with command history, replacing the q9run
terminal prompt; clock double click opens a calendar
- taskbar: right click on a task button opens the window system
menu, Show Desktop quick launch, ticking clock, hover tooltips
- Alt+Tab task switcher, Alt+F4 close, Alt+Space window menu,
Ctrl+Alt+Del security dialog with lock/logoff/shutdown/task
manager, Ctrl+Shift+Esc task manager
- shut down dialog Log off now really logs off
- window system menu on the title bar icon and title right click,
minimize animates to the taskbar button, launch hourglass
- wctl gains theme, wallpaper and saver commands; win2k titles get
the gradient fill; screen saver bounces the flag after an idle
timeout
Log Out no longer reboots the VM. rio ends the session itself:
killprocs() terminates every window's command, the logon screen is
shown again (same dialog as at boot, owning mouse and keyboard while
the mouse and keyboard threads are parked on a logonchan gate), and
logging in returns to a fresh desktop. The logon backdrop repaints on
each blink tick so late window-cleanup restores are covered.
Verified with two consecutive logout/login cycles in one boot (single
init start, no reboot). The old q9logout reboot script is gone; the
menu item routes to the in-rio logout directly.
Before this the splash and logon screens showed the kernel's default
black arrow; the cursor rio uses after login (whitearrow) is now set
at the start of the splash thread, so the machine uses one cursor
style throughout boot, logon and desktop.
Shut Down now opens a proper Windows-2000 style modal dialog inside
rio (title bar, What do you want the computer to do?, radio choices
for Shut down / Restart / Log off, OK and Cancel) instead of spawning
a console. All choices end the session and come back through the boot
splash and logon screen.
The reboot write needed the kernel argument: writing plain "reboot"
to #c/reboot makes rebootcmd exit the writing process instead of
rebooting, so rio, the logon screen and the rc scripts now write
"reboot /386/9pc". Verified: dialog OK reboots the VM through a full
fresh session.
The start menu also opens with Ctrl+Esc (the classic shortcut); the
host window manager usually swallows the bare win key before QEMU
ever sees it. Console-path input has no release events, so ctrl state
is tracked from the rune stream.
q9 no longer forces a full rio rebuild on every boot (mk does the
right thing incrementally; boots after a code change rebuild only the
changed files, other boots are instant). The test suite now waits on
gui ready instead of the copy step that no longer happens.
VNC now binds 127.0.0.1:1 (port 5901, Q9_VNC_DISPLAY to override) so it
no longer collides with a libvirt SPICE server on 5900. Q9_TEST=1
exports q9splashslow in the guest to stretch the splash phases for the
test harness.
test.sh: the menu check now requires the white highlight bar (the raw
kernel boot console is also black with white text and was matching),
and wait_bar polls long enough to cover the slowed menu phase. The
suite passes 6/6.
Map the left/right Windows keys to a Win rune in the pc kernel kbd
tables; rio's keyboard tap consumes the key (both /dev/kbd k-lines and
console c<C> strings, tracking hold/release so chords don't retrigger)
and toggles the start menu.
Fix the start menu launch bug: menuactivate called menuhide() before
evaluating mitems[menusel].cmd, but menuhide resets menusel to -1, so
the argument read mitems[-1]; Shut Down and Log Out silently launched
nil. The command is now captured first. Same fix in the submenu branch.
q9shut logs reboot-write errors; q9logout ends the session via a clean
reboot back to the logon screen (init's console respawn does not
replay the login profile, so a plain kill of the session process would
strand the terminal at a shell prompt).
The splash accepts q9splashslow=1 (set by the q9 launcher under
Q9_TEST=1) to stretch the boot-menu and progress-bar phases so the
headless test harness can observe them.
test.sh boots the VM headless twice and pixel-verifies the whole
boot flow via QEMU monitor screendumps: boot manager menu, progress
bar, logon dialog, taskbar, start menu and safe mode (6 checks).
monclick.sh injects monitor mouse clicks (homing to 0,0 first and
stepping deltas at <=127, larger PS/2 deltas get mangled),
ppmcheck.py asserts pixel properties, vncsend.py/vncclick.py are
minimal RFB clients (handshake incl. pixel format, encodings and an
update request), dbgsafe.sh is an interactive splash-click debugger.
Screendump artifacts are gitignored.
Add --headless: no GTK window, VNC on 127.0.0.1:5900 and a unix
monitor socket for screendumps, so sessions can run and be tested
without a display. Fix --raw to write the prerio rebuild script like
the clean console does; without it raw boots silently ran a stale
rio, since every boot uses -snapshot.
Glenda's profile now sets the mouse to linear under q9: the VNC
absolute pointer maps through QEMU with 1:1 deltas, and the old
accelerated setting made the guest cursor drift away from the
client, landing clicks in the wrong place.
Boot now plays a Windows-2000-style sequence before the desktop:
an ntldr-like boot manager menu (Plan 9 / safe mode without the
panel, click or dwell to choose, 6s default countdown), the classic
animated segmented progress bar, and a logon dialog with user name,
password field (dots, blinking caret, backspace/Delete work), OK
and Shut Down buttons. The splash runs as a real thread on the mouse
and timer channels; mthread, keyboardtap and desktop startup are
gated on a splashdone channel, and the desktop background is
repainted after the splash. q9nosplash=1 skips it.
Start menu: restore panelinit/panelmouse/panelcontextmenu dropped in
the menu rework, rename Log Off to Log Out and wire it to q9logout
(kills rio; init restarts the session through the logon screen),
and implement Shut Down (q9shut: prints the win2k shutdown message
and reboots the VM) and Run... (q9run: opens a command in a new
window via wctl).
Loaded 100 of 321 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.