BT848_SCAPAREA performs no validation: x_size=0 reaches build_dma_prog's horizontal-delay computation β integer division by zero β kernel panic
Summary
BT848_SCAPAREA stores x/y offsets and sizes verbatim (no >0/bounds checks) and enables the capture area. The next capture start divides by (capture_area_x_size * fp->hactive) - zero when x_size=0 - producing a #DE integer-divide trap and a kernel panic. VERIFIED: harness compiles the exact expression with the PoC parameters and dies with SIGFPE (rc=136) on the guest - the kernel equivalent is a #DE panic. Unprivileged local DoS (deterministic panic).
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-3788 Β· 10 files| File | Type | Description | Size | |
|---|---|---|---|---|
| harness_div0.c | β | 1.6 KB | view raw | |
| poc_caparea_div0.c | β | 1.2 KB | view raw | |
| build.log | β | 1.5 KB | view raw | |
| run.log | β | 184 B | view raw | |
| env.txt | β | 412 B | view raw | |
| poc_build_and_device_check.log | β | 1 B | view raw | |
| fix.diff | β | 688 B | view raw | |
| VERDICT.md | β | 2.8 KB | β raw | |
| manifest.json | β | 798 B | view raw | |
| verdict.json | β | 1.7 KB | view raw |
DF-3788 β verdict
REPRODUCED | reproduced=1 | impact=dos | confidence=certain
REPRODUCED at source level: the exact expression from bktr_core.c:3344-3346 with the PoC parameters compiles and raises SIGFPE (rc=136) on the DragonFly guest - in the kernel the same #DE is a panic.
Root cause (citations)
BT848_SCAPAREA (bktr_core.c:1758-1771) copies the user-supplied capture area verbatim (no >0 / bounds checks) and sets capture_area_enabled=TRUE. The next capture start runs build_dma_prog(), whose horizontal-delay computation divides by (capture_area_x_size * fp->hactive) (bktr_core.c:3344-3346). With x_size = 0 the denominator is zero -> #DE integer-divide trap -> kernel panic. (The earlier HSCALE expression at 3320-3325 divides by scaled_htotal/cols, both nonzero, so execution reaches the faulting divide.) Unprivileged local DoS on any machine with the driver: /dev/bktr0 is 0444.
Guest reality (why no runtime kernel trigger)
The audit guest is DragonFly 6.5-DEVELOPMENT x86_64 (X86_64_GENERIC). The bktr
driver is NOT compiled into the GENERIC kernel (sys/conf/files: optional
bktr pci), there is no /boot/modules tree, no /dev/bktr, /dev/tuner,
/dev/vbi* nodes, no Brooktree PCI device (QEMU has no Bt848/Bt878 device
model; pciconf -lv shows no vendor 109e). Therefore the kernel code path is
unreachable ON THIS GUEST. Verification is source-level: faithful harnesses of
the exact kernel arithmetic (the same methodology as the accepted DF-1216
evidence pack), run on the DragonFly guest with its native cc, plus fix.diff
compile-validation against the guest's /usr/src. All PoC triggers compile
cleanly against the guest's kernel headers (poc_build_and_device_check.log).
Exploit chain
open /dev/bktr0 (0444) -> BT848_SCAPAREA{x_size=0} -> METEORCAPTUR -> build_dma_prog divide-by-zero -> panic.
Decisive evidence
run.log: denominator 0*754=0 then 'Floating point exception' rc=136.
Fix validation
fix.diff (in this directory) applies cleanly against the pristine sys/ tree
(git apply --check) and compiles as part of the bktr KLD module on the
guest's /usr/src with -Werror together with the seven other pass-2 bktr fixes
(fix_build.log, MAKE_RC=0, bktr.ko + bktr_mem.ko produced). Runtime
patched-behavior validation is not possible on this guest (no device), hence
fix_status=not_testable (compile-validated + logic-reviewed).
Kernel references
- sys/dev/video/bktr/bktr_core.c:1758
- sys/dev/video/bktr/bktr_core.c:1766
- sys/dev/video/bktr/bktr_core.c:3345
Fix status (batch validation)
Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest make -j6 nativekernel KERNCONF=X86_64_GENERIC completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.
Fix verification
not_testableRuntime fix validation impossible on this guest (no Bt848/878 hardware, driver not in GENERIC, no module dir). fix.diff applies cleanly to sys/ and the patched bktr KLD module compiles with -Werror on the guest's /usr/src (fix_build.log).
fix.diff; fix_build.log (all-8-fixes module build, MAKE_RC=0)
Confirmed kernel references
Detail
Exploit chain
open /dev/bktr0 (0444) -> BT848_SCAPAREA{x_size=0} -> METEORCAPTUR -> build_dma_prog divide-by-zero -> panic.
Evidence (decisive lines)
run.log: denominator 0*754=0 then 'Floating point exception' rc=136.
PoC changes
none
Verified recommended fix
Validate x/y offsets and sizes in BT848_SCAPAREA (fix.diff)
Verdict
REPRODUCED at source level: the exact expression from bktr_core.c:3344-3346 with the PoC parameters compiles and raises SIGFPE (rc=136) on the DragonFly guest - in the kernel the same #DE is a panic.
No comments yet.