DF-0066
Undefined behavior: shift by sysctl-controlled token_window_shift in backoff spin
Summary
_lwkt_trytokref_spin (lwkt_token.c:400/:413): rdtsc()>>(int)token_window_shift; token_window_shift writable via SYSCTL_INT CTLFLAG_RW (:157-158). rdtsc returns tsc_uclock_t 64-bit unsigned. If root sets negative or >=64, shift is UB (C11 6.5.7). Impact: unpredictable backoff-window (scheduling fairness) only, NOT memory corruption/info leak. Root-only. Fix: clamp [0,63] or mask &63.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0066 Β· 1 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | Undefined behavior: shift by sysctl-controlled token_window_shift in backoff spi | 379 B | view raw |
Fix verification
fixedbaseline reproducedβ patch + rebuild βpatched clean
fix.diff applied + combined nativekernel build rc=0 (-Werror)
fix.diff applied + combined nativekernel build rc=0 (-Werror)
β fix.diffcombined build rc=0
Confirmed kernel references
β
Detail
Exploit chain
none (Info severity)
Evidence (decisive lines)
Source-confirmed at sys/kern/lwkt_token.c:398: UB shift by sysctl-controlled token_window_shift
Verified recommended fix
Source-confirmed at sys/kern/lwkt_token.c:398: UB shift by sysctl-controlled token_window_shift
Verdict
Source-confirmed at sys/kern/lwkt_token.c:398: UB shift by sysctl-controlled token_window_shift
No comments yet.