DF-5009 / verdict.json
{ "finding_id": "DF-5009", "status": "reproduced", "reproduced": 1, "impact": "panic", "confidence": "certain", "verdict": "rlphy_service() KASSERTs instance equality at entry for all commands (rlphy.c:200-201), but the miibus dispatch calls every PHYs service with the shared ifm_cur (mii.c:309-333, 346-348); on a dual-PHY MII bus (rlphy@inst0 + sibling@inst1) with the siblings unique media word selected, the stock INVARIANTS X86_64_GENERIC kernel panics rlphy_service: cant isolate RealTek PHY on every 1 Hz mii_tick and every unprivileged SIOCGIFMEDIA. Reproduced end-to-end on the QEMU guest with an out-of-tree synthetic dual-PHY KLD (fakemic.c): panic backtrace rlphy_service <- mii_tick captured in panic.txt. fix.diff (standard foreign-instance guard, same shape as ukphy/xmphy) built as a kernel and validated: identical trigger survives, guest stays up.", "exploit_chain": "", "evidence": "panic.txt (serial console: panic + rlphy_service/mii_tick backtrace); run.log (baseline procedure); run.fixed.log (patched kernel survives); build.log; VERDICT.md (path:line narrative)", "kernel_refs": [ "sys/dev/netif/mii_layer/rlphy.c:200", "sys/dev/netif/mii_layer/rlphy.c:145", "sys/dev/netif/mii_layer/mii.c:309", "sys/dev/netif/mii_layer/mii.c:330", "sys/dev/netif/mii_layer/mii.c:346", "sys/dev/netif/mii_layer/mii.c:138", "sys/net/if_media.c:393", "sys/config/X86_64_GENERIC:56" ], "poc_changes": "authored from scratch (no seed): out-of-tree KLD manufacturing the dual-PHY MII bus; three iterations were needed (nexus ivars via BUS_ADD_CHILD; attach moved from sysctl context to device_identify because device_sysctl_init self-deadlocks the sysctl lock; sibling given a media subtype unique vs rlphy because ifmedia_match ignores the instance field)", "attempts": 3, "guest_uname": "DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64", "runtime_sec": 2100, "guest_dirty": 0, "build_cmd": "cd /root/df5009 && make SYSDIR=/usr/src/sys", "run_cmd": "kldload ./fakemic.ko && sysctl -w kern.fakemic_arm=1", "code_hash": "f75578f4d389cca2be7998b464d3a1060be1c9efce188d921dc5026a902ea104", "fix_status": "fixed", "fix_baseline_reproduced": 1, "fix_patched_reproduced": 0, "fix_verdict": "fix.diff applied to guest /usr/src copy, nativekernel+installkernel+reboot; identical trigger re-run: no panic, fakemic: mii_tick survived -- rlphy KASSERT did NOT fire, guest healthy (run.fixed.log)", "fix_evidence": "run.fixed.log; kernel uname #1: Fri Sep 25 20:48:43 UTC 2026 vs baseline #0: Thu Jul 2", "notes": "Hardware precondition (dual-PHY MII bus with an rlphy-compatible PHY at the lower address) is unemulatable directly because if_rl.c:530-533 hard-returns 0 for phy!=0 on the 8139 fake; the synthetic KLD substitutes canned registers, everything from mii_phy_probe() down is the real in-kernel stack. Threat shape refined during verification: ifmedia_match() treats instance as dont-care (if_media.c:393-413), so the sibling is only selectable via a media subtype unique to it (combo/fiber/T4 PHY) -- default autoselect stays with instance 0 and does NOT panic. Family precedent: DF-1973 (mlphy).", "recommended_fix": "Replace the entry KASSERT in rlphy_service() with the standard foreign-instance early-return guard used by ukphy/xmphy: if (IFM_INST(ife->ifm_media) != sc->mii_inst) return (0);" } |