DF-5565 / verdict.json
{ "finding_id": "DF-5565", "status": "reproduced", "reproduced": true, "impact": "dos", "confidence": "certain", "verdict": "The first do-while of iicbus_request_bus (iiconf.c:92-97) re-invokes the bridge callback whenever iicbus_poll returns EWOULDBLOCK; for how == IIC_DONTWAIT the polls default case (iiconf.c:70-72) returns EWOULDBLOCK immediately without sleeping, so a persistently-busy bridge callback produces a tight unbounded kernel loop with no signal checkpoint. Demonstrated on the guest: ./park nowait under hw.df5563.busy=1 stayed in STAT R with CPU TIME accruing exactly 1:1 with wall clock (3s->6s->9s CPU over 3s->6s->9s wall), SIGKILL was IGNORED (no signal checkpoint in the loop), and the ioctl only completed after the bridge was unbusied. The busy-callback contract is real in-tree: lpbb forwards IIC_REQUEST_BUS to ppb_request_bus (lpbb.c:97-101), which returns EWOULDBLOCK immediately for DONTWAIT when the ppbus is held (ppbconf.c:458-493); iicwrite/iicread on /dev/iicN are the DONTWAIT callers (iic.c:212-213, 253-254).", "exploit_chain": "root on an lpbb system: open /dev/lpt0 (or otherwise hold the ppbus), then write()/read() /dev/iicN -> iicwrite/iicread -> iicbus_request_bus(IIC_DONTWAIT) -> infinite kernel loop: one CPU pegged at 100% in kernel mode, the calling process unkillable (kill -9 ignored), the fd held open. Only freeing the ppbus ends it. Any KLD bridge with a busy callback reproduces it identically (rig-proven).", "evidence": "run.log: ps lines 2007 R1 0:03.01 -> 2007 R1 0:06.01 (TIME grows with wall clock, STAT never leaves R), SIGKILL_IGNORED=YES, GONE_AFTER_UNBUSY=YES. fix_run.log: with fix.diff the same call returns errno=35: Resource temporarily unavailable immediately, twice, no spin.", "kernel_refs": [ "sys/bus/iicbus/iiconf.c:92-97", "sys/bus/iicbus/iiconf.c:70-72", "sys/bus/iicbus/iic.c:212-213", "sys/bus/iicbus/iic.c:253-254", "sys/dev/misc/lpbb/lpbb.c:90-113", "sys/bus/ppbus/ppbconf.c:458-493" ], "poc_changes": "Shared rig with DF-5563; ./park nowait drives iicbus_request_bus(bus, dev, IIC_DONTWAIT), the iicwrite/iicread contract; hw.df5563.busy=1 emulates the lpbb ppbus-held callback.", "attempts": 1, "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": 180, "guest_dirty": 0, "build_cmd": "cd /root/df5563 && sh build.sh", "run_cmd": "sh /root/df5565/run.sh", "code_hash": "ebe006166647097cef900f01cd62c0d0bf74cb841e9a9b1a6f7c536898950ab4", "notes": "Non-destructive test (clearing hw.df5563.busy ends the loop and the pending SIGKILL reaps the process). The second loop of request_bus handles DONTWAIT correctly (releases+returns at iiconf.c:110-113); only the first loop spins.", "recommended_fix": "Restructured request loop performs exactly one callback attempt for DONTWAIT (DF-5563 fix.diff).", "fix_status": "fixed", "fix_baseline_reproduced": true, "fix_patched_reproduced": false, "fix_verdict": "With fix.diff the identical DONTWAIT+busy call returns EWOULDBLOCK (errno 35) immediately with no spin (fix_run.log F3v section), and the attach sanity round trip still passes.", "fix_evidence": "findings/poc/DF-5565/fix_run.log (F3v section); fix.diff (shared with DF-5563)" } |