Commit Graph

3273 Commits

Author SHA1 Message Date
Red Bear OS 1f82624025 init: /usr driver-manager + netstack must not block boot-to-login 2026-07-16 12:46:46 +09:00
Red Bear OS 8aa8616d5e init(ptyd): 00_ptyd.service must be scheme=pty, not notify
ptyd was migrated to the SchemeDaemon/ready_with_fd path: it registers the
"pty" scheme and signals readiness by sending its scheme cap fd back to
init, which init receives via call_ro(FD) in its scheme-service startup.
The service was still declared type="notify", so init waited for a plain
readiness byte ptyd never sends and blocked forever at ptyd — before the
console/login stack could start (post-switchroot boot hang). Declare the
correct type={scheme="pty"} so init uses the matching fd-receive path.
2026-07-16 11:41:34 +09:00
Red Bear OS aa372cf5c1 hwd(acpi): gate per-LNK routing enumeration to debug
The ACPI _LNK object enumeration logged 50+ INFO lines per boot on QEMU
(one per _UID/_CRS/_STA/_DIS/_SRS/_HID method), flooding the console and
slowing serial boot. This is PCI interrupt-routing detail, not needed at
INFO on every boot; move it to debug.
2026-07-16 11:16:01 +09:00
Red Bear OS 99e08650a4 DIAG: log service spawn/wait; temporarily revert switch_root chdir to test spawn hang 2026-07-16 10:41:15 +09:00
Red Bear OS 9dae3cda91 init: try prefix then / for post-switchroot CWD (/usr is not a chdir target) 2026-07-16 09:29:24 +09:00
Red Bear OS 9255eacc02 init: chdir into new root on switch_root so daemons inherit a valid CWD (fixes base-env zsh hang blocking login) 2026-07-16 09:14:24 +09:00
Red Bear OS 1fb3b7c243 inputd: fix producer-write regression — let producer event writes fall through to distribution (was EINVAL, crashing ps2d and killing all input) 2026-07-16 08:27:50 +09:00
Red Bear OS 8818ababbb init: keep boot stdio on kernel console (observable boot) instead of redirecting to /scheme/log 2026-07-16 08:04:02 +09:00
Red Bear OS 2b48b9e966 pcid: log PCIe->I/O-port fallback at info; fbcond: transient no-display at debug 2026-07-16 06:39:43 +09:00
Red Bear OS 32bb63f360 revert TEMP DIAG: re-enable switch_stdio to /scheme/log 2026-07-15 23:57:22 +09:00
Red Bear OS a5680cae92 TEMP DIAG: keep init stdio on kernel console (disable switch_stdio) for headless boot visibility 2026-07-15 23:44:08 +09:00
Red Bear OS 85574c22f1 daemon: drop cmd before readiness wait so early child exit yields EOF (fix hwd/acpid spawn deadlock) 2026-07-15 23:27:40 +09:00
Red Bear OS 8c657b3645 hwd: only spawn acpid when acpi scheme not already registered (fix boot hang) 2026-07-15 23:13:09 +09:00
Red Bear OS d69afbc732 acpid: exit cleanly when acpi scheme already registered (hwd double-spawn) 2026-07-15 22:56:00 +09:00
Red Bear OS e087ff8b71 ptyd: expose PTS number via dup(master, ptsname) for getty slave open 2026-07-15 22:12:37 +09:00
Red Bear OS 54e4c5751c ptyd: accept ptmx as master open; strip init/daemon boot debug spam 2026-07-15 21:38:39 +09:00
Red Bear OS 194a77df11 fix(ptyd): use SchemeDaemon/ready_sync_scheme to send cap fd to init
ptyd was the last initfs daemon still using the old Daemon +
register_sync_scheme + daemon.ready() pattern, where ready() writes a
plain readiness byte. init's scheme-service startup does call_ro(FD)
expecting to receive the scheme cap fd (the SchemeDaemon/ready_with_fd
protocol every other daemon uses), so init blocked forever waiting for
an fd that never arrived, hanging the boot after ptyd.
2026-07-15 15:45:49 +09:00
Red Bear OS db724cda70 init: use blocking waitpid to avoid busy-loop spam 2026-07-15 03:20:47 +09:00
Red Bear OS 3a7c96b19f merge: combine 0a358aa0 (diag + libc::pipe2 fix) with 104da7de (init FILETABLE fix) into canonical submodule/base
Both branches independently fixed the FILETABLE desync bug. This merge creates a single canonical history that preserves the diagnostic commits from 0a358aa0 and the eexist-focused fix from 104da7de.

After this merge, the per-fork submodule/<name> branch (this is the AGENTS.md-mandated canonical ref) is a child of both, so origin can fast-forward to it.

(NO AI attribution in commit message body, per project policy)
2026-07-14 12:19:46 +09:00
Red Bear OS 0a358aa05f diag(base): trace fd transfer in init, daemon, and logd
Add diagnostics to pin down where the INIT_NOTIFY fd handoff hangs:
- init/src/service.rs: log read_pipe fd and call_ro results
- daemon/src/lib.rs: log cap_fd, write_pipe, and call_wo result
- logd/src/main.rs: explicit ready_sync_scheme result and setrens fallback

These are temporary diagnostics for the boot-hang investigation.
2026-07-14 11:19:31 +09:00
Red Bear OS 1e341ff782 init: fix pipe FILETABLE desync — use libc::pipe2 instead of raw syscall
create_pipe() used raw syscall::openat/syscall::dup which allocate kernel
fds WITHOUT registering in relibc FILETABLE. Later FILETABLE-managed
syscalls (Command::spawn -> relibc pipe2) reserve the same fd numbers,
causing EEXIST in kernel insert_file.

Replace with libc::pipe2 which goes through relibc FILETABLE-aware path.
2026-07-13 20:22:31 +03:00
Red Bear OS 104da7de12 init: fix FILETABLE desync causing EEXIST on all daemon spawns
create_pipe() used raw syscall::openat() (SYS_OPENAT) and syscall::dup()
which bypass relibc's FILETABLE-managed fd allocation (SYS_OPENAT_INTO).
This created phantom fds known to the kernel but not to relibc's userspace
FILETABLE. When Command::spawn() later called relibc's pipe2() for
fork+exec error reporting, the FILETABLE allocated a position it thought
was free, but the kernel rejected it with EEXIST (errno 17).

This killed EVERY daemon spawn during boot: logd, randd, zerod, rtcd,
nulld, acpid, pcid, inputd, lived, redoxfs, pcid-spawner, fbcond, vesad,
fbbootlogd, hwd, ps2d — all failed with 'File exists (os error 17)'.

Fix: use libc::pipe2() which goes through relibc's FILETABLE-managed
path (FdGuard::open → SYS_OPENAT_INTO), keeping tables in sync.
2026-07-13 00:47:05 +03:00
Red Bear OS 6e5da7259a rb: remove FEXEC_STEP reference (removed from redox_rt)
Commit bb20fe9c in relibc fork removed FEXEC_STEP diagnostic from
redox_rt::proc. The bootstrap binary in base referenced it in
exec.rs:257, causing build failure:
  error[E0425]: cannot find value  in module

Removed the diagnostic step variable and simplified the panic message.
Build now compiles cleanly.
2026-07-12 23:46:28 +03:00
Red Bear OS 5e5657e4dd rb: add verify exclusion for RB-replaced upstream functions
52 functions documented as intentional RB replacements across:
- initfs (8): RB uses different initfs tooling
- driver-graphics KMS (16): RB refactored display layer
- ihdgd Intel GPU (5): RB driver refactoring
- vesad (2): RB framebuffer refactoring
- virtio-gpu (12): RB async GPU refactoring
- inputd/input/net (3): RB daemon pattern refactoring
- pcid (2): RB PCI refactoring
- xhcid USB (4): RB USB refactoring
- redoxerd (1): RB executor refactoring
- netstack (1): RB network refactoring
- ramfs (2): RB filesystem refactoring
2026-07-12 16:55:59 +03:00
Red Bear OS 8f50862be5 Fix create_pipe: bypass redox_rt::sys::open two-step that consumes has_run_dup
Use direct syscall::openat with ns_fd to get pipe READ end, then
syscall::dup with 'write' to get WRITE end. This avoids the
redox_rt::sys::open bug where step 2 (openat_into_posix on the
pipe read end) consumes has_run_dup, leaving the subsequent dup()
unable to get the write end.
2026-07-12 15:18:01 +03:00
Red Bear OS dce10c4eb2 fix: bypass ns_fd in pipe creation via libredox::open
The init process's ns_fd may be stale after exec, causing EBADF when
pipe2() calls redox_rt::sys::open (which needs current_namespace_fd()).
Use libredox::Fd::open + syscall::dup instead, bypassing the FILETABLE
and ns_fd dependency entirely.
2026-07-12 12:41:32 +03:00
Red Bear OS 234ce3ab1a diag: print pipe() error details in service.spawn 2026-07-12 11:57:10 +03:00
Red Bear OS ab0da30613 fix: register external fds with userspace FILETABLE
Socket and RawEventQueue create fds via libredox raw syscalls that
bypass the redox-rt userspace FILETABLE. FdGuard::dup then reserves
these positions, causing SYS_DUP_INTO to destroy the existing fds.
2026-07-12 10:29:06 +03:00
Red Bear OS 7ba6cff32d diag: remove PM: debug prints from procmgr bootstrap
Removes the 6 libredox::call::write(1, b'PM:N') debug trace lines from
procmgr::run() that were polluting serial output during early boot.
2026-07-12 05:17:55 +03:00
Red Bear OS 1ed140e018 fix: move ACPI S3/battery methods from impl Drop to impl AcpiContext
The suspend_to_ram, read_battery_status, and read_battery_info methods
were incorrectly placed inside 'impl Drop for PhysmapGuard'. They
reference fields (aml_symbols, fadt) that only exist on AcpiContext.
Move them to impl AcpiContext and fix field access (self.fadt.as_ref()
instead of self.fadt()).
2026-07-12 04:14:34 +03:00
Red Bear OS 3fe7b12434 fix: add try_map_bar, try_pci_allocate_interrupt_vector, fix try_mem return type
- try_mem now returns Result (matching caller expectations)
- try_map_bar: non-panicking BAR mapping on PciFunctionHandle
- try_pci_allocate_interrupt_vector: non-panicking IRQ allocation
- virtio-core: reverted .ok_or() back to .map_err() for Result type
2026-07-12 02:48:16 +03:00
Red Bear OS 4932cb4d62 fix: add try_port() to PciBar and try_irq_handle() to LegacyInterruptLine
Non-panicking variants needed by ac97d, vboxd, and other drivers that
prefer error handling over panics.
2026-07-12 02:39:59 +03:00
Red Bear OS bf9989b7c0 fix: add try_mem() to PciBar, fix virtio-core caller
Added try_mem() returning Option<(usize, usize)> for non-panicking
memory BAR access. Fixed virtio-core/probe.rs to use .ok_or() instead
of .map_err() to match the Option return type.
2026-07-12 02:34:09 +03:00
Red Bear OS be2d7503c9 chore: gitignore Cargo.lock (build artifact) 2026-07-12 02:26:18 +03:00
Red Bear OS 0422712e29 fix: add sndbuf/rcvbuf to Socket accept initializer
The accept() method was missing sndbuf and rcvbuf fields that were
added to the Socket struct. Inherit values from the listening socket.
2026-07-12 02:25:20 +03:00
Red Bear OS f2092fa973 fix: correct redox-ioctl patch path in Cargo.toml
The [patch] section pointed to ../../relibc/source/redox-ioctl which
doesn't exist. Fixed to ../relibc/redox-ioctl matching the main
dependency path at line 114.
2026-07-12 02:23:20 +03:00
Red Bear OS b59dffc0ff fix: replace 8 .expect("TODO") panic points with proper error handling
- on_sendfd: subscribe/dup errors return error Response instead of panic
- fork/new_thread: subscribe errors propagate via ? operator
- signal delivery (4 sites): status fd write errors are best-effort (let _ =)

The procmgr is the first userspace process manager — a panic here kills
the entire system. These changes make it resilient to transient fd errors.
2026-07-12 01:51:11 +03:00
Red Bear OS 00b799d512 absorb: 41 orphaned base patches re-applied (Phase 1.0A)
Per local/docs/PATCH-PRESERVATION-AUDIT-2026-07-12.md the base
fork was carrying only 38 of 100 patches in local/patches/base/.
The other 62 patches' content was silently missing from the fork
working tree, even though their .patch files were preserved.

This commit re-applies 41 patches that genuinely still apply
cleanly + 17 hunks that partially applied. Recovery covers:

- D-Bus initfs service wiring (P4-initfs-dbus-services)
- USB service wiring (P4-initfs-usb-drm-services)
- netcfg/dhcp/dhcpv6 driver fixes
- acpid shutdown/PM/quirk fixes
- inputd/ps2d hard-fail logging
- pcid driver interface refinements (server cmd channel)
- virtio-core for VirtualBox support
- ixgbed/rtl8139/rtl8168 net drivers
- ahcid NCQ + per-function interrupt coalescing
- logd persistent logging
- bootstrap procmgr race-condition fixes
- cargo version pin to +rb0.3.0 (synchronized release branch)

58 files changed, +1444/-318 lines.

Untracked mnt/ tree and *.orig / *.rej files cleaned up after
patch application (leftover from absolute-path patch headers).
2026-07-12 01:29:08 +03:00
Red Bear OS 5023b72728 Cargo.lock: regenerate after Cargo.toml version sync (branch 0.3.0 -> 0.3.1)
- bytemuck 1.25.0 -> 1.25.1 (patch bump)
- bytemuck_derive 1.10.2 -> 1.11.0 (minor bump)
- Other minor patches refreshed

Part of Phase 0 fix for G1 (Cargo.lock drift).
The suffix-only drift +rb0.3.0 -> +rb0.3.1 was already
applied on master via cargo generate-lockfile. The
other entries are non-Cat-2 transitive bumps that
catches with the lockfile refresh.

No functional change to Cat 2 fork entries (those
already match Cargo.toml at +rb0.3.1).
2026-07-12 01:15:16 +03:00
Red Bear OS 75f6cf902d bootstrap: restore upstream exec.rs from commit 372b200f
Our Red Bear patches had reverted the userspace fd allocation refactor
(commit 372b200f) in exec.rs. This caused FD tracking mismatches
between the userspace FILETABLE and the kernel fd table, resulting in
EEXIST errors and fork failures.

Restored the upstream version which correctly uses redox_rt::sys::*
functions (openat, dup, sys_call_ro) that go through the FILETABLE,
and openat_into_upper for pre-init FD allocation. Also includes the
filetable_binary_fd setup and same_process flag in ExtraInfo.
2026-07-11 17:23:29 +03:00
Red Bear OS aedc416f0c bootstrap: fix FD allocation to match upstream userspace fd model
The bootstrap's start.rs used libredox::call::openat which resolved to
the bootstrap's own redox_openat_v1 in initfs.rs, calling syscall::openat
(SYS_OPENAT). This let the kernel allocate POSIX FDs 0,1,2 for
stdin/stdout/stderr, but the userspace FILETABLE was never updated.

Later, exec.rs called auth.dup(b'cur-context') via redox_rt::sys::dup,
which asked the empty FILETABLE for a free slot (returning 0), then
passed it to SYS_DUP_INTO. The kernel rejected it with EEXIST because
posix_fdtbl[0] was already occupied by stdin.

Fix: use syscall::openat_into to directly specify FD slots 0,1,2 in
start.rs, and use syscall::dup_into with a computed FD index for
cur-context in exec.rs. Both bypass the FILETABLE, which is only
populated later by redox_rt::initialize_freestanding.
2026-07-11 17:02:37 +03:00
Red Bear OS f4c7552767 bootstrap: fix refutable pattern for Option<FexecResult> 2026-07-11 14:21:59 +03:00
Red Bear OS 479138d02f bootstrap: adapt to upstream redox-rt API changes
- ExtraInfo now requires filetable_fd and same_process fields
- fexec_impl now returns Option<FexecResult>
2026-07-11 14:13:50 +03:00
Red Bear OS 979b5fa55c base: update Cargo.lock 2026-07-11 12:02:49 +03:00
Red Bear OS bd595851e2 base: apply Red Bear patches on latest upstream/main
251 files: init, acpid, ipcd, netcfg, ihdgd, virtio-gpud, scheme-utils,
inputd, block driver, ptyd, ramfs, randd, initfs bootstrap, path deps,
version +rb0.3.1, author attribution
2026-07-11 11:39:24 +03:00
Jeremy Soller 1b17b3fc24 Merge branch 'pty-redoxer' into 'main'
redoxerd: Proper pty init

See merge request redox-os/base!303
2026-07-10 17:35:02 -06:00
Wildan M eb48b04b54 redoxerd: Proper pty init 2026-07-10 11:22:55 +07:00
Jeremy Soller 9e12870329 Remove unused redox-rt from Cargo.toml, it is defined in bootstrap/Cargo.toml 2026-07-09 13:09:02 -06:00
Jeremy Soller 9a855b3c43 Merge branch 'main' into 'main'
ptyd: add documentation for the `pty' scheme's resources

See merge request redox-os/base!302
2026-07-08 16:30:43 -06:00
Connor-GH 46965493a0 ptyd: add documentation for the `pty' scheme's resources 2026-07-08 13:13:06 -05:00