Divide-by-zero in ar5416IQCalibration when IQ cal measurements are small-but-nonzero
Summary
ar5416IQCalibration guards divisions with only if(powerMeasQ != 0) (line 98) but check is insufficient. iCoffDenom (line 95) = (powerMeasI/2 + powerMeasQ/2)/128 is zero whenever (powerMeasI/2 + powerMeasQ/2) < 128. qCoffDenom (line 96) = powerMeasQ/64 is zero whenever powerMeasQ in [1,63]. With either denominator zero kernel takes #DE trap (SIGFPE/kernel panic) at lines 100 or 101 during periodic IQ calibration. Guard at :98 incomplete: (a) powerMeasQ in [1,63] integer division /64 yields qCoffDenom==0 panics at :101 powerMeasI/qCoffDenom-64; (b) does not protect iCoffDenom at all so even when powerMeasQ large small powerMeasI (e.g. powerMeasI=0 powerMeasQ=200 -> iCoffDenom=(0+100)/128=0) panics at :100 iqCorrMeas/iCoffDenom. Any combination where (powerMeasI/2+powerMeasQ/2)<128 OR powerMeasQ<64 triggers trap. Values from OS_REG_READ of AR_PHY_CAL_MEAS_0/1 hardware PHY calibration measurement registers. Trigger: faulty/forged PCIe WiFi device or abnormal RF conditions (disconnected/damaged antenna weak signal during calibration window) drive small-but-nonzero power measurements. Calibration runs periodically whenever ath(4) up no privilege required. Impact: hard kernel panic full system DoS (#DE trap fatal kernel context x86) no memory corruption no info leak no priv-esc availability only.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2198 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | file | 767 B | β raw | |
| fix.diff | file | 185 B | view raw |
DF-2198 - Verification Verdict
Status: reproduced (source-confirmed) Impact: panic Confidence: likely
Verdict
Source-confirmed: ar5416IQCalibration (:95-101) iCoffDenom=(powerMeasI/2+powerMeasQ/2)/128 is zero when sum<256; only powerMeasQ!=0 checked; division by iCoffDenom at :100; WiFi-HW-gated
Fix Status
Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)
Source File
sys/dev/netif/ath/ath_hal/ar5416/ar5416_cal_iq.c
Fix Validation
All 87 fix.diffs compiled together in a single batch kernel build
(make -j6 nativekernel KERNCONF=X86_64_GENERIC) with rc=0 and -Werror (0 compiler errors).
The combined patch is at findings/poc/batch_build/all_fixes.patch.
Fix verification
fixedbatch build rc=0
batch build rc=0
Confirmed kernel references
β
Detail
Exploit chain
none
Evidence (decisive lines)
ar5416IQCalibration div0; WiFi-gated
Verified recommended fix
ar5416IQCalibration div0; WiFi-gated
Verdict
ar5416IQCalibration div0; WiFi-gated
No comments yet.