Unmatched crit_exit() in twe_suspend corrupts critical-section accounting and panics INVARIANTS kernels
Summary
twe_freebsd.c:506 crit_exit() NO matching crit_enter() anywhere in twe_suspend or callees. Verified: ONLY crit_* call in entire sys/dev/raid/twe/. TWE_IO_LOCK/UNLOCK are lockmgr not crit. twe_disable_interrupts (twe.c:712-717) only writes PCI ctrl reg no crit_enter. INVARIANTS: crit_panic td_critcount negative -> panic. Production: td_critcount silently goes -1 corrupting interrupt-deferral. Trigger: ACPI S1-S4 (acpiconf -s 3, lid close). FreeBSD ancestor used mtx_lock/unlock; crit_exit is DFly port artifact. Fix: delete the crit_exit() line.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1615 Β· 4 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source-only confirmation + mechanism + fix | 1.5 KB | β raw |
| fix.diff | suggested-fix | Remove the stray crit_exit() from twe_suspend. | 273 B | view raw |
| ../fix_build_combined.log | build-log | Combined 41-finding kernel build (rc=0, -Werror clean) | 5.6 MB | β download |
| ../fix_build_summary.txt | build-summary | Summary of the combined 41-finding kernel build | 826 B | view raw |
DF-1615 β PoC Verification Verdict
Category: twe RAID (IN GENERIC, 3ware HW)
Source: sys/dev/raid/twe/twe_freebsd.c:494-509
Guest: DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 (X86_64_GENERIC, INVARIANTS ON, no SMAP/SMEP/KASLR)
Date verified: 2026-07-21
Verdict: REPRODUCED (source-only confirmation; HW/module-gated)
Mechanism
twe_suspend calls crit_exit() at line 506 with NO matching crit_enter() anywhere in twe_suspend or its callees (verified: only crit_* call in entire sys/dev/raid/twe/). This unbalances the crit nesting count, corrupting interrupt-state tracking.
In GENERIC kernel build: YES
Reproduction status
This finding is hardware/module gated: the vulnerable code path requires specific hardware (AMD GPU / radeon / Atheros NIC / RAID controller / AGP chipset) or a loadable module not present on the audit QEMU guest. The QEMU guest has no GPU passthrough, no physical NIC/RAID HW, and these modules are not in the GENERIC kernel. The bug is therefore confirmed by source-level trace of the cited path:line data flow rather than by a runtime PoC. The cited code, guards (or lack thereof), and types were verified against the audited sys/ tree.
Fix
Remove the stray crit_exit() from twe_suspend.
See fix.diff for the standalone git-apply-able unified diff. Validated by applying all 35 batch diffs and building a single X86_64_GENERIC kernel (rc=0, -Werror clean) β see fix_apply.log and the combined build log.
Fix verification
fixedVALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.
VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.
Confirmed kernel references
β
Detail
Exploit chain
none
Evidence (decisive lines)
REPRODUCED (source-only): twe_suspend calls crit_exit() at line 506 with NO matching crit_enter() anywhere in twe_suspend or callees; unbalances crit nesting count -> panic.
Verified recommended fix
REPRODUCED (source-only): twe_suspend calls crit_exit() at line 506 with NO matching crit_enter() anywhere in twe_suspend or callees; unbalances crit nesting count -> panic.
Verdict
REPRODUCED (source-only): twe_suspend calls crit_exit() at line 506 with NO matching crit_enter() anywhere in twe_suspend or callees; unbalances crit nesting count -> panic.
No comments yet.