logd scheme.rs:
- Kernel log reader: don't break loop on 0-byte read. /scheme/sys/log
presents a snapshot; breaking loses all future entries. Now polls
with a 50ms sleep on drain, continuing to capture new kernel logs.
Also slice buffer to actual bytes read to avoid processing stale data.
- read(): return EBADF instead of silent Ok(0) stub. Logd handles are
write-only sinks; reading is not a valid operation.
- fcntl(): return ENOSYS instead of silent Ok(0). No fcntl operations
are implemented for log handles.
- fsync(): remove TODO comment; behavior (Ok(())) is correct since the
output channel guarantees FIFO delivery.
ipcd uds/stream.rs:
- events(): remove 'TODO: block on write buffer'. Backpressure is now
applied at the scheme level.
- fevent(): filter EVENT_WRITE based on peer receive buffer fullness
against sender's SO_SNDBUF. Prevents busy-spin when buffer is full.
- write_inner(): check backpressure before accepting data. Return
EAGAIN (non-blocking) or EWOULDBLOCK (blocking) when peer buffer
would exceed SO_SNDBUF limit. Only applies to established connections.
- handle_sendmsg(): same backpressure check for sendmsg path.
initfs tools/src/lib.rs:
- Replace hardcoded PAGE_SIZE=4096 constant with runtime detection via
sysconf(_SC_PAGESIZE). Handles 16K/64K page ARM hardware correctly.
Falls back to 4096 with logged warning if sysconf fails or returns
an invalid value.
Round 6 stub scan follow-up: resolves three FIXMEs in the SHM scheme
daemon (ipcd/src/shm.rs).
* O_RDONLY/O_WRONLY/O_RDWR handling (was line 51): the Handle enum now
tracks readable/writable booleans derived from the open flags'
O_ACCMODE bits. read() returns EACCES on write-only handles; write()
returns EACCES on read-only handles. When no access mode is specified
(acc == 0), both read and write are permitted (preserves prior behavior).
* Zero-fill on truncate (was line 232): MmapGuard::grow_to now zeroes
the byte range [old_len, new_len] on every growth, both in the
in-capacity path and the new-allocation path. This ensures ftruncate-
extended bytes read as zeros per POSIX SHM semantics, and prevents
stale data leakage after a shrink-then-grow cycle. A zero_range helper
method centralizes the write_bytes call.
* Zero-fill on read (was line 293): the grow_to zero-fill guarantee
ensures all bytes within [0, self.len] are properly initialized (zeros
or written data), so reads within the logical size always return valid
data. The FIXME is removed and a null-base guard was added to read()
for defensive safety.
UdsStreamScheme::getsockopt held an outer socket_rc.borrow() across the
whole option match. The SO_PEERCRED branch calls get_connected_peer(id),
which itself does borrow_mut() on the same socket — a RefCell
double-borrow that panicked ipcd and took the UDS scheme down (observed
in QEMU boot logs as ipcd crash at uds/stream.rs plus tokio
UnixStream::pair / 'failed to create UnixStream' failures from clients
calling getsockopt(SO_PEERCRED)).
Borrow only inside the branches that read socket fields (SNDBUF/RCVBUF);
the SO_PEERCRED branch now runs without an outer borrow held.
(Change found as uncommitted work in the fork; committing to unblock the
clean-fork build gate and to preserve the fix.)
Sync the base fork with 13 upstream commits (xhci event-processing
dedup + IRQ race fix, randd permission simplification, nvmed TimeSpec
fix, /dev/ptmx, fpath legacy-path cleanup, dynamically-linked init
fix, and more). Brings process_one_event into the tree, satisfying the
verify-fork-functions gate for base.
Conflicts resolved (3 of 8 overlapping files; 5 auto-merged):
- drivers/usb/xhcid/src/xhci/irq_reactor.rs: took upstream's
process_one_event/EventProcessResult refactor (b2ed85ea) including
the a01d3ce6 race fix (process events between NoEvent and
unmasking), and re-applied the Red Bear SPURIOUS_REBOOT quirk on the
NoEvent warning (downgrade to debug when quirked).
- randd/src/main.rs: took upstream's permission-handling
simplification (e26db606); re-applied the RB fcntl improvement
(F_GETFL/F_GETFD/F_SETFL/F_SETFD handling, Linux random_fops xref)
and the is_cpu_feature_detected early-return cleanup. Dropped
test_scheme_perms (deleted by upstream's simplification).
- Makefile: kept upstream's new /dev symlink block (dev/null, ptmx,
random, urandom, zero, tty, stdin/stdout/stderr).
Verified: cargo check clean; 57/57 tests pass (xhcid 35, usbhubd 14,
xhci trb 8); verify-fork-functions.sh --no-fetch base reports all
upstream functions present.
For fbbootlog, fbcon and the disk drivers there is no load bearing use
of the fpath output. And for chan relibc already handles both the legacy
and new format.
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).
EOF used to be triggered by unmounting a scheme, but this is no longer
the case since namespaces got moved to userspace. Unmounting now only
closes the scheme root fd.
* sendmsg(2) on `SOCK_STREAM` with zero-byte payload is a no-op even if
ancillary data is present. Note that this does not apply to
`SOCK_DGRAM`.
* Pass the `msg_flags` to `get_connected_pear` as non-blocking behaviour
may be requested.
Signed-off-by: Anhad Singh <andypython@protonmail.com>