Skip to content

chore(kernel): límite limpio vs IR0-userspace (sin dbgshell)#28

Merged
IRodriguez13 merged 6 commits into
devfrom
chore/kernel-userspace-boundary
Jul 26, 2026
Merged

chore(kernel): límite limpio vs IR0-userspace (sin dbgshell)#28
IRodriguez13 merged 6 commits into
devfrom
chore/kernel-userspace-boundary

Conversation

@IRodriguez13

@IRodriguez13 IRodriguez13 commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Publica el acoplamiento canónico: Documentation/USERSPACE.md + userspace/README.md → sibling IR0-userspace.
  • Retira el userspace de laboratorio del kernel: debug_bins/, kernel/init.c (dbgshell PID1), opciones Kconfig asociadas; boot solo kexecve("/sbin/init").
  • Incluye WIP tty/CSI/termios y smokes desktop (smoke_desktop_cmd_matrix, smoke_desktop_nano_mnt) alineados con ash/nano en el sibling.

Test plan

  • make -s kernel-x64.bin
  • python3 scripts/architecture_guard.py
  • make -s build-matrix-min
  • make -s -C tests/host run (22/22)
  • make smoke-runit-boot / run-console con sibling clonado
  • Confirmar que make run-dbgshell sale con mensaje de retirado

Sibling

Repo userspace: https://github.com/IRodriguez13/IR0-userspace


Note

Medium Risk
Product boot and release gates now depend on a sibling repo and documented removal of the in-kernel debug shell; misconfiguration or missing IR0-userspace fails loudly but changes how developers and CI must lay out trees.

Overview
Draws a hard product boundary: Unix userland (runit, BusyBox, login, doas, /etc) belongs in the sibling IR0-userspace repo; the kernel only delegates via IR0_USERSPACE_ROOT, make check-userspace, and headers_install. New USERSPACE.md (and Spanish mirror) is the canonical coupling guide; userspace/README.md is a pointer only.

Retires the in-kernel lab shell in documentation and operator paths: debug_bins/, kernel/init.c / dbgshell PID1, and CONFIG_KERNEL_DEBUG_SHELL / DEBUG_BINS* are documented as removed; boot is only kexecve("/sbin/init"), make run-dbgshell fails fast, and mandocs mark IR0-debug-bins as historical.

Repoints paths and gates across backlog, roadmap, STABLE, KTM, and MAKEFILE docs from setup/runit, setup/busybox, and debug_bins to IR0-userspace (packages/busybox, services/runit_*, lib/ir0_smoke_tag.h). Adds structured logging chapter KLOG.md and refreshes boot/security/userspace mandocs (klog phases, OpenDoas/set-id exec instead of sudo_auth).

Housekeeping: .gitignore drops vendored BusyBox/runit build noise, adds *.runit.stamp and .kernel-maintainer-index.yaml; new subsystem docs for PS/2 demux, virtual file read semantics, TTY/nano contract, and tracked debts (tty_canon_block_wake, events0-device-id, nano scrollback).

Note: This diff is overwhelmingly documentation and ignore rules; code removal and TTY/desktop smokes are described in the PR body and changelog waves even where not every deleted file appears in the patch hunk list.

Reviewed by Cursor Bugbot for commit b02b21f. Bugbot is set up for automated code reviews on this repo. Configure here.

El árbol del kernel cargaba el producto Unix completo (runit, BusyBox, login,
doas, /etc, recovery) y sus vendors, así que cualquier cambio de userspace
tocaba el repo del kernel. Esta oleada aplica la frontera acordada: si PID 1
puede reemplazarlo sin recompilar el kernel, no vive en IR0. El userspace pasa
a IR0-userspace y el kernel lo consume por IR0_USERSPACE_ROOT y headers_install.

Cambios funcionales:
- Salen del árbol setup/runit/, setup/busybox/ y los vendors BusyBox/runit/
  OpenDoas; el producto ahora se construye en IR0-userspace con recetas
  fetch/build/rootfs/image y verificación sha256.
- Nueva UAPI pública en includes/uapi/ y target headers_install para exportarla
  al sysroot del userspace; tests/host y el build del kernel la consumen.
- Makefile: IR0_USERSPACE_ROOT + check-userspace; build-runit, build-opendoas,
  build-busybox-ir0-*, load-userspace-runit, busybox-* y los inject de smoke
  delegan en el hermano y fallan con mensaje claro si no está clonado.
- Los binarios de smoke de producto (doas/passwd/matriz BusyBox) se compilan en
  IR0-userspace/out/smoke/ en vez de ensuciar setup/pid1/.
- El test host de política de cuentas (crypt/shadow) sale de tests/host del
  kernel; queda en IR0-userspace/tests/host con runner propio.
- Modelo de privilegios: /proc/[pid]/stat estilo Linux, start_ticks en
  process_t, syscalls getsid/getpgid, creación de ficheros con uid/gid
  efectivos (POSIX) y minix_fs_utimens real; con eso OpenDoas persist queda
  VERIFIED (DOAS_PERSIST_OK).
- Consola: los tags de smoke salen por /dev/serial y el banner se escribe de
  forma atómica, así la consola humana queda limpia.
- Perfiles de producto en /etc/ir0-profile: development (autologin root con
  advertencia), desktop (hostname login: y root bloqueado), appliance (sin
  login interactivo).
- Fix: el centinela /etc/ir0-root-login-disabled (23 bytes) se truncaba en
  silencio por el límite de 14 bytes de MINIX v1, de modo que el bloqueo de
  root nunca se aplicaba; renombrado a /etc/ir0-noroot.
- Higiene: repo_hygiene_guard y .gitignore sin las rutas movidas; se eliminan
  variables muertas RUNIT_SRC_DIR/RUNIT_VERSION.

Tests:
- arch-guard, repo_hygiene_guard, kernel-x64.bin, build-matrix-min: OK.
- tests/host del kernel 22/22 OK; tests/host de IR0-userspace 1/1 OK.
- smoke-runit-boot, smoke-runit-login-nonroot, smoke-passwd, smoke-doas
  (incluye DOAS_PERSIST_OK), smoke-setuid-exec, smoke-recovery,
  busybox-matrix, busybox-profiles-check: OK.
- Arranque manual de los perfiles desktop (ir0 login:) y appliance
  (CONSOLE_NO_LOGIN) en QEMU.

Archivos eliminados (por directorio):
- setup/runit/ (fuentes, rootfs, scripts de instalación)
- setup/busybox/ (configs, perfiles, matriz)
- setup/third-party/busybox-1.36.1/, runit y opendoas vendorizados
- scripts/busybox_*.sh, tests/host/test_userspace_auth_policy.c
- debug_bins/cmd_sudo.c, fs/passwd_db.c, includes/ir0/passwd.h,
  setup/pid1/{irinit.c,su_setuid_smoke.c}

Archivos nuevos destacados:
- includes/uapi/ir0/syscall_linux.h
- arch/x86-64/grub-recovery.cfg
- fs/flock.c, kernel/cmdline.c, includes/ir0/{cmdline.h,flock.h,klog_event.h}
- interrupt/arch/x86-64/{early_idt.c,early_idt_stubs.asm}
- scripts/{ctr.sh,ir0-qa.sh,run_pid1.sh,smoke_runit_login*.py}
- setup/pid1/{setuid_exec_smoke.c,setid_helper.c,setid_script.sh}

Documentación: mandocs userspace/security (en+esp), ROADMAP (hito SEP-2),
STABLE y TREE_CONTRACT del árbol de escritorio reflejan el nuevo layout.

Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
…userspace

El producto solo hace kexecve("/sbin/init"); el userland Unix vive en
IR0-userspace. Se elimina el shell mono in-kernel, kernel/init.c y todo
debug_bins/, con Kconfig/Makefile/ktest alineados. Queda el directorio
userspace/ (puntero) y Documentation/USERSPACE.md.

Incluye soporte tty/CSI/termios y smokes desktop (matrix/nano) del WIP
previo necesarios para ash/nano en el sibling.

Tests:
- make kernel-x64.bin OK
- python3 scripts/architecture_guard.py OK
- make build-matrix-min OK
- make -C tests/host run 22/22 OK

Archivos nuevos:
- Documentation/USERSPACE.md
- userspace/README.md
- scripts/smoke_desktop_cmd_matrix.py
- scripts/smoke_desktop_nano_mnt.py
- setup/pid1/binprobe_smoke.c

Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
@IRodriguez13

Copy link
Copy Markdown
Owner Author

Docs follow-up pushed: full Documentation/ + SETUP/AGENTS + Spanish mirrors for the userspace boundary (USERSPACE.md / esp/USERSPACE.md, retired debug-bins mandoc).

Actualiza mapa de docs, STABLE/BACKLOG/CHANGELOG/KLOG, mandocs (boot,
userspace, debug-bins como histórico), SETUP y espejos en
Documentation/esp/. Añade Documentation/esp/USERSPACE.md.

Archivos nuevos:
- Documentation/esp/USERSPACE.md

Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
El cursor software borraba la columna 0 en ONLCR (\r+\n). Se guarda/restaura
el glifo bajo el cursor. syslog(2)/klogctl habilita BusyBox dmesg. Escala FB
entera máxima + GTK zoom-to-fit=off para menos blur en QEMU.

Tests:
- make kernel-x64.bin OK
- arch-guard OK
- tests/host 22/22 OK
- load-userspace-runit reinject con /usr/bin/nano

Archivos modificados:
- drivers/video/console.c
- drivers/video/console.h
- drivers/video/console_renderer.c
- kernel/syscalls/io_syscalls.c
- kernel/syscalls/io_syscalls.h
- kernel/syscalls/syscall_dispatch.c
- Makefile

Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
@IRodriguez13

Copy link
Copy Markdown
Owner Author

Pushed console/dmesg/scale fix + userspace nano inject.

Merge BLOCKED note: dev has branch protection with Require pull request reviews (required_approving_review_count: 0) and Enforce admins. GitHub still marks the PR mergeStateStatus: BLOCKED until that rule is satisfied or relaxed (e.g. set approving reviews to 0 and turn off “Require approvals”, or temporarily disable enforce admins / add a self-approval via a second account, or use admin merge if available).

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 5 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 431effa. Configure here.

Comment thread scripts/smoke_desktop_cmd_matrix.py Outdated
Comment thread .kernel-maintainer-index.yaml Outdated
Comment thread scripts/make/qa.mk
static int render_cursor_row;
static int render_cursor_col;
static char render_cursor_under_ch = ' ';
static uint8_t render_cursor_under_color = CONSOLE_RENDERER_COLOR_DEFAULT;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSI erase-up mode mishandled

Medium Severity

For CSI J, mode 1 (erase from screen start through the cursor) is handled like mode 0 (erase from cursor to end). Only mode 2 gets distinct full-screen clearing. Full-screen apps and nano that emit ESC[1J leave incorrect text on the console and can break desktop TTY smokes.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 431effa. Configure here.

Comment thread Makefile Outdated
Repository owner deleted a comment from cursor Bot Jul 25, 2026
Corrige el flood de runsv (fchdir pasaba path kernel por
validate_userspace → EFAULT), hace interruptible cat /dev/hda
(Ctrl+C), implementa ESC[1J, reduce glifos FB a escala 1× y
atiende hallazgos Bugbot (matrix DEBUG_BINS, prompts ir0|unix,
stamp de profile, index maintainer fuera del árbol).

Cambios funcionales:
- ir0_chdir_resolved + sys_fchdir sin puntero userspace.
- tty_deliver_sig a current_process; write/consola y disk read
  comprueban signals_pause_should_interrupt.
- CSI J mode 1 (erase to cursor); CONSOLE_FB_SCALE_MAX=1.
- O_CREAT padre ausente → ENOENT; stamp guarda IR0_PRODUCT_PROFILE.
- Smokes aceptan hostname ir0|unix; matrix sin DEBUG_BINS_GROUP_BT.

Tests:
- arch-guard OK; tests/host 22/22; smoke-runit-boot PASS.

Archivos modificados:
- .gitignore
- Makefile
- drivers/video/console.c
- drivers/video/console.h
- drivers/video/console_renderer.c
- fs/devfs.c
- includes/ir0/console.c
- kernel/syscalls/fs_path_syscalls.c
- kernel/syscalls/fs_path_syscalls.h
- kernel/syscalls/fs_syscalls.c
- scripts/make/qa.mk
- scripts/smoke_desktop_cmd_matrix.py
- scripts/smoke_runit_login_nonroot.py

Archivos eliminados:
- .kernel-maintainer-index.yaml

Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
Cierra la serie de contratos de entrada/TTY/pseudo-fs y el panic por
double-free en pipelines setuid, sin hacks específicos de nano o cat.

Cambios funcionales:
- Demultiplexación i8042 (AUXDATA) teclado/mouse; set-1 L/R; paquetes PS/2.
- Snapshot por open en /dev/net y /dev/kmsg con offset/EOF/dup/fork.
- console_get_geometry fuera de VBE; scrollback a CONSOLE_MAX_WIDTH.
- pipe_close_end: wake antes de free; un solo kfree en última ref.
- Panic: uptime decimal, PID, creds; banner en FB/VGA.
- Smokes mouse/TTY, tty_raw_probe, doas|dmesg|grep, nano; docs EN+ES.

Tests:
- host: ps2_set1, ps2_mouse_pkt, pipe_close_refcount (33/33).
- ktest: All 38 passed (dev_net_contract).
- QEMU: mouse-tty, tty_raw_probe, doas-pipe, smoke-desktop-nano PASS.

Archivos modificados y nuevos: PS/2, console/typewriter, devfs, pipe,
oops, syscalls/fdtable, ktest, smokes, Documentation/input|filesystems|tty|debts.

Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
@IRodriguez13
IRodriguez13 merged commit ce92e7f into dev Jul 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant