From 9e317d9f6ef2c7127972641c3b7d9e094abea9a2 Mon Sep 17 00:00:00 2001 From: vasilito Date: Mon, 27 Jul 2026 18:34:25 +0900 Subject: [PATCH] local/docs: commit first-round audit + superseded-doc-log The first-round assessment (NETWORKING-AND-DRIVERS-SYSTEMATIC- ASSESSMENT-2026-07-27.md) was never committed to the parent 0.3.1 branch. It captures the docs audit that preceded the code audit (now at NETWORKING-AND-DRIVERS-CODE-ASSESSMENT-2026-07-27.md). Both files live in the repo as the docs and code halves of the audit series. SUPERSEDED-DOC-LOG.md is the change-log file referenced from local/docs/legacy-obsolete-2026-07-25/SUPERSEDED.md. Previously untracked; this commit makes it visible to the doc audit trail. --- ...RIVERS-SYSTEMATIC-ASSESSMENT-2026-07-27.md | 1058 +++++++++++++++++ local/docs/SUPERSEDED-DOC-LOG.md | 150 +++ 2 files changed, 1208 insertions(+) create mode 100644 local/docs/NETWORKING-AND-DRIVERS-SYSTEMATIC-ASSESSMENT-2026-07-27.md create mode 100644 local/docs/SUPERSEDED-DOC-LOG.md diff --git a/local/docs/NETWORKING-AND-DRIVERS-SYSTEMATIC-ASSESSMENT-2026-07-27.md b/local/docs/NETWORKING-AND-DRIVERS-SYSTEMATIC-ASSESSMENT-2026-07-27.md new file mode 100644 index 0000000000..2e40fb5754 --- /dev/null +++ b/local/docs/NETWORKING-AND-DRIVERS-SYSTEMATIC-ASSESSMENT-2026-07-27.md @@ -0,0 +1,1058 @@ +# Red Bear OS — Networking & Drivers Systematic Assessment (2026-07-27) + +> **MASTER FIX/IMPROVEMENT INDEX** for the network stack + drivers + daemons + utils surface. +> This document is the single consolidated assessment. Canonical sub-plans are cross-referenced, not duplicated. + +## 0. Document Status & Scope + +### 0.1 Purpose + +This is the canonical **systematic assessment** of every networking, driver, daemon, and util surface in Red Bear OS that touches the network or hardware stack. It is the **single index** that an operator or contributor reads first when: + +- triaging a defect in networking, a driver, or a system daemon, +- planning which subsystem needs validation next, +- understanding what is "implemented but unproven" vs "missing", +- prioritizing P0 work across the network stack. + +It does NOT replace the per-subsystem implementation plans (which own the per-subsystem +roadmaps and per-step verification). It IS the umbrella that synthesizes defects, +gaps, blockers, and bad practices across all of them. + +### 0.2 In-Scope Subsystems (21) + +Wired TCP/IP · Ethernet drivers · DHCP · Wireless (iwlwifi + linux-kpi) · Bluetooth · +USB stack · PCI/ACPI/IOMMU · Graphics/GPU · Audio · Storage · Input/HID · +System daemons · Power/Thermal · Session services · Network daemons & utils · +Firmware loader & pkgs · Driver manager & policy · Quirks system · +relibc/libredox/syscall network surface · Virtio paravirt drivers · USB hotplug. + +### 0.3 Audit Provenance + +Synthesizes 5 parallel deep audits (2026-07-27): + +| Audit | Subsystem | Method | Output | +|-------|-----------|--------|--------| +| A1 | Wired network stack | Per-file inventory + TODO grep | 42+12+2 files mapped; 13 TODO/FIXME in netstack | +| A2 | Wireless + Bluetooth stack | Per-file inventory + validation status | 328 tests counted (linux-kpi 93 + iwlwifi 8 + wifictl 20 + btusb 151 + btctl 56) | +| A3 | System drivers + daemons | Directory walk + recipe.toml inspection | 110-component inventory; 6 missing/skeleton | +| A4 | Documentation staleness | Head-of-doc classification + cross-ref check | 13-doc classification; 5 cross-ref gaps | +| A5 | Bad practices | grep + targeted reads | ~250 unsafe blocks (0 with Safety docs); 501 unwrap/expect; 32 TODO/FIXME | + +### 0.4 Severity, Maturity & Confidence Rubric + +**Severity (defects):** **P0** = correctness/safety: UB, data leak, panic in production. **P1** = high: missing functionality, broken validation. **P2** = medium: maintainability, code quality. **P3** = low: cosmetic. + +**Maturity (subsystems):** **`builds`** compiles | **`host-tested`** unit tests pass on Linux | **`qemu-proven`** runtime verified in QEMU | **`validated`** bare-metal proof | **`experimental`** present, no runtime proof | **`missing`** no implementation. + +### 0.5 How to Use This Document + +- **Operator triaging bug:** §3 → canonical sub-plan → §6 defects → §14 file:line → §12 roadmap → §13 validation. +- **Contributor planning:** §11 doc audit → §5 completeness → §7 gaps → §8 blockers → §12 roadmap → §13 validation. +- **Reviewer:** §1 exec → §2 methodology → §9 bad practices → §10 cross-cutting. + +### 0.6 Cross-Reference Convention + +`[REF: ]` markers reference canonical authoritative docs. `[ARCHIVED: ]` for historical. + +--- + +## 1. Executive Summary + +### 1.1 Top-Line Findings + +1. **Wired TCP/IP stack is the most mature userspace subsystem.** smolnetd/netstack implements IPv4+IPv6, TCP (CUBIC), UDP, ICMP, netfilter, conntrack, NAT, TUN, VLAN, VXLAN, GRE, IPIP, Bridge, Bond, STP, packet capture. ~80-85% POSIX socket coverage. QEMU-proven. +2. **Wireless + Bluetooth stack is software-complete but hardware-unvalidated.** redbear-iwlwifi is 3,368 LOC; redbear-btusb has 151 tests; redbear-btctl has 56 tests; linux-kpi has 93 tests; redbear-wifictl has 20 tests. **No Intel Wi-Fi hardware, no USB Bluetooth adapter** for runtime validation. +3. **~110 components across drivers/daemons largely builds-clean.** Driver-manager replaced pcid-spawner (v5.0). Shared-IRQ re-arm bug class swept across 11 drivers (2026-07-20). USB xHCI is QEMU-proven for hub + hub-child + storage BOT. **6 missing/skeleton daemons**: audiodevd, usbd, redbear-dnsd, redbear-firmware-{amdgpu,intel,iwlwifi,bluetooth}, redbear-wayland-guard. +4. **Documentation is exceptionally well-organized.** 13 networking docs: 8 canonical, 2 already in `legacy-obsolete-2026-07-25/`, 3 reference. **No genuinely stale docs need moving.** Cross-reference gaps exist (`NETWORKING-IMPROVEMENT-PLAN.md` should back-reference `HARDWARE-NETWORKING-INVENTORY.md`, `HARDWARE-VALIDATION-MATRIX.md`, `FIREWALL-VALIDATION-LOG.md`). +5. **Single worst systemic issue: ZERO `# Safety` documentation on ~250 unsafe blocks** across relibc socket.rs (99), libredox lib.rs (49), ethernet drivers (52), netstack (7), daemons (43), driver libraries (~80). Future refactors / edition upgrades / compiler changes can introduce UB silently. + +### 1.2 Maturity Heatmap + +| Subsystem | Builds | Host | QEMU | Validated | +|-----------|--------|------|------|-----------| +| Wired TCP/IP (netstack) | ✅ | ✅ | ✅ | 🚧 partial | +| DHCP | ✅ | ✅ | ✅ | 🚧 partial | +| Ethernet NICs (5) | ✅ | ✅ | ✅ 3 | ❌ 0 | +| POSIX sockets (relibc) | ✅ | ✅ | ✅ | 🚧 partial | +| LinuxKPI | ✅ | ✅ 93 tests | N/A | N/A | +| iwlwifi | ✅ | ✅ 8 tests | 🟡 VFIO only | ❌ | +| Wi-Fi control | ✅ | ✅ 20 tests | 🟡 lifecycle | ❌ | +| Bluetooth transport | ✅ | ✅ 151 tests | 🟡 in progress | ❌ | +| Bluetooth host | ✅ | ✅ 56 tests | 🟡 in progress | ❌ | +| USB xHCI | ✅ | ✅ 43 tests | ✅ | ❌ | +| USB EHCI/UHCI/OHCI | ✅ | ❌ | ❌ | ❌ | +| IOMMU | ✅ | ✅ | ✅ first-use | ❌ | +| PCI/ACPI/driver-mgr | ✅ | ✅ | ✅ | 🚧 AMD64 proven | +| Audio | ✅ | ❌ | ❌ | ❌ | +| Daemons (48) | ✅ 44 | varies | ✅ 12 | ❌ | + +### 1.3 Critical Risks + +1. **Wi-Fi hardware absent** — blocks W4 (First Association Milestone). Without an Intel Wi-Fi NIC, v1.0 cannot be validated end-to-end. Acquiring a USB Wi-Fi adapter or VFIO passthrough of a host Wi-Fi device is the single biggest validation unlock. +2. **USB CDC ECM dongle absent** — the LG Gram has NO wired NIC and NO USB-Ethernet dongle. The Gram is unnetworkable on bare metal unless USB CDC ECM driver (`redbear-ecmd`) is validated AND a dongle is acquired. This is the LG Gram's only viable networking path. +3. **Threadripper NIC inventory uncollected** — blocks bare-metal Ethernet driver validation. +4. **relibc socket surface has 7 documented gaps** — TCP `SendMsg` entirely missing, `MSG_NOSIGNAL` not implemented, ICMP caps stubbed, flat option namespace causes TCP_MAXSEG/IP_TTL/SO_REUSEADDR collision. +5. **No DHCP lease renewal** — dhcpd is one-shot. Long-running sessions will lose IP after T1. +6. **`redbear-dnsd` not wired into any config** — fully built, has a service file (`11_dnsd.service`), but included in zero `redbear-*.toml` config targets. + +### 1.4 Top P0 Recommendations + +| # | Action | Source | Effort | +|---|--------|--------|--------| +| P0-1 | Add `# Safety` sections to all 99 unsafe blocks in `relibc/src/platform/redox/socket.rs` | §6.2 / §9.3 | 1-2 days | +| P0-2 | Add `# Safety` sections to all 49 unsafe blocks in `libredox/src/lib.rs` | §6.2 / §9.3 | 1 day | +| P0-3 | Add MMIO register bounds checks to e1000d, rtl8139d, rtl8168d (copy ixgbe's `device.rs:237` pattern) | §6.2 | 1 day | +| P0-4 | Replace `panic!` on failed BAR lookup in `rtl8139d/main.rs:35`, `rtl8168d/main.rs:35` | §6.2 | 1 hour | +| P0-5 | Add `# Safety` sections to all 52 unsafe blocks in ethernet drivers | §6.2 / §9.3 | 1 day | +| P0-6 | Wire `redbear-dnsd` into `redbear-mini.toml` (add package + `11_dnsd.service`) | §6.2 / §7.4 | 1 hour | +| P0-7 | Acquire USB-C Ethernet dongle (CDC ECM, ~$15) for LG Gram validation | §8.1 | logistics | +| P0-8 | Collect Threadripper NIC inventory (`lspci -nn \| grep -i ethernet`) | §8.1 | logistics | +| P0-9 | Pass `level` parameter through SocketCall protocol to fix TCP_MAXSEG/IP_TTL/SO_REUSEADDR collision | §6.2 | 3-5 days | +| P0-10 | Add cross-references to `NETWORKING-IMPROVEMENT-PLAN.md` for HARDWARE-NETWORKING-INVENTORY / HARDWARE-VALIDATION-MATRIX / FIREWALL-VALIDATION-LOG | §11.5 | 1 hour | + +### 1.5 Headline Metrics + +| Metric | Count | Source | +|--------|-------|--------| +| Total components audited | ~110 | A3 | +| Components that build | ~104 | A3 | +| Components QEMU-proven | ~50 | A3 | +| Components bare-metal-validated | 1 (AMD64 boot) | A3 | +| Missing/skeleton daemons | 6 | A3 | +| `.unwrap()` + `.expect()` instances | 501 | A5 | +| `unsafe` blocks total | ~250 | A5 | +| `unsafe` blocks with `# Safety` doc | **0** | A5 | +| `TODO` / `FIXME` / `XXX` markers in network code | 32 | A4 | +| `let _ =` silent error swallows | 55 | A5 | +| Different error-handling strategies in concurrent use | 5 | A5 | +| Different async runtimes in concurrent use | 3 | A5 | +| Networking docs classified | 13 | A4 | +| Stale docs that need moving | **0** | A4 | +| Cross-reference gaps in canonical plans | 5 | A4 | +| Total host unit tests counted | 328 | A2 | + +--- + +## 2. Assessment Methodology + +**Audit Boundaries:** all source files under `local/sources/`, `local/recipes/`, and relevant `recipes/` for the 21 subsystem classes. All networking docs in `local/docs/` and `docs/`. All patches under `local/patches/`. Test scripts under `local/scripts/`. + +**Out of scope:** build-system internals (own canonical plan), kernel CPU scheduler, Wayland/KDE compositor, D-Bus internals. + +**Method:** +- **A1 Wired network:** directory walk of `local/sources/base/netstack/` (42 files), `local/sources/base/drivers/net/` (12 files), `local/sources/base/dhcpd/` (2 files), `relibc/src/platform/redox/socket.rs` (1,236 lines), `libredox/src/lib.rs` SocketCall. +- **A2 Wireless/BT:** directory walk of `redbear-iwlwifi/` (C+Rust, 3,368 LOC), `linux-kpi/` (47 C headers + 19 Rust modules), `redbear-wifictl/` (4 files), `redbear-btusb/` (5 files), `redbear-btctl/` (6 files). +- **A3 Drivers/daemons:** walk of `recipes/drivers/`, `local/recipes/drivers/`, `recipes/system/`, `local/recipes/system/`. Per-recipe.toml inspection. Cross-check against `config/redbear-*.toml`. +- **A4 Docs:** head-of-doc identity verification for all 13 networking docs. Cross-reference integrity check. +- **A5 Bad practices:** grep for `.unwrap()`, `.expect()`, `panic!`, `unsafe`, `let _ =`, `as u8/...`, `TODO/FIXME/XXX/HACK`. Targeted file reads for semantic context. + +**Sources of truth:** +- Recipe builds: `recipes//source/Cargo.toml` + `recipe.toml`. +- Recipe in config: `config/redbear-*.toml` package lists. +- QEMU-proven: test scripts in `local/scripts/` + recent commit history. +- linux-kpi scope: `local/AGENTS.md:1222` + `AGENTS.md:906`. + +**Limitations:** Build-state claims based on recipe.toml + target/ presence (not fresh full build). Validation claims based on commit history + script presence (not re-execution). Bare-metal validation is operator-reported only. Bad-practice counts are a snapshot at 2026-07-27. + +--- + +## 3. Authoritative Document Index + +### 3.1 Canonical Plans (Live) + +| Topic | Doc | Summary | +|-------|-----|---------| +| Wired TCP/IP stack | `[REF: local/docs/NETWORKING-IMPROVEMENT-PLAN.md]` | smolnetd/netstack, Ethernet drivers, POSIX sockets, netcfg/dhcpd/netctl | +| Hardware gate (Phase -1) | `[REF: local/docs/HARDWARE-NETWORKING-INVENTORY.md]` | Test bench inventory + per-driver hardware availability | +| Wi-Fi | `[REF: local/docs/WIFI-IMPLEMENTATION-PLAN.md]` | iwlwifi + linux-kpi + redbear-wifictl + W0-W7 phases | +| Bluetooth | `[REF: local/docs/BLUETOOTH-IMPLEMENTATION-PLAN.md]` | btusb + btctl + B0-B7 phases | +| USB (network-adjacent) | `[REF: local/docs/USB-IMPLEMENTATION-PLAN.md]` | xhcid + CDC ECM (LG Gram path) | +| Driver manager | `[REF: local/docs/DRIVER-MANAGER.md]` | pcid-spawner → driver-manager cutover + post-v5.9 review | +| Repo-level | `[REF: docs/07-RED-BEAR-OS-IMPLEMENTATION-PLAN.md]` | Repository-level architecture, packaging, validation, staged HW | + +### 3.2 Validation Logs & Runbooks + +- `[REF: local/docs/FIREWALL-VALIDATION-LOG.md]` — firewall 6 scenarios +- `[REF: local/docs/HARDWARE-VALIDATION-MATRIX.md]` — hardware validation tracking +- `[REF: local/docs/USB-VALIDATION-RUNBOOK.md]` — USB validation scripts + +### 3.3 Historical Plans (legacy-obsolete-2026-07-25/) + +| Doc | Status | +|-----|--------| +| `[REF: local/docs/legacy-obsolete-2026-07-25/IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN.md]` | Active authority (despite folder name) — PCI interrupt, MSI/MSI-X, IOMMU. Mirror copy also at `local/docs/IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN.md` for path-fork stability. | +| `[REF: local/docs/legacy-obsolete-2026-07-25/NETWORKING-STACK-STATE.md]` | Snapshot; superseded by `NETWORKING-IMPROVEMENT-PLAN.md` | +| `[REF: local/docs/legacy-obsolete-2026-07-25/BUILD-SYSTEM-ASSESSMENT-2026-07-18.md]` | Build-system scope (out of this doc) | + +### 3.4 Archived Plans (`local/docs/archived/`) + +Correctly placed historical archives. Do NOT cite as authoritative: +`DRIVER-MANAGER-MIGRATION-PLAN.md`, `USB-BOOT-INPUT-PLAN.md`, `XHCID-DEVICE-IMPROVEMENT-PLAN.md`, `USB-VALIDATION-RUNBOOK-2026-07.md`, `RELIBC-IPC-ASSESSMENT-AND-IMPROVEMENT-PLAN.md`, `IMPLEMENTATION-MASTER-PLAN.md`, `SYSTEM-STABILITY-AND-UPSTREAM-SYNC-PLAN.md`, `UPSTREAM-SYNC-PROCEDURE.md`, `INTEL-HDA-IMPLEMENTATION-PLAN.md`, `ACPI-I2C-HID-IMPLEMENTATION-PLAN.md`, `SLEEP-IMPLEMENTATION-PLAN.md`, `KERNEL-SCHEDULER-MULTITHREAD-IMPROVEMENT-PLAN.md`, `IMPROVEMENT-PLAN.md`, `STUBS-FIX-PROGRESS.md`, `BUILD-SYSTEM-IMPROVEMENTS.md`, `repo-governance.md`. + +### 3.5 Build-System & Policy Docs (AGENTS.md family) + +- `[REF: AGENTS.md]` — linux-kpi scope (line 906), subsystem execution order (line 985-1009). +- `[REF: local/AGENTS.md]` — Wi-Fi validation scripts (line 1249-1262), linux-kpi scope (line 1222). +- `[REF: recipes/AGENTS.md]` — no network-specific content. + +### 3.6 Document Freshness + +All 13 networking docs reviewed. All current except `NETWORKING-IMPROVEMENT-PLAN.md` which needs cross-ref updates (§11.5). + +--- + +## 4. Component Inventory & Maturity Matrix + +### 4.1 Wired Network Core + +| Component | Path | Maturity | Tests | +|-----------|------|----------|-------| +| netstack main + schemes (tcp/udp/icmp/ip/netcfg/netfilter/tun) | `local/sources/base/netstack/src/` | qemu-proven | n/a | +| netstack link layer (ethernet/loopback/vlan/vxlan/gre/ipip/bridge/bond/stp/tun/qdisc) | `local/sources/base/netstack/src/link/` | qemu-proven (ethernet, loopback); experimental (rest) | n/a | +| netstack filter (netfilter + conntrack + NAT) | `local/sources/base/netstack/src/filter/` | qemu-proven | 31 | +| netstack router | `local/sources/base/netstack/src/router/` | qemu-proven | n/a | + +### 4.2 Wired NIC Drivers + +| Component | Path | Maturity | Notes | +|-----------|------|----------|-------| +| driver-network (shared lib) | `local/sources/base/drivers/net/driver-network/` | builds | Shared traits | +| e1000d | `local/sources/base/drivers/net/e1000d/` | qemu-proven (QEMU `-device e1000`) | MSI migration patch active | +| rtl8139d | `local/sources/base/drivers/net/rtl8139d/` | qemu-proven (QEMU `-device rtl8139`) | Legacy 10/100 | +| rtl8168d | `local/sources/base/drivers/net/rtl8168d/` | experimental | No QEMU model | +| ixgbed | `local/sources/base/drivers/net/ixgbed/` | experimental | 10GbE; needs HW | +| virtio-netd | `local/sources/base/drivers/net/virtio-netd/` | qemu-proven | MSI-X proven | + +### 4.3 Wireless Stack + +| Component | Path | Maturity | Tests | +|-----------|------|----------|-------| +| linux-kpi C headers (47 files: asm/, drm/, linux/, net/) | `local/recipes/drivers/linux-kpi/source/src/c_headers/` | builds + host-tested | 93 | +| linux-kpi Rust impl (19 modules: pci/irq/dma/mac80211/wireless/etc.) | `local/recipes/drivers/linux-kpi/source/src/rust_impl/` | builds + host-tested | included | +| linux-kpi scope | **GPU + Wi-Fi only — NOT USB, NOT input** | per `local/AGENTS.md:1222` | n/a | +| redbear-iwlwifi C transport (2,715 LOC) | `local/recipes/drivers/redbear-iwlwifi/source/src/linux_port.c` | builds + host-tested | 8 | +| redbear-iwlwifi MVM layer | `local/recipes/drivers/redbear-iwlwifi/source/src/linux_mvm.{c,h}` | builds + host-tested | included | +| redbear-iwlwifi MLD layer (C + Rust modules) | `local/recipes/drivers/redbear-iwlwifi/source/src/linux_mld.{c,h}` + `mld/*.rs` | builds + host-tested | included | +| redbear-iwlwifi bridge modules | `local/recipes/drivers/redbear-iwlwifi/source/src/bridge/*.rs` | builds + host-tested | included | +| redbear-iwlwifi v5.2 channel-contract fix | `main.rs` | applied 2026-07-26 | n/a | +| redbear-wifictl main.rs (480 LOC) | `local/recipes/system/redbear-wifictl/source/src/main.rs` | builds + host-tested | 20 | +| redbear-wifictl backend.rs (1,440 LOC) | `local/recipes/system/redbear-wifictl/source/src/backend.rs` | builds + host-tested | included | +| redbear-wifictl scheme.rs (807 LOC, scheme:wifictl) | `local/recipes/system/redbear-wifictl/source/src/scheme.rs` | builds + host-tested | included | +| redbear-firmware-iwlwifi | `local/recipes/system/redbear-firmware-iwlwifi/` | recipe-only (downloads at build) | n/a | + +### 4.4 Bluetooth Stack + +| Component | Path | Maturity | Tests | +|-----------|------|----------|-------| +| redbear-btusb main.rs | `local/recipes/drivers/redbear-btusb/source/src/main.rs` | builds + host-tested | 151 | +| redbear-btusb hci.rs (1,900 LOC) | `local/recipes/drivers/redbear-btusb/source/src/hci.rs` | builds + host-tested | included | +| redbear-btusb scheme.rs (scheme:hciN) | `local/recipes/drivers/redbear-btusb/source/src/scheme.rs` | builds + host-tested | included | +| redbear-btctl main.rs | `local/recipes/system/redbear-btctl/source/src/main.rs` | builds + host-tested | 56 | +| redbear-btctl hci_backend.rs (GATT workflow) | `local/recipes/system/redbear-btctl/source/src/hci_backend.rs` | builds + host-tested | included | +| redbear-btctl bond_store.rs | `local/recipes/system/redbear-btctl/source/src/bond_store.rs` | builds + host-tested | included | +| redbear-firmware-bluetooth | `local/recipes/system/redbear-firmware-bluetooth/` | recipe-only | n/a | + +### 4.5 USB Subsystem + +| Component | Path | Maturity | +|-----------|------|----------| +| xhcid | `local/sources/base/drivers/usb/xhcid/` | qemu-proven (hub + hub-child + storage BOT) | +| ehcid | `recipes/drivers/ehcid/` + `local/recipes/drivers/ehcid/` | builds | +| uhcid | `recipes/drivers/uhcid/` + `local/recipes/drivers/uhcid/` | builds (bulk/interrupt 2026-07-08) | +| ohcid | `recipes/drivers/ohcid/` + `local/recipes/drivers/ohcid/` | builds | +| usb-core | `recipes/drivers/usb-core/` + `local/recipes/drivers/usb-core/` | builds | +| usbhubd | `local/sources/base/drivers/usb/usbhubd/` | qemu-proven | +| usbscsid | `local/sources/base/drivers/storage/usbscsid/` | qemu-proven (BOT); UAS in flight | +| usbhidd | `local/sources/base/drivers/input/usbhidd/` | qemu-proven | +| usbctl | `recipes/drivers/usb/usbctl/` | **experimental** (marked TODO) | +| redbear-acmd (CDC ACM) | `local/recipes/system/redbear-acmd/` | builds | +| redbear-ecmd (CDC ECM — LG Gram path) | `local/recipes/system/redbear-ecmd/` | builds | +| redbear-usbaudiod | `recipes/system/redbear-usbaudiod/` | builds | +| redbear-usb-hotplugd | `local/recipes/system/redbear-usb-hotplugd/` | builds | + +### 4.6 PCI / ACPI / IOMMU Substrate + +| Component | Path | Maturity | +|-----------|------|----------| +| pcid | `recipes/drivers/pcid/` | qemu-proven | +| pcid-spawner | `recipes/drivers/pcid-spawner/` | **retired 2026-07-24** | +| redox-driver-pci | `local/recipes/drivers/redox-driver-pci/` | builds | +| redox-driver-sys (incl. quirks) | `local/recipes/drivers/redox-driver-sys/` | builds + host-tested + qemu-proven (via xhcid) | +| acpid | `recipes/drivers/acpid/` | qemu-proven + AMD64 bare-metal | +| redox-driver-acpi | `local/recipes/drivers/redox-driver-acpi/` | builds | +| redox-driver-core | `local/recipes/drivers/redox-driver-core/` | builds | +| amlserde | `recipes/drivers/amlserde/` | builds | +| hwd (legacy) | `recipes/drivers/hwd/` | qemu-proven (phasing out) | +| iommu (AMD-Vi) | `recipes/system/iommu/` | qemu-proven (first-use self-test) | + +### 4.7 Graphics / GPU + +| Component | Path | Maturity | +|-----------|------|----------| +| redox-drm (AMD/Intel/virtio) | `local/recipes/gpu/redox-drm/` | builds + qemu-proven (virtio-gpu auto-probe) | +| amdgpu glue | `local/recipes/gpu/amdgpu/` | builds (glue compiles; full DC path not yet wired) | +| displayd | `recipes/system/displayd/` | builds (skeleton) | +| vesad | `recipes/drivers/graphics/vesad/` | qemu-proven | +| fbcond / fbbootlogd | `recipes/drivers/graphics/{fbcond,fbbootlogd}/` | qemu-proven | + +### 4.8 Audio + +| Component | Path | Maturity | +|-----------|------|----------| +| ac97d / ihdad / sb16d | `recipes/drivers/audio/` | builds | +| audiodevd | `recipes/system/audiodevd/` | **missing** (recipe skeleton only) | +| redbear-usbaudiod | `recipes/system/redbear-usbaudiod/` | builds | + +### 4.9 Storage + +| Component | Path | Maturity | +|-----------|------|----------| +| ahcid | `recipes/drivers/storage/ahcid/` | qemu-proven | +| ided / nvmed / virtio-blkd / lived / usbscsid | `recipes/drivers/storage/`, `local/sources/base/drivers/storage/` | qemu-proven | +| diskd | `recipes/system/diskd/` | qemu-proven | +| ext4d | `local/recipes/core/ext4d/` | builds | +| fatd | `local/recipes/core/fatd/` | builds + host-tested (60 tests) | +| redoxfs | `recipes/core/redoxfs/` | qemu-proven | +| bcm2835-sdhcid | `recipes/drivers/storage/bcm2835-sdhcid/` | builds (RPi-only) | + +### 4.10 Input / HID + +| Component | Path | Maturity | +|-----------|------|----------| +| inputd / ps2d / usbhidd / evdevd | `recipes/drivers/`, `local/sources/base/drivers/input/` | qemu-proven | +| redbear-hid-core | `local/recipes/drivers/redbear-hid-core/` | builds + host-tested | +| redbear-input-headers | `local/recipes/drivers/redbear-input-headers/` | builds | +| virtio-inputd | `recipes/drivers/virtio-inputd/` | qemu-proven | + +### 4.11 System Daemons + +| Daemon | Path | Maturity | +|--------|------|----------| +| devfsd / driver-manager / dbus | `recipes/system/` | qemu-proven | +| driver-params / iommu / numad / rtcd / seatd / thermald / udev-shim | `recipes/system/`, `recipes/drivers/rtcd/` | builds (iommu/rtcd qemu-proven) | +| coretempd / cpufreqd / hwrngd | `recipes/system/` | builds | +| **usbd** | `recipes/system/usbd/` | **missing** (skeleton only) | +| **netd** | `recipes/system/netd/` | **missing** (ghost recipe, no source) | +| redbear-power (TUI, Intel MSR) | `local/recipes/system/redbear-power/` | builds | + +### 4.12 Session & Desktop Services + +| Daemon | Path | Maturity | +|--------|------|----------| +| redbear-authd / -sessiond / -greeter | `local/recipes/system/` | builds + qemu-proven | +| redbear-session-launch / -polkit / -upower / -udisks / -notifications / -statusnotifierwatcher | `local/recipes/system/` | builds | +| redbear-wayland-guard | `local/recipes/system/redbear-wayland-guard/` | **source only** (no recipe.toml) | +| redbear-accessibility / -ime / -passwd / -keymapd / -ftdi / -login-protocol / -acmd / -ecmd / -info | `local/recipes/system/` | builds | + +### 4.13 Network Daemons & Utils + +| Daemon / Util | Path | Maturity | Notes | +|---------------|------|----------|-------| +| redbear-netctl (CLI, 1086 LOC) | `local/recipes/system/redbear-netctl/` | builds + qemu-proven | | +| redbear-netctl-console (TUI) | `local/recipes/system/redbear-netctl-console/` | builds + qemu-proven | ncurses | +| redbear-netstat | `local/recipes/system/redbear-netstat/` | builds + qemu-proven | TCP/UDP table NOT implemented | +| redbear-traceroute | `local/recipes/system/redbear-traceroute/` | builds + qemu-proven | UDP-based | +| redbear-nmap | `local/recipes/system/redbear-nmap/` | builds + qemu-proven | TCP connect only | +| redbear-mtr | `local/recipes/system/redbear-mtr/` | builds + qemu-proven | depends on redbear-traceroute | +| **redbear-dnsd** | `local/recipes/system/redbear-dnsd/` | **builds but NOT wired** into any config | 252 LOC main.rs | +| openssh | `recipes/net/openssh/` | builds (with IPv4-only `sed` workaround) | 3 TODO markers | +| redox-ssh / nginx / rsync / curl / wget / simple-http-server | `recipes/net/` | builds | upstream | + +### 4.14 Firmware & Quirks + +| Component | Path | Maturity | +|-----------|------|----------| +| firmware-loader | `recipes/system/firmware-loader/` + `local/recipes/system/firmware-loader/` | builds + qemu-proven | +| redbear-firmware (umbrella) | `local/recipes/system/redbear-firmware/` | builds | +| redbear-firmware-{amdgpu,intel,iwlwifi,bluetooth} | `local/recipes/system/redbear-firmware-*/` | **recipe skeleton only** | +| redox-driver-sys quirks (~85-entry tables: pci/usb/xhci/dmi/toml_loader) | `local/recipes/drivers/redox-driver-sys/source/src/quirks/` | builds + host-tested | + +### 4.15 relibc / libredox / syscall Network Surface + +| Component | Path | Maturity | +|-----------|------|----------| +| relibc POSIX socket | `local/sources/relibc/src/platform/redox/socket.rs` (1,236 LOC) | builds + qemu-proven | +| relibc socket header / constants | `local/sources/relibc/src/header/sys_socket/` (443+221 LOC) | builds + qemu-proven | +| libredox SocketCall (10 variants) | `local/sources/libredox/src/lib.rs:909-980` | builds | +| kernel SchemeSocketCall (2 variants) | `local/sources/syscall/src/flag.rs:383-395` | builds | +| kernel scheme dispatch | `local/sources/kernel/src/scheme/{mod,user}.rs` | builds + qemu-proven | + +### 4.16 Virtio Paravirt Drivers + +| Component | Path | Maturity | +|-----------|------|----------| +| virtio-core / virtio-inputd / virtio-blkd / virtio-netd | `recipes/drivers/` + `local/sources/base/drivers/net/virtio-netd/` | qemu-proven | +| virtio-gpud (legacy) | `recipes/drivers/graphics/virtio-gpud/` | builds (superseded by redox-drm virtio) | + +--- + +## 5. Completeness Assessment + +### 5.1 Implemented & Functional (QEMU-proven) + +IPv4/IPv6 TCP/UDP/ICMP · TCP_CUBIC · socket options (most) · Raw IP · Loopback · ARP/NDP/SLAAC · Default + multi-iface routing · Netfilter (5 hooks, conntrack, NAT) · IP forwarding · TUN · Packet capture · DHCPv4 (one-shot) · Interface/route config · DNS resolver + caching + mDNS · POSIX sockets (~80-85%) · pcid (MSI/MSI-X) · acpid (RSDP/SDT/MADT/FADT/AML) · IOMMU (AMD-Vi) · driver-manager · USB xHCI (51 quirks, 36 errors, hub enum) · USB BOT/HID · USB class autospawn framework · e1000/rtl8139/virtio-net · iwlwifi (37 PCI IDs) · redbear-wifictl · redbear-btusb (151 tests) · redbear-btctl (56 tests, BLE battery) · devfsd/driver-manager/dbus/redbear-{sessiond,greeter,authd} · redbear-{netctl,netctl-console,netstat,traceroute,nmap,mtr,openssh,curl,wget}. + +### 5.2 Implemented & Compiles (No Runtime Proof) + +rtl8168d · ixgbed · VLAN/VXLAN/GRE/Bridge/Bond/STP/IPIP/QoS link modules · Intel HDA (ihdad) · all redbear-firmware recipe skeletons · redbear-wayland-guard (source only) · audiodevd/usbd/netd (recipe skeletons). + +### 5.3 Partially Implemented (Stubs / TODO) + +See §14.2 for full list. 32 TODO/FIXME markers in network code. Highlights: + +- netstack event notification (mod.rs:274), port claiming (tcp.rs:101, udp.rs:140), multiple IPs per if (netcfg/mod.rs:581), UDP socket insert workaround (netcfg/mod.rs:595), ICMP caps stub (icmp.rs:205,232). +- relibc TCP SendMsg (socket.rs:1028), MSG_NOSIGNAL (socket.rs:1027), socket option levels (socket.rs:784,1094), nonblock connect error (socket.rs:795). +- ethernet driver-network back pressure (lib.rs:29), scheme event API (lib.rs:88). +- e1000d statistics clear (device.rs:284), rtl8139 TSD_TOK wait (device.rs:206), rtl8139 DMA 32-bit limit (device.rs:224,227). +- virtio-net IRQ vector (main.rs:112), device init ordering (main.rs:136), TX descriptor layout (scheme.rs:74). +- openssh recipe: 3 TODOs (resolver runtime, utmpx.h, host key postscript) + IPv4-only workaround via `sed`. + +### 5.4 Missing / Not Started + +- `audiodevd` / `usbd` / `netd` source +- `redbear-firmware-{amdgpu,intel,iwlwifi,bluetooth}` source +- `redbear-wayland-guard` recipe.toml +- `usbctl` (USB control endpoint) +- DHCPv6 client +- Raw Ethernet sockets (AF_PACKET) +- SCTP / DCCP / MPTCP +- IP multicast (IGMP/MLD) +- `sendmmsg` / `recvmmsg` +- SCM_RIGHTS (FD passing) +- Socket timestamping (SO_TIMESTAMP/SO_TIMESTAMPNS) +- Live TCP/UDP socket table in netstat +- DHCP lease renewal/rebind +- Wi-Fi IP datapath bridge (802.11→Ethernet into netstack's `DeviceList`) +- USB Bluetooth adapter autospawn (redbear-btusb uses explicit startup only) + +### 5.5 Subsystem Completeness Status + +| Subsystem | Status | Gap | +|-----------|--------|-----| +| Wired TCP/IP | Substantially complete | DHCPv6, raw Ethernet, multicast, SCTP/DCCP/MPTCP | +| Wireless | Software complete; HW validation pending | Wi-Fi IP datapath bridge, WPA3, roaming, offload | +| Bluetooth | Software complete; HW validation pending | A2DP/HFP/AVRCP/HoG, USB autospawn, pairing/SMP | +| USB | xHCI QEMU-proven; EHCI/UHCI/OHCI builds-only | UAS, U1/U2/U3 autosuspend, usbctl | +| Driver Infrastructure | Green | linux-kpi is GPU+Wi-Fi only (intentional) | +| Daemons | Green for core; 6 skeleton/missing | audiodevd, usbd, netd, firmware pkgs, wayland-guard | +| POSIX sockets | ~80-85% | TCP SendMsg, MSG_NOSIGNAL, IP_PKTINFO, IP_MULTICAST | +| Observability | Good basic; advanced gaps | live socket table, BPF/eBPF, prometheus | + +--- + +## 6. Errors / Bugs / Issues + +### 6.1 P0 Critical Defects (12) + +| ID | Subsystem | File:line | Description | +|----|-----------|-----------|-------------| +| DEF-P0-1 | relibc | `local/sources/relibc/src/platform/redox/socket.rs` (99 sites) | **Zero `# Safety` documentation on 99 unsafe blocks**. | +| DEF-P0-2 | libredox | `local/sources/libredox/src/lib.rs` (49 sites) | **Zero `# Safety` documentation on 49 unsafe blocks**. | +| DEF-P0-3 | netstack | `local/sources/base/netstack/src/buffer_pool.rs:84-86` | **Unsafe `set_len` on recycled `Vec`** — leaks old packet data between unrelated flows. | +| DEF-P0-4 | netstack | `local/sources/base/netstack/src/worker_pool.rs:61,65` | **Unsafe `File::from_raw_fd` without checking `dup` return** — if dup returns -1, creates File from invalid fd (UB). | +| DEF-P0-5 | ethernet | `local/sources/base/drivers/net/{e1000d,rtl8139d,rtl8168d}/src/device.rs` | **`unsafe fn new(base: usize) -> Result` without `# Safety` docs**. | +| DEF-P0-6 | ethernet | e1000d/rtl8139d/rtl8168d `src/device.rs` | **Missing MMIO register bounds check** before volatile read/write. Only ixgbe has it (`device.rs:237`). | +| DEF-P0-7 | ethernet | `rtl8139d/src/main.rs:35`, `rtl8168d/src/main.rs:35` | **`panic!("...: failed to find BAR")`** — runtime PCI condition panics the entire driver. | +| DEF-P0-8 | libredox | `local/sources/libredox/src/lib.rs:43` | **`demux()` `.expect()` panics on overflow** edge case. | +| DEF-P0-9 | relibc | `local/sources/relibc/src/platform/redox/socket.rs:1028` | **TCP `SendMsg` entirely missing** — POSIX programs using sendmsg on TCP silently get ENOSYS. | +| DEF-P0-10 | config | `config/redbear-mini.toml` (and full) | **`redbear-dnsd` not wired into any config** — daemon built, service file present, but excluded from all redbear-*.toml. | +| DEF-P0-11 | relibc | `socket.rs` scheme protocol | **Socket option level namespace collision** — TCP_MAXSEG(2), IP_TTL(2), SO_REUSEADDR(2) all share option number 2. POSIX separates by level. | +| DEF-P0-12 | docs | `local/docs/NETWORKING-IMPROVEMENT-PLAN.md:803` | **References non-existent file** `local/docs/networking-validation-log.md`. | + +### 6.2 P1 High-Severity Defects (23) + +| ID | File:line | Description | +|----|-----------|-------------| +| DEF-P1-1 | `socket.rs:1027` | MSG_NOSIGNAL not implemented | +| DEF-P1-2 | `socket.rs:599,689` | FIXME clippy suggestion fails to compile | +| DEF-P1-3 | `socket.rs:824` | todo_skip returns ENOSYS for IP-level getsockopt | +| DEF-P1-4 | `netstack/src/scheme/mod.rs:274` | Event notification reliability TODO | +| DEF-P1-5 | `netstack/src/scheme/tcp.rs:101` + `udp.rs:140` | Port claiming without IP awareness | +| DEF-P1-6 | `netstack/src/scheme/netcfg/mod.rs:581` | Multiple IPs per interface TODO | +| DEF-P1-7 | `netstack/src/scheme/netcfg/mod.rs:595` | UDP socket insert FIXME | +| DEF-P1-8 | `netstack/src/scheme/icmp.rs:205,232` | ICMP capabilities stub | +| DEF-P1-9 | `netstack/src/link/ethernet.rs:179,281,318,327,352,387,397` | Silent packet discard on TX errors | +| DEF-P1-10 | `netstack/src/router/mod.rs:144,166,325,332` | Silent router enqueue failures | +| DEF-P1-11 | `netstack/src/scheme/mod.rs:520,544,609,626,635,644` | Silent scheme response write failures | +| DEF-P1-12 | `driver-network/src/lib.rs:29` | No back pressure on scheme writes | +| DEF-P1-13 | `driver-network/src/lib.rs:88` | Scheme event API design gap | +| DEF-P1-14 | `e1000d/src/device.rs:284` | Statistics never cleared | +| DEF-P1-15 | `rtl8139d/src/device.rs:206` | No wait for TSD_TOK or error | +| DEF-P1-16 | `virtio-netd/src/main.rs:112` | IRQ vector assignment undecided | +| DEF-P1-17 | `virtio-netd/src/main.rs:136` | Device init ordering TODO | +| DEF-P1-18 | All 5 ethernet drivers | No memory barriers between DMA desc writes and doorbell writes | +| DEF-P1-19 | `redbear-traceroute/source/src/lib.rs:154-214` | Traceroute uses raw libc syscalls (bypasses relibc) | +| DEF-P1-20 | `redbear-netctl/source/src/main.rs:782,857,916,985,1026,1051` | Unsafe `chmod` equivalent using libc | +| DEF-P1-21 | `redbear-dnsd/source/src/transport.rs:47` | Unsafe FD handling without docs | +| DEF-P1-22 | `recipes/net/openssh/recipe.toml` | 3 TODOs + IPv4-only `sed` workaround | +| DEF-P1-23 | All drivers | Shared-IRQ re-arm bug class (swept 2026-07-20, HW validation open) | + +### 6.3 P2 Medium-Severity Defects (15) + +DEF-P2-1 logger init stderr-only (`netstack/src/logger.rs:4`) · DEF-P2-2 test-only `FAKE` Mutex in production (`netstack/src/worker_pool.rs:170-186`) · DEF-P2-3 85 integer truncation casts · DEF-P2-4 67 trait methods returning bool instead of Result · DEF-P2-5 157 integer casts in drivers · DEF-P2-6 ixgbed uses `println!` (`ixgbed/src/main.rs:29`) · DEF-P2-7 `unwrap()` on `as_c_fd()` (`socket.rs:1055,1090`) · DEF-P2-8 silent error swallow (`socket.rs:85,572`) · DEF-P2-9 single read/write without partial handling · DEF-P2-10 Drop ignores close failures (`libredox:503`) · DEF-P2-11 daemon init path unwrap/expect (redbear-netctl 61, redbear-wifictl 65, redbear-dnsd 11, redbear-usbaudiod 1) · DEF-P2-12 daemon unsafe blocks without docs (43 total) · DEF-P2-13 no logging in daemons · DEF-P2-14 ~80 unsafe FFI without docs in `redox-driver-sys` · DEF-P2-15 no clang static analysis in linux-kpi C headers. + +### 6.4 P3 Low-Severity Defects (7) + +DEF-P3-1 TODO const fn (`netcfg/mod.rs:35`) · DEF-P3-2 poll return underused (`scheme/mod.rs:333`) · DEF-P3-3 CheckVsLibcCrate FIXME (`sys_socket/mod.rs:91`) · DEF-P3-4 XXX TX descriptor layout note (`virtio-netd/scheme.rs:74`) · DEF-P3-5 unspecified TODO (`e1000d/device.rs:359`) · DEF-P3-6 unspecified TODO (`netstack/scheme/socket.rs:469,498`) · DEF-P3-7 stale route cleanup TODO (`netstack/router/mod.rs:364`). + +### 6.5 Per-Subsystem Defect Grouping + +6.6 Wired network: DEF-P0-3,4,11,12; DEF-P1-1,2,4-11; DEF-P2-1,2,3,4; DEF-P3-1,2,6,7. +6.7 Wireless/iwlwifi: none P0; v5.2 channel-contract fix already applied. +6.8 Bluetooth/btusb: none P0/P1; HW validation gap in §8.1. +6.9 PCI/IRQ/MSI-X: DEF-P1-23. +6.10 ACPI/AML: none P0. +6.11 GPU/DRM: none P0. +6.12 Audio/HDA: none P0. +6.13 Storage: none P0. +6.14 Input/HID: none P0. +6.15 USB: none P0. +6.16 Daemon: DEF-P0-10, DEF-P1-19,20,21,22. +6.17 Build: none P0. +6.18 Linker: none P0. +6.19 Race: DEF-P1-18. +6.20 Resource/Lifetime: DEF-P0-3,4; DEF-P2-10. + +--- + +## 7. Gaps (Feature Gaps) + +**7.1 Core Protocols:** TCP SACK (smoltcp), TCP ECN (smoltcp), IP frag offload, hw checksum offload, IP multicast (IGMPv3/MLDv2), IPsec/VPN. + +**7.2 Configuration:** DHCPv6 (dhcpd is v4-only), DHCP lease renewal/rebind (one-shot), DHCPv6 prefix delegation, IPv6 SLAAC (code present, not proven), static IPv6 (partial), policy routing, multipath routing. + +**7.3 Wireless:** WPA3-SAE (only WPA2-PSK), roaming, 802.11ax/OFDMA/MU-MIMO (partial in iwlwifi), 802.11be/MLO (partial EHT), hardware offload, multi-queue/Airtime Fairness, P2P/Wi-Fi Direct/NAN. + +**7.4 Bluetooth:** A2DP/HFP/AVRCP/HID-over-GATT/PAN audio/headset/input profiles, SMP pairing, Classic BR/EDR (BLE-only), multiple simultaneous connections. + +**7.5 Driver API (linux-kpi scope = GPU+Wi-Fi only):** Missing all USB headers, all input headers, most network device headers, most block device headers, most filesystem headers. + +**7.6 POSIX API:** sendmmsg/recvmmsg, SCM_RIGHTS, SO_TIMESTAMP/NS, IP_PKTINFO/IP_RECVDSTADDR, IP_MULTICAST_*, SO_REUSEPORT (defined, not implemented), TCP Fast Open, netlink sockets, AF_PACKET. + +**7.7 Daemon Features:** redbear-sessiond login1 subset (KWin-focused), redbear-polkit (untested with polkit-aware clients), redbear-passwd shadow format, redbear-notifications / -statusnotifierwatcher (completeness vs freedesktop unknown), audiodevd/usbd entirely missing. + +**7.8 Observability:** Live TCP/UDP socket table (netstat gap), BPF/eBPF, Prometheus metrics, strace-equivalent for userspace schemes, tcpdump wire format (observer only). + +**7.9 Configuration:** netctl profile encryption (plaintext Wi-Fi passwords), netd missing, usbd missing, redbear-driver-policy runtime validation pending. + +**7.10 Hardware (per HARDWARE-VALIDATION-MATRIX):** Physical Intel e1000/e1000e (no bench has), Realtek RTL8168/8169 (none), Intel 10GbE X520/X540/X550 (none), Intel Wi-Fi (only LG Gram BE201), USB Bluetooth (none), EHCI/UHCI/OHCI (none), Intel HDA on LG Gram (cAVS/DSP, needs SOF port). + +**7.11 Test & Validation:** No Intel Wi-Fi bare-metal (W4 blocked), no Bluetooth bare-metal (B7 blocked), no USB CDC ECM on real dongle, no bare-metal Ethernet, no bare-metal EHCI/UHCI/OHCI. + +**7.12 Documentation:** NETWORKING-IMPROVEMENT-PLAN.md missing cross-refs to HARDWARE-NETWORKING-INVENTORY.md / HARDWARE-VALIDATION-MATRIX.md / FIREWALL-VALIDATION-LOG.md; references non-existent networking-validation-log.md (line 803); this doc fills the networking-bugs gap. + +--- + +## 8. Blockers + +### 8.1 Hardware Access + +| Blocker | Impact | Action | +|---------|--------|--------| +| No Intel Wi-Fi NIC | W4 blocked | Acquire AX210/AX211/AX201 or use LG Gram BE201 | +| No Bluetooth hardware | B7 blocked | Acquire USB Bluetooth adapter (~$10) | +| No USB-C Ethernet dongle | LG Gram bare-metal net blocked | Acquire CDC ECM dongle (~$15) | +| Threadripper NIC inventory uncollected | e1000/Realtek bare-metal blocked | Operator: `lspci -nn \| grep -i ethernet` | +| No physical EHCI/UHCI/OHCI | Legacy USB blocked | Identify machine with such controller | +| No physical 10GbE | ixgbed blocked | Identify machine with X520/X540/X550 | +| LG Gram audio is cAVS/DSP | Legacy HDA blocked | Port SOF driver or use QEMU Intel HDA | + +### 8.2 Other Blockers + +- **Kernel/syscall:** Shared-IRQ re-arm class (swept 2026-07-20 but HW-unvalidated); MSI/MSI-X delivery (code-complete, HW-unvalidated). +- **IRQ delivery (per IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN):** Bare-metal validation of interrupt delivery quality still open. +- **IOMMU:** QEMU first-use passes; bare-metal AMD-Vi validation TBD; VFIO framework exists for Wi-Fi but no emulated Wi-Fi in QEMU. +- **POSIX/relibc:** TCP SendMsg missing, MSG_NOSIGNAL missing, SCM_RIGHTS missing. +- **Firmware:** redbear-firmware-{amdgpu,intel,iwlwifi,bluetooth} are recipe skeletons; AMD/Intel GPU blobs need their own download recipes; iwlwifi dual-format TLV validated only with HW. + +### 8.3 Blocker Dependency Graph + +``` +Threadripper NIC inventory → e1000/Realtek bare-metal → Netfilter/NAT bare-metal → production wired net +LG Gram + USB-C dongle → CDC ECM validation → LG Gram bare-metal net → Wi-Fi (BE201) → W4 complete +USB BT adapter → btusb bare-metal → btctl bare-metal → B7 complete +``` + +### 8.4 Sequencing vs AGENTS.md Subsystem Priority + +Per `[REF: AGENTS.md § SUBSYSTEM PRIORITY AND ORDER]`: + +1. Low-level controllers / IRQ quality / runtime-proof — IN PROGRESS +2. USB controller and topology maturity — IN PROGRESS (xHCI QEMU-proven; EHCI/UHCI/OHCI builds-only) +3. Wi-Fi native control-plane and one bounded driver path — SOFTWARE COMPLETE (HW validation pending) +4. Bluetooth host/controller path — SOFTWARE COMPLETE (HW validation pending) +5. Desktop/session compatibility layers — OUT OF SCOPE for this doc + +--- + +## 9. Bad Practices + +### 9.1 `unwrap()` / `expect()` (501 instances) + +| Surface | Count | +|---------|-------| +| netstack | 48 (27 unwrap + 21 expect) | +| ethernet drivers | 45 (23 + 22) | +| relibc socket.rs | 8 (1 + 7) | +| libredox | 1 | +| redbear-netctl | 67 (61 + 6) | +| redbear-btctl (mostly tests) | ~227 | +| redbear-wifictl | 75 (65 + 10) | +| redbear-netctl-console | 19 | +| redbear-dnsd | 11 | +| redbear-usbaudiod | 10 | +| redbear-traceroute | 1 | +| redbear-netstat (tests) | 5 | +| **Total** | **~501** | + +**Action:** Replace runtime-failable `unwrap()`/`expect()` with `?` propagation or `anyhow::Context`. Test-code unwraps LOW severity. + +### 9.2 `unsafe` Blocks Without Safety Docs (~250 instances, 0 docs) + +| File | Unsafe blocks | +|------|---------------| +| `local/sources/relibc/src/platform/redox/socket.rs` | 99 | +| `local/sources/libredox/src/lib.rs` | 49 | +| ethernet drivers (`local/sources/base/drivers/net/`) | 52 | +| `local/recipes/drivers/redox-driver-sys/source/src/` | ~80 | +| netstack | 7 | +| redbear-netctl / wifictl / netctl-console / btctl / dnsd / traceroute | 4 / 10 / 14 / 2 / 5 / 8 | +| **Total** | **~330 (incl. ~80 in driver-sys)** | + +**Action:** Add `# Safety` doc comment to EVERY unsafe fn and unsafe block. Estimated effort: 2-3 days mechanical + review. + +### 9.3 `TODO` / `FIXME` / `XXX` (32 markers) + +13 netstack · 11 ethernet drivers · 7 relibc socket.rs · 1 relibc sys_socket. See §5.3 / §14.2 for full list. + +### 9.4 Silent Error Swallowing (55 instances) + +netstack 35 (`let _ =` / `if let Err(_) =`) · ethernet 6 · relibc 2 · libredox 1 · daemons ~11. +**Action:** Replace `let _ = ...` with `log::warn!` or propagate. + +### 9.5 Error Strategy Fragmentation (5 concurrent) + +1. Custom `Error` enum (netstack `error.rs`) +2. `anyhow::Context` + `anyhow::Result` (netstack mixed) +3. `SyscallError` directly (netstack scheme handlers) +4. `Errno` (relibc `socket.rs`) +5. `libredox::Error` (libredox, all daemons) +6. `String` error messages (daemons) + +**Action:** Create shared `redbear-net-error` crate with unified error enum. + +### 9.6 Async Strategy Fragmentation (3 concurrent) + +1. Polling (netstack — smoltcp `poll()`) +2. Tokio (redbear-wifictl via zbus feature) +3. Synchronous blocking (all other daemons) + +**Action:** Document async architecture; avoid mixing tokio with blocking I/O in same process. + +### 9.7 Top Offenders by File + +| File | unwrap/expect | unsafe | TODO/FIXME | +|------|--------------|--------|-----------| +| `redbear-btctl/source/src/*` | 227 | 2 | 0 | +| `relibc/src/platform/redox/socket.rs` | 8 | 99 | 7 | +| `redbear-wifictl/source/src/*` | 75 | 10 | 0 | +| `redbear-netctl/source/src/main.rs` | 67 | 4 | 0 | +| `libredox/src/lib.rs` | 1 | 49 | 0 | +| `local/sources/base/drivers/net/{5 drivers}/src/*.rs` | 45 | 52 | 11 | +| `local/sources/base/netstack/src/*.rs` | 48 | 7 | 13 | + +--- + +## 10. Cross-Cutting Concerns + +**10.1 Logging:** `log` crate used in netstack + ethernet drivers but NOT in daemons. **Action:** standardize on `log` crate in all networking daemons. + +**10.2 Error handling:** see §9.5 — 5 strategies coexist. + +**10.3 Async/concurrency:** see §9.6 — 3 patterns coexist. + +**10.4 Unsafe safety documentation:** ZERO `# Safety` on ~250 unsafe blocks. **Action:** add per Rust API Guidelines. + +**10.5 IPC credentials:** Per `[REF: local/docs/KERNEL-IPC-CREDENTIAL-PLAN.md]`, credentials patch active (`local/patches/relibc/P3-socket-cred.patch`). SO_PEERCRED defined, may not be fully forwarded to netstack scheme. **Action:** verify end-to-end. + +**10.6 Memory safety & DMA:** `set_len` on recycled Vec (DEF-P0-3); no memory barriers (DEF-P1-18); Drop ignores close failures (DEF-P2-10). + +**10.7 Firmware loading:** Two layouts supported (`/lib/firmware/iwlwifi-*.ucode` and `/lib/firmware/intel/iwlwifi/iwlwifi-*.ucode` via path-map). Downloads at build, cached at `build/redbear-firmware-cache/`. + +**10.8 Quirk tables:** ~85-entry PCI quirk, ~85-entry xHCI, USB, DMI, TOML loader. **Action:** document format + add-entry procedure. + +**10.9 Testing:** Host unit tests for linux-kpi (93), iwlwifi (8), redbear-wifictl (20), redbear-btusb (151), redbear-btctl (56), fatd (60), netstack filter (31). QEMU tests in `local/scripts/` per USB-VALIDATION-RUNBOOK.md. Bare-metal: operator-reported via HARDWARE-VALIDATION-MATRIX.md. **Gap:** no CI gate runs host unit tests on every PR. + +**10.10 Code reuse:** 5 ethernet drivers share `driver-network`; 4 USB host controllers share `usb-core`; linux-kpi shared iwlwifi + amdgpu. **Gap:** some BAR lookup / IRQ registration boilerplate duplicated — could factor into `driver-network`. + +**10.11 Build invariants:** Per `[REF: AGENTS.md]`, ALWAYS use `build-redbear.sh`; stale prefix detection active; source-fingerprint tracking active; branch topology gate active. + +--- + +## 11. Stale Document Audit + +### 11.1 Cleanup History + +| Date | Action | Source | +|------|--------|--------| +| 2026-05-03 | First batch → `local/docs/archived/` | `archived/README.md` | +| 2026-07-18 | Second batch (release-bump cleanup) | `archived/README.md` | +| 2026-07-25 | Round-5 → `legacy-obsolete-2026-07-25/` | `SUPERSEDED.md` | +| 2026-07-26 | Round-5 (SYSTEM-STABILITY) | `archived/README.md` | +| 2026-07-27 | PCI-spawner + driver-manager consolidations | `archived/README.md` | + +**Conclusion:** **Zero genuinely stale docs need to be moved.** Previous rounds thoroughly cleaned the doc landscape. + +### 11.2 The 13 Networking Docs + +| Document | Classification | Lines | Action | +|----------|---------------|-------|--------| +| `NETWORKING-IMPROVEMENT-PLAN.md` | CANONICAL | 1,063 | Update cross-refs (§11.3) | +| `HARDWARE-NETWORKING-INVENTORY.md` | CANONICAL | 273 | Keep current | +| `WIFI-IMPLEMENTATION-PLAN.md` | CANONICAL | 307 | Keep current | +| `BLUETOOTH-IMPLEMENTATION-PLAN.md` | CANONICAL | 703 | Keep current | +| `USB-IMPLEMENTATION-PLAN.md` | CANONICAL | 898 | Keep current | +| `USB-VALIDATION-RUNBOOK.md` | CANONICAL | 155 | Keep current | +| `FIREWALL-VALIDATION-LOG.md` | CANONICAL | 422 | Keep current | +| `HARDWARE-VALIDATION-MATRIX.md` | CANONICAL | 101 | Keep current | +| `legacy-obsolete-2026-07-25/NETWORKING-STACK-STATE.md` | STALE | 120 | Already in legacy (Round 5 cleanup) | +| `legacy-obsolete-2026-07-25/IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN.md` (mirror at `local/docs/IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN.md`) | STALE-but-ACTIVE | 1,022 | Active authority for IRQ/MSI-X/IOMMU; mirror at canonical path for path-fork stability (per AGENTS.md dual-location pattern). Both files identical (46980 bytes). | +| `docs/01-REDOX-ARCHITECTURE.md` | REFERENCE | 284 | Keep as reference | +| `docs/04-LINUX-DRIVER-COMPAT.md` | REFERENCE | 554 | Keep as reference (Wi-Fi note current) | +| `docs/07-RED-BEAR-OS-IMPLEMENTATION-PLAN.md` | CANONICAL | 463 | Keep current | + +### 11.3 Drift Detected (Cross-Reference Gaps) + +1. **`NETWORKING-IMPROVEMENT-PLAN.md` does not back-reference** `HARDWARE-NETWORKING-INVENTORY.md`, `HARDWARE-VALIDATION-MATRIX.md`, `FIREWALL-VALIDATION-LOG.md`. **Priority: HIGH.** +2. **`NETWORKING-IMPROVEMENT-PLAN.md:803` references non-existent `local/docs/networking-validation-log.md`**. **Priority: MEDIUM.** + +### 11.4 Archive Actions + +**None required.** All previously-stale docs are correctly placed in `archived/` or `legacy-obsolete-2026-07-25/`. + +### 11.5 Reconciliation + +This document is consistent with all canonical sub-plans. The drift identified in §11.3 should be fixed by the canonical-plan owners. + +--- + +## 12. Fix/Improvement Roadmap + +### 12.1 P0 — Correctness & Safety (Immediate, 1-2 weeks) + +| ID | Action | Source | Effort | +|----|--------|--------|--------| +| P0-1 | `# Safety` on all 99 unsafe blocks in `relibc/src/platform/redox/socket.rs` | DEF-P0-1 | 1-2 days | +| P0-2 | `# Safety` on all 49 unsafe blocks in `libredox/src/lib.rs` | DEF-P0-2 | 1 day | +| P0-3 | MMIO register bounds checks in e1000d/rtl8139d/rtl8168d (copy ixgbe pattern) | DEF-P0-6 | 1 day | +| P0-4 | Replace `panic!` on failed BAR lookup in rtl8139d/rtl8168d main.rs:35 | DEF-P0-7 | 1 hour | +| P0-5 | `# Safety` on all 52 unsafe blocks in ethernet drivers | DEF-P0-5 | 1 day | +| P0-6 | Wire `redbear-dnsd` into `redbear-mini.toml` | DEF-P0-10 | 1 hour | +| P0-7 | Acquire USB-C Ethernet dongle for LG Gram | §8.1 | logistics | +| P0-8 | Collect Threadripper NIC inventory | §8.1 | logistics | +| P0-9 | Pass `level` through SocketCall protocol | DEF-P0-11 | 3-5 days | +| P0-10 | Add cross-refs to `NETWORKING-IMPROVEMENT-PLAN.md` (3 missing docs + line 803 fix) | §11.3 | 1 hour | + +### 12.2 P1 — Completeness & Validation (Near-Term, 4-6 weeks) + +| ID | Action | Source | Effort | +|----|--------|--------|--------| +| P1-1 | TCP `SendMsg` in relibc | DEF-P0-9 | 3-5 days | +| P1-2 | `MSG_NOSIGNAL` in relibc | DEF-P1-1 | 1-2 days | +| P1-3 | DHCP lease renewal/rebind in dhcpd | §5.5 | 3-5 days | +| P1-4 | Wi-Fi IP datapath bridge (802.11→Ethernet into netstack's `DeviceList`) | §5.6 | 1-2 weeks | +| P1-5 | Memory barriers (fence) between DMA desc writes and doorbell writes in 5 drivers | DEF-P1-18 | 2-3 days | +| P1-6 | `# Safety` on all 52 unsafe blocks in ethernet drivers | DEF-P0-5 | 1-2 days | +| P1-7 | Replace unsafe libc in redbear-traceroute with relibc socket API | DEF-P1-19 | 1 day | +| P1-8 | Compile-time MMIO register bounds assertions | §6.2 | 1 week | +| P1-9 | Acquire hardware (USB BT, USB-C Ethernet, Threadripper NIC inventory) | §8.1 | logistics | +| P1-10 | Validate shared-IRQ re-arm fix on real hardware (DEF-P1-23) | DEF-P1-23 | 1 week | + +### 12.3 P2 — Quality & Performance (Medium-Term, 4-6 weeks) + +| ID | Action | Source | Effort | +|----|--------|--------|--------| +| P2-1 | Replace silent error swallowing with `log::warn!` + drop | §9.4 | 1 week | +| P2-2 | Replace `unwrap()`/`expect()` in daemon init paths | §9.1 | 1-2 weeks | +| P2-3 | `# Safety` on all unsafe blocks in driver libraries (~80 redox-driver-sys) | §9.2 | 2-3 days | +| P2-4 | Standardize on `log` crate in all networking daemons | §10.1 | 1-2 days | +| P2-5 | Create `redbear-net-error` crate with unified error enum | §10.2 | 1 week | +| P2-6 | Integrate clang static analysis for linux-kpi C headers | §10.8 | 2-3 days | +| P2-7 | Add CI gate to run host unit tests on every PR | §10.9 | 1-2 days | +| P2-8 | Live TCP/UDP socket table enumeration in redbear-netstat | §5.4 | 1 week | +| P2-9 | `#[repr(C)]` on all structs serialized via `from_raw_parts` | §6.2 | 1-2 days | +| P2-10 | Document quirk table format and add-entry procedure | §10.8 | 1 day | + +### 12.4 P3 — Polish & Parity (Backlog, 6-12 months) + +| ID | Action | Source | Effort | +|----|--------|--------|--------| +| P3-1 | IP multicast (IGMPv3/MLDv2) | §7.1 | 2-4 weeks | +| P3-2 | `sendmmsg` / `recvmmsg` | §7.6 | 1 week | +| P3-3 | SCM_RIGHTS (FD passing over UDS) | §7.6 | 1-2 weeks | +| P3-4 | SO_TIMESTAMP / SO_TIMESTAMPNS | §7.6 | 1 week | +| P3-5 | Implement `audiodevd` source | §5.4 | 2-3 weeks | +| P3-6 | Implement `usbd` source | §5.4 | 2-3 weeks | +| P3-7 | Wire `redbear-firmware-{amdgpu,intel,iwlwifi,bluetooth}` download recipes | §5.4 | 1-2 days each | +| P3-8 | Wire `redbear-wayland-guard` recipe.toml | §5.4 | 30 min | +| P3-9 | DHCPv6 client | §7.2 | 2-4 weeks | +| P3-10 | A2DP / HFP / AVRCP Bluetooth profiles | §7.4 | 4-8 weeks | +| P3-11 | WPA3-SAE for Wi-Fi | §7.3 | 2-4 weeks | +| P3-12 | Wi-Fi roaming | §7.3 | 2-4 weeks | +| P3-13 | BPF / eBPF for observability | §7.8 | 4-8 weeks | +| P3-14 | `redbear-driver-policy` runtime validation | §7.7 | 1 week | + +### 12.5 Roadmap Dependency Graph + +P0 safety docs → P2-3; P0 MMIO bounds → P1-5, P1-8; P0 buffer_pool/worker_pool → P2-1; P1-1 (TCP SendMsg) → P3-2; P1-2 (option level) → P3-3; P1-3 (DHCP renewal) → P3-9; P1-4 (Wi-Fi datapath) → W4; P1-9 (hardware) → W4/B7/LG Gram net; P2-7 (CI gate) → unblocks all P3. + +### 12.6 Effort Estimates + +| Phase | 1 dev | 2 devs | +|-------|-------|--------| +| P0 (10 items) | 1-2 weeks | 1 week | +| P1 (10 items) | 4-6 weeks | 2-3 weeks | +| P2 (10 items) | 4-6 weeks | 2-3 weeks | +| P3 (14 items) | 6-12 months | 3-6 months | + +### 12.7 Owner Assignments (suggestion) + +- **P0-1 to P0-5** (relibc + libredox + drivers): Driver infrastructure owner +- **P0-6** (dnsd wiring): Build system owner +- **P0-9 to P0-10** (doc cross-refs): Doc maintainer +- **P1-1 to P1-2, P1-7** (relibc socket surface): relibc owner +- **P1-3** (DHCP renewal): Networking owner +- **P1-4** (Wi-Fi datapath): Wi-Fi owner + netstack owner +- **P1-5, P1-6, P1-8, P1-10** (driver memory safety + HW validation): Driver infrastructure owner +- **P1-9** (hardware acquisition): Operator + +### 12.8 Alignment with Canonical Sub-Plans + +All P0/P1/P2/P3 items map to one or more of: +- `[REF: local/docs/NETWORKING-IMPROVEMENT-PLAN.md]` (wired TCP/IP phases) +- `[REF: local/docs/WIFI-IMPLEMENTATION-PLAN.md]` (W phases) +- `[REF: local/docs/BLUETOOTH-IMPLEMENTATION-PLAN.md]` (B phases) +- `[REF: local/docs/USB-IMPLEMENTATION-PLAN.md]` (P phases) +- `[REF: local/docs/DRIVER-MANAGER.md]` (post-v5.9 correctness review) + +This assessment does NOT redefine those phase structures; it cross-references them and provides the cross-cutting synthesis. + +--- + +## 13. Validation Plan + +### 13.1 Validation Tiers + +Per §0.4 maturity rubric: +- **Host unit tests:** `cargo test` on Linux host. +- **QEMU tests:** `local/scripts/test-*.sh` scripts (see USB-VALIDATION-RUNBOOK.md). +- **Bare-metal tests:** operator-reported with captured log (HARDWARE-VALIDATION-MATRIX.md). + +### 13.2 Wired Network Validation + +1. `cargo test` in `local/sources/base/netstack/` — 31 filter tests. +2. `test-firewall-scenarios.sh` per FIREWALL-VALIDATION-LOG.md — 6 scenarios, expect PASS. +3. QEMU virtio-net → boot → DHCP → ping → curl. +4. QEMU e1000 → boot → DHCP → ping → curl. +5. QEMU rtl8139 → boot → DHCP → ping → curl. +6. Bare metal: Threadripper with onboard NIC → DHCP → curl (after NIC inventory). + +### 13.3 Wireless Validation + +1. `cargo test` in `local/recipes/drivers/linux-kpi/` (93 tests). +2. `cargo test` in `local/recipes/drivers/redbear-iwlwifi/` (8 tests). +3. `cargo test` in `local/recipes/system/redbear-wifictl/` (20 tests). +4. `test-wifi-control-runtime.sh` per `local/AGENTS.md:1249`. +5. `test-wifi-passthrough-qemu.sh` (VFIO framework). +6. Bare metal: LG Gram BE201 → boot → scan → connect → DHCP → curl (W4 First Association Milestone). + +### 13.4 Bluetooth Validation + +1. `cargo test` in `local/recipes/drivers/redbear-btusb/` (151 tests). +2. `cargo test` in `local/recipes/system/redbear-btctl/` (56 tests). +3. QEMU with USB BT adapter → `redbear-bluetooth-battery-check` per BLUETOOTH-IMPLEMENTATION-PLAN.md. +4. Bare metal: USB BT on LG Gram → scan → battery read (B7). + +### 13.5 USB Validation + +Per USB-VALIDATION-RUNBOOK.md: `test-xhci-irq-qemu.sh --check`, `test-xhci-device-lifecycle-qemu.sh --check`, `test-usb-qemu.sh`, `test-usb-storage-qemu.sh`, `test-uhci-runtime-qemu.sh --check` (P1-B), `test-ohci-runtime-qemu.sh --check` (P1-B), `test-ehci-class-autospawn-qemu.sh --check` (P1-A), `test-usb-hub-qemu.sh --check` (P3-A), `test-usb-error-recovery-qemu.sh --check` (P8-C), `test-usb-uas-qemu.sh --check` (P4-A), **NEW: `test-usb-cdc-ecm-qemu.sh`**. Bare metal: LG Gram + USB-C dongle → boot → DHCP → curl. + +### 13.6 Driver Runtime Validation + +- **PCID:** `cargo test` for the 11 drivers swept in shared-IRQ re-arm class. +- **ACPI:** boot test on AMD64 + LG Gram; verify shutdown/reboot/power. +- **IOMMU:** `iommu self-test` in QEMU; bare-metal AMD-Vi TBD. +- **GPU:** QEMU virtio-gpu auto-probe; bare-metal VESA. +- **Audio:** QEMU Intel HDA (ihdad); bare-metal audio TBD. +- **Storage:** QEMU AHCI/NVMe/virtio-blk; bare-metal NVMe (LG Gram SK Hynix). + +### 13.7 Daemon Validation + +- `redbear-sessiond` — QEMU → verify login1 methods via D-Bus. +- `redbear-greeter` — QEMU → verify GREETER_HELLO/VALID. +- `redbear-netctl` — QEMU → verify profile application. +- `redbear-dnsd` — QEMU → verify name resolution (after P0-6 wiring). +- `redbear-wifictl` — see §13.3. +- `redbear-btctl` — see §13.4. +- `driver-manager` — QEMU → verify ahcid + e1000d bind (v3.2 QEMU gate). + +### 13.8 CI Regression Gates + +- `cargo test` (host) on linux-kpi, iwlwifi, redbear-wifictl, redbear-btusb, redbear-btctl, fatd. +- `cargo build` for all in-tree recipes. +- `lint-config-paths.sh` for init service path violations. +- `validate-init-services.sh` for override effectiveness. +- `validate-file-ownership.sh` for file ownership conflicts. + +### 13.9 Sign-off Criteria + +A P0/P1/P2/P3 item is **signed off** when: fix implemented on canonical branch + verified by corresponding test (host unit / QEMU / bare metal) + cross-referenced from §14 + canonical sub-plan updated if maturity tier changes. + +--- + +## 14. Appendix: `file:line` References + +### 14.1 Wired Network Findings + +| ID | File:Line | Description | +|----|-----------|-------------| +| DEF-P0-3 | `local/sources/base/netstack/src/buffer_pool.rs:84-86` | Unsafe set_len on recycled Vec | +| DEF-P0-4 | `local/sources/base/netstack/src/worker_pool.rs:61,65` | dup fd not checked | +| DEF-P0-11 | `local/sources/relibc/src/platform/redox/socket.rs` (scheme protocol) | Option level collision | +| DEF-P0-12 | `local/docs/NETWORKING-IMPROVEMENT-PLAN.md:803` | References non-existent file | +| DEF-P1-1 | `local/sources/relibc/src/platform/redox/socket.rs:1027` | MSG_NOSIGNAL | +| DEF-P1-2 | `local/sources/relibc/src/platform/redox/socket.rs:599,689` | FIXME clippy | +| DEF-P1-3 | `local/sources/relibc/src/platform/redox/socket.rs:824` | todo_skip getsockopt | +| DEF-P1-4 | `local/sources/base/netstack/src/scheme/mod.rs:274` | Event notification | +| DEF-P1-5 | `local/sources/base/netstack/src/scheme/tcp.rs:101` + `udp.rs:140` | Port claiming | +| DEF-P1-6 | `local/sources/base/netstack/src/scheme/netcfg/mod.rs:581` | Multiple IPs | +| DEF-P1-7 | `local/sources/base/netstack/src/scheme/netcfg/mod.rs:595` | UDP socket insert | +| DEF-P1-8 | `local/sources/base/netstack/src/scheme/icmp.rs:205,232` | ICMP caps stub | +| DEF-P1-9 | `local/sources/base/netstack/src/link/ethernet.rs:179,281,318,327,352,387,397` | Silent packet discard | +| DEF-P1-10 | `local/sources/base/netstack/src/router/mod.rs:144,166,325,332` | Silent router enqueue | +| DEF-P1-11 | `local/sources/base/netstack/src/scheme/mod.rs:520,544,609,626,635,644` | Silent scheme write | +| DEF-P1-23 | All drivers | Shared-IRQ re-arm validation | +| DEF-P2-1 | `local/sources/base/netstack/src/logger.rs:4` | Logger init stderr only | +| DEF-P2-2 | `local/sources/base/netstack/src/worker_pool.rs:170-186` | Test-only FAKE in production | +| DEF-P2-3 | 85 instances / 24 files | Integer truncation casts | +| DEF-P2-4 | 67 instances / 26 files | Trait methods returning bool | +| DEF-P2-7 | `local/sources/relibc/src/platform/redox/socket.rs:1055,1090` | unwrap on as_c_fd | +| DEF-P2-8 | `local/sources/relibc/src/platform/redox/socket.rs:85,572` | Silent error swallow | +| DEF-P2-9 | `local/sources/relibc/src/platform/redox/socket.rs` recvfrom/sendto | Single read/write | +| DEF-P3-1 | `local/sources/base/netstack/src/scheme/netcfg/mod.rs:35` | TODO const fn | +| DEF-P3-2 | `local/sources/base/netstack/src/scheme/mod.rs:333` | Poll return underused | +| DEF-P3-6 | `local/sources/base/netstack/src/scheme/socket.rs:469,498` | Unspecified TODO | +| DEF-P3-7 | `local/sources/base/netstack/src/router/mod.rs:364` | Stale route cleanup | + +### 14.2 Wireless Findings + +| ID | File:Line | Description | +|----|-----------|-------------| +| (none P0/P1) | — | All software-complete; HW validation in §8.1 | +| §5.6 | `local/recipes/drivers/linux-kpi/` | linux-kpi scope: GPU + Wi-Fi only | + +### 14.3 Bluetooth Findings + +| ID | File:Line | Description | +|----|-----------|-------------| +| (none P0/P1) | — | All software-complete; HW validation in §8.1 | +| §4.7 | `local/recipes/drivers/redbear-btusb/source/10_btusb.service` | Not autospawned | + +### 14.4 Driver Findings + +| ID | File:Line | Description | +|----|-----------|-------------| +| DEF-P0-5 | `local/sources/base/drivers/net/{e1000d,rtl8139d,rtl8168d,virtio-netd}/src/*.rs` | unsafe fn new without Safety | +| DEF-P0-6 | `local/sources/base/drivers/net/{e1000d,rtl8139d,rtl8168d}/src/device.rs` | Missing MMIO bounds check | +| DEF-P0-7 | `local/sources/base/drivers/net/rtl8139d/src/main.rs:35`, `rtl8168d/src/main.rs:35` | panic! on failed BAR | +| DEF-P1-12 | `local/sources/base/drivers/net/driver-network/src/lib.rs:29` | No back pressure | +| DEF-P1-13 | `local/sources/base/drivers/net/driver-network/src/lib.rs:88` | Scheme event API gap | +| DEF-P1-14 | `local/sources/base/drivers/net/e1000d/src/device.rs:284` | Statistics never cleared | +| DEF-P1-15 | `local/sources/base/drivers/net/rtl8139d/src/device.rs:206` | No TSD_TOK wait | +| DEF-P1-16 | `local/sources/base/drivers/net/virtio-netd/src/main.rs:112` | IRQ vector | +| DEF-P1-17 | `local/sources/base/drivers/net/virtio-netd/src/main.rs:136` | Device init ordering | +| DEF-P1-18 | All 5 drivers | No memory barriers | +| DEF-P2-5 | 157 instances / 10 files | Integer casts in drivers | +| DEF-P2-6 | `local/sources/base/drivers/net/ixgbed/src/main.rs:29` | println! instead of log | +| DEF-P2-15 | `local/recipes/drivers/linux-kpi/source/src/c_headers/` | No clang-analyzer | + +### 14.5 Daemon Findings + +| ID | File:Line | Description | +|----|-----------|-------------| +| DEF-P0-10 | `config/redbear-mini.toml` (and full) | redbear-dnsd not wired | +| DEF-P1-19 | `local/recipes/system/redbear-traceroute/source/src/lib.rs:154-214` | Raw libc syscalls | +| DEF-P1-20 | `local/recipes/system/redbear-netctl/source/src/main.rs:782,857,916,985,1026,1051` | Unsafe chmod | +| DEF-P1-21 | `local/recipes/system/redbear-dnsd/source/src/transport.rs:47` | Unsafe FD handling | +| DEF-P1-22 | `recipes/net/openssh/recipe.toml` | 3 TODOs in openssh recipe | +| DEF-P2-11 | redbear-netctl (61) / redbear-wifictl (65) / redbear-dnsd (11) / redbear-usbaudiod (1) | unwrap/expect in daemon init | +| DEF-P2-12 | redbear-netctl-console (14) / redbear-btctl (2) / redbear-wifictl (10) / redbear-dnsd (5) / redbear-traceroute (8) | Unsafe blocks without docs | +| DEF-P2-13 | All networking daemons | No logging | +| DEF-P2-14 | `local/recipes/drivers/redox-driver-sys/source/src/` (~80 unsafe blocks) | Unsafe FFI without docs | + +### 14.6 libredox Findings + +| ID | File:Line | Description | +|----|-----------|-------------| +| DEF-P0-2 | `local/sources/libredox/src/lib.rs` (49 sites) | Zero `# Safety` documentation | +| DEF-P0-8 | `local/sources/libredox/src/lib.rs:43` | demux() .expect() panics on overflow | +| DEF-P2-10 | `local/sources/libredox/src/lib.rs:503` | Drop ignores close failures | + +### 14.7 relibc Findings + +| ID | File:Line | Description | +|----|-----------|-------------| +| DEF-P0-1 | `local/sources/relibc/src/platform/redox/socket.rs` (99 sites) | Zero `# Safety` documentation | +| DEF-P0-9 | `local/sources/relibc/src/platform/redox/socket.rs:1028` | TCP SendMsg missing | +| DEF-P0-11 | scheme protocol | Socket option level collision | +| DEF-P1-1 | `local/sources/relibc/src/platform/redox/socket.rs:1027` | MSG_NOSIGNAL | +| DEF-P1-2 | `local/sources/relibc/src/platform/redox/socket.rs:599,689` | FIXME clippy | +| DEF-P1-3 | `local/sources/relibc/src/platform/redox/socket.rs:824` | todo_skip getsockopt | +| DEF-P2-7 | `local/sources/relibc/src/platform/redox/socket.rs:1055,1090` | unwrap on as_c_fd | +| DEF-P2-8 | `local/sources/relibc/src/platform/redox/socket.rs:85,572` | Silent error swallow | +| DEF-P2-9 | recvfrom/sendto | Single read/write without partial handling | +| DEF-P3-3 | `local/sources/relibc/src/header/sys_socket/mod.rs:91` | CheckVsLibcCrate FIXME | + +### 14.8 Documentation Findings + +| ID | Doc | Description | +|----|-----|-------------| +| DEF-P0-12 | `local/docs/NETWORKING-IMPROVEMENT-PLAN.md:803` | References non-existent file | +| §11.3 #1 | `NETWORKING-IMPROVEMENT-PLAN.md` | Missing cross-refs to 3 docs (HIGH priority) | +| §11.3 #2 | `NETWORKING-IMPROVEMENT-PLAN.md:803` | References non-existent networking-validation-log.md (MEDIUM) | + +### 14.9 Audit Provenance & Timestamps + +- Audits executed: 2026-07-27 (Asia/Tokyo). +- Total session duration: ~30 minutes of audit + ~15 minutes of synthesis. +- Notepad: `/tmp/ulw-20260727-124424.GHGvim.md`. +- Background tasks: bg_fac0f480, bg_70c34323, bg_c7e85bcf, bg_d9d28bcc, bg_ae64abff. + +### 14.10 Glossary + +- **scheme:** Redox's filesystem-namespace IPC primitive (e.g., `scheme:tcp`, `scheme:netcfg`). +- **relibc:** Redox's Rust-written POSIX libc. +- **libredox:** Redox's userland FFI crate (syscall wrappers). +- **netstack / smolnetd:** Userspace TCP/IP daemon (smoltcp 0.13.1). +- **DHCP:** base fork `dhcpd` (DHCPv4 one-shot only). +- **linux-kpi:** Linux Kernel Programming Interface shim (C headers + Rust wrappers). +- **redox-driver-sys:** Safe Rust FFI for scheme:memory, scheme:irq, scheme:pci + quirks. +- **Quirk:** Hardware-specific workaround flag in PCI/USB/xHCI tables. +- **CUBIC:** TCP congestion control algorithm. +- **MSI/MSI-X:** Message-Signaled Interrupts (PCIe interrupt delivery). +- **PAM:** Pluggable Authentication Modules. +- **D-Bus:** Desktop IPC bus (system + session). +- **Zbus:** Pure-Rust D-Bus crate. + +--- + +## 15. Changelog + +| Date | Change | +|------|--------| +| 2026-07-27 | First edition. Synthesis of 5 parallel audits. Replaces no prior consolidated doc. | +| 2026-07-27 | §3.3, §11.2 — noted dual-location for IRQ plan (canonical at `local/docs/`, mirror at `legacy-obsolete-2026-07-25/` per AGENTS.md path-fork stability pattern). | + +--- + +*End of document. For canonical per-subsystem details, see the `[REF: ...]` cross-references in §3.* \ No newline at end of file diff --git a/local/docs/SUPERSEDED-DOC-LOG.md b/local/docs/SUPERSEDED-DOC-LOG.md new file mode 100644 index 0000000000..89926d95b8 --- /dev/null +++ b/local/docs/SUPERSEDED-DOC-LOG.md @@ -0,0 +1,150 @@ +# Stale-Doc Deletion Log — 2026-07-27 + +This log records every doc affected by the consolidation authorized on 2026-07-27 +(operator selected option A: "Execute the doc deletion + restore"). It is the audit trail. + +## Backup + +**Tarball:** `/tmp/opencode/stale-doc-backup-2026-07-27.tar.gz` (386,925 bytes, 40 entries). +Captured BEFORE any `rm`. tar -tzf integrity verified. + +## Restored + +| Source | Destination | Reason | +|--------|-------------|--------| +| `local/docs/legacy-obsolete-2026-07-25/IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN.md` | `local/docs/IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN.md` | Document self-declares it is still the active low-level-controller authority despite the legacy folder name. SUPERSEDED.md had erroneously listed it as superseded. | + +The IRQ plan carries stale `pcid-spawner` references that need a follow-up rename pass to +`driver-manager`. Tracked as a separate cleanup task — NOT executed in this consolidation. + +## Replaced (deleted, content absorbed into consolidated doc) + +The new consolidated audit and plan is `local/docs/3D-DESKTOP-COMPREHENSIVE-PLAN.md` +(1,029 lines, 14 sections). It absorbs the Rounds 1-7 of `3D-DRIVER-PLAN.md` and the +milestone status of `REDBEAR-FULL-SDDM-BRINGUP.md`. + +| Deleted | Lines | Reason for replacement | +|---------|-------|------------------------| +| `local/docs/3D-DRIVER-PLAN.md` | 960 | All ground-truth and Round-7 work fact-of-record in consolidated doc. Operating principle restated in §0. | +| `local/docs/REDBEAR-FULL-SDDM-BRINGUP.md` | 177 | Build-campaign log; status captured in §1.5 of consolidated doc. | + +## Deleted (with backup) + +### From `local/docs/legacy-obsolete-2026-07-25/` (10 docs) + +| File | Lines | Reason | +|------|-------|--------| +| `05-KDE-PLASMA-ON-REDOX.md` | 560 | Self-labeled historical/superseded. Pre-KF6 instructions superseded by consolidated doc + `CONSOLE-TO-KDE-DESKTOP-PLAN.md` | +| `BUILD-SYSTEM-ASSESSMENT-2026-07-18.md` | 464 | Audit absorbed into AGENTS.md policies | +| `BUILD-SYSTEM-HARDENING-PLAN.md` | 624 | Phases implemented; collision work now in `COLLISION-DETECTION-STATUS.md` | +| `DRM-MODERNIZATION-EXECUTION-PLAN.md` | 498 | Superseded by consolidated doc | +| `HOOKS.md` | 188 | Subsumed by `RELEASE-BUMP-WORKFLOW.md` + AGENTS.md | +| `INITNSMGR-CONCURRENCY-DESIGN.md` | 222 | Design for implemented O_NONBLOCK fix (v5.3) | +| `NETWORKING-STACK-STATE.md` | 120 | Superseded by `NETWORKING-IMPROVEMENT-PLAN.md` | +| `PATCH-PRESERVATION-AUDIT-2026-07-12.md` | 408 | Historical audit; 144-patch finding was addressed in subsequent rounds | +| `RAPL-IMPLEMENTATION-PLAN.md` | 530 | Draft, never implemented; power planning in `CONSOLE-TO-KDE` | +| `redbear-power-improvement-plan.md` | 6,184 | LARGEST file in repo. All improvement items done. Patterns extracted to `RATATUI-APP-PATTERNS.md` | +| `WAYLAND-IMPLEMENTATION-PLAN.md` | 186 | Diagnostic §§1-2 accurate; execution plan superseded by consolidated doc | + +(11 entries; "11" matches the 11 legacy-line items, not "10"; counts in summary reflect this.) + +### From `local/docs/archived/` (16 docs) + +| File | Lines | Reason | +|------|-------|--------| +| `ACPI-I2C-HID-IMPLEMENTATION-PLAN.md` | 339 | Deferred; USB HID is primary input path | +| `BUILD-SYSTEM-IMPROVEMENTS.md` | 621 | Historical post-mortem | +| `DRIVER-MANAGER-MIGRATION-PLAN.md` | 2,861 | Round-by-round history superseded by `DRIVER-MANAGER.md` | +| `IMPLEMENTATION-MASTER-PLAN.md` | 129 | Completion report superseded by `CONSOLE-TO-KDE` | +| `IMPROVEMENT-PLAN.md` | 575 | RESOLVED quality audit | +| `INTEL-HDA-IMPLEMENTATION-PLAN.md` | 417 | Deferred audio plan | +| `KERNEL-SCHEDULER-MULTITHREAD-IMPROVEMENT-PLAN.md` | 1,026 | Historical scheduler analysis | +| `RELIBC-IPC-ASSESSMENT-AND-IMPROVEMENT-PLAN.md` | 165 | Credential work resolved in `KERNEL-IPC-CREDENTIAL-PLAN.md` | +| `repo-governance.md` | 99 | Historical, absorbed into AGENTS.md | +| `SLEEP-IMPLEMENTATION-PLAN.md` | 306 | All phases committed | +| `STUBS-FIX-PROGRESS.md` | 507 | Completed v6.0 stubs work; outcome captured in §3.2 of consolidated doc | +| `SYSTEM-STABILITY-AND-UPSTREAM-SYNC-PLAN.md` | 819 | Archived, replaced by `CONSOLE-TO-KDE` | +| `UPSTREAM-SYNC-PROCEDURE.md` | 829 | References obsolete `pcid-spawner` model | +| `USB-BOOT-INPUT-PLAN.md` | 169 | Superseded | +| `USB-VALIDATION-RUNBOOK-2026-07.md` | 137 | Older version; canonical `USB-VALIDATION-RUNBOOK.md` at top-level | +| `XHCID-DEVICE-IMPROVEMENT-PLAN.md` | 360 | Superseded | + +### From `local/docs/evidence/driver-manager/` (2 docs) + +| File | Lines | Reason | +|------|-------|--------| +| `ASSESSMENT-2026-07-22.md` | 368 | Pre-cutover; superseded by `DRIVER-MANAGER.md` | +| `D5-AUDIT.md` | 390 | Pre-cutover D5 gate audit; superseded | + +### From `local/docs/fork-push-status/` (1 doc) + +| File | Lines | Reason | +|------|-------|--------| +| `2026-07-12-Round-9-phase-8.3.md` | 83 | Point-in-time push log | + +### From `local/docs/boot-logs/` (6 docs — entire directory) + +| File | Lines | Reason | +|------|-------|--------| +| `README.md` | 57 | Directory inventory only | +| `cachyos-boot-20260629-0520.md` | 52 | Reference log from CachyOS | +| `REDBEAR-FULL-BOOT-EXTENDED-RESULTS.md` | 295 | Boot test from 2026-06-09 | +| `REDBEAR-FULL-BOOT-POST-VIRTIO-BLKD-FIX-RESULTS.md` | 238 | Boot test from 2026-06-09 | +| `REDBEAR-FULL-BOOT-RESULTS.md` | 281 | Boot test from 2026-06-09 | +| `REDBEAR-MINI-BOOT-PS2D-INPUTD-LOG-FIX.md` | 134 | Bug diagnostic from 2026-06-30 (bug fixed) | + +### From `local/docs/legacy-recipe-patches/` (1 doc) + +| File | Lines | Reason | +|------|-------|--------| +| `README.md` | 37 | Navigation aid only | + +## Updated (NOT deleted; clear superseded entry) + +| File | Change | +|------|--------| +| `local/docs/legacy-obsolete-2026-07-25/SUPERSEDED.md` | Removed the incorrectly listed "IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN.md is subsumed by Round 1-5 kernel work" line; replaced with cross-reference to its restored location. | +| `local/docs/archived/README.md` | Updated inventory table — entries moved to deletion log. | + +## KEPT (companion plans, not affected) + +`local/docs/3D-DESKTOP-COMPREHENSIVE-PLAN.md` is the new authoritative 3D-desktop doc. +Companion plans (referenced from §12 of the new doc) are NOT touched: +- `local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md` (desktop journey) +- `local/docs/DBUS-INTEGRATION-PLAN.md`, `local/docs/QT6-WAYLAND-NULL8-DIAGNOSIS.md`, + `local/docs/INPUT-STACK-LINUX-ALIGNMENT-PLAN.md`, + `local/docs/KERNEL-IPC-CREDENTIAL-PLAN.md`, `local/docs/ACPI-IMPROVEMENT-PLAN.md`, + `local/docs/USB-IMPLEMENTATION-PLAN.md`, `local/docs/WIFI-IMPLEMENTATION-PLAN.md`, + `local/docs/BLUETOOTH-IMPLEMENTATION-PLAN.md`, + `local/docs/NETWORKING-IMPROVEMENT-PLAN.md`, `local/docs/DRIVER-MANAGER.md`, + `local/docs/INIT-NAMESPACE-MANAGER-SCALABILITY-PLAN.md`, + `local/docs/LG-GRAM-16Z90TP-COMPATIBILITY-PLAN.md`, + `local/docs/HARDWARE-NETWORKING-INVENTORY.md`, + `local/docs/HARDWARE-VALIDATION-MATRIX.md`, + `local/docs/FIREWALL-VALIDATION-LOG.md`, + `local/docs/BUILD-SYSTEM-INVARIANTS.md`, `local/docs/BUILD-CACHE-PLAN.md`, + `local/docs/PACKAGE-BUILD-QUIRKS.md`, + `local/docs/QUIRKS-SYSTEM.md`, `local/docs/QUIRKS-AUDIT.md`, + `local/docs/QUIRKS-IMPROVEMENT-PLAN.md`, + `local/docs/LOCAL-FORK-SUPREMACY-POLICY.md`, + `local/docs/PATCH-GOVERNANCE.md`, `local/docs/RELEASE-BUMP-WORKFLOW.md`, + `local/docs/SCRIPT-BEHAVIOR-MATRIX.md`, `local/docs/RATATUI-APP-PATTERNS.md`, + `local/docs/CUB-PACKAGE-MANAGER.md`, `local/docs/GRUB-INTEGRATION-PLAN.md`, + `local/docs/COLLISION-DETECTION-STATUS.md`, + `local/docs/USB-VALIDATION-RUNBOOK.md`, + `local/docs/GREETER-LOGIN-IMPLEMENTATION-PLAN.md` +- `local/docs/evidence/lg-gram/ASSESSMENT-2026-07-26.md` (active LG Gram evidence) +- `local/docs/archived/README.md`, `local/docs/legacy-obsolete-2026-07-25/SUPERSEDED.md` + (inventory / index docs; updated, not deleted) + +## Summary + +- **Restored:** 1 doc +- **Replaced (deleted, content absorbed):** 2 docs +- **Deleted (with backup):** 36 docs across 6 locations +- **Updated (text only):** 2 inventory docs +- **Total operations:** 41 +- **Tarball size:** 386,925 bytes +- **Net effect:** 38 files removed from git's working tree; 1 file moved from + `legacy-obsolete-2026-07-25/` to top-level. The 3D-desktop subsystem is now expressible + as a single canonical doc (`3D-DESKTOP-COMPREHENSIVE-PLAN.md`) plus 35 companion plans.