β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-5671

Stale MP-safety comment asserts a locked OR where code emits a nonlocked OR β€” safety of gd_spending pend path rests on an unstated, unenforced per-CPU invariant

Summary

The DO_SETBITS header claims 'setbits uses a locked or, making simple cases MP safe' but the macro emits atomic_set_int_nonlocked - a plain orl documented as local-interrupt-safe only, NOT MP-safe. Safe today solely because gd_spending/gd_sdelayed are written only by the owning vCPU's host thread and every live caller is same-cpu (verified; cothreads poison %gs and are barred from vkernel calls; the only cross-cpu-capable setsoftvm caller is #ifdef notyet). The comment inverts the invariant, inviting a future cross-CPU caller to silently lose pend bits (lost setsoftvm = stuck DMA map callback; lost setsofttty = dropped tty flush) - device-level hangs that are very hard to diagnose. Same textual divergence on the pc64 twin. State-the-real-invariant fix. Full interleave enumeration of the bit-then-flag deferral vs machintr's clear-then-drain proven LOSS-FREE under x86-TSO (the DF-5611 concern does not transfer).

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-5671 Β· 1 files
FileTypeDescriptionSize
verdict.json file 1.1 KB view raw

Fix verification

not_testable
baseline no→ patch + rebuild →patched clean
per-fix-DF-5671

Confirmed kernel references

Detail

Evidence (decisive lines)

static: ipl_funcs.c:45 comment vs :52 atomic_set_int_nonlocked; atomic.h:72-74 local-interrupt-safe-only doc; caller census verified

Verified recommended fix

state the per-CPU invariant in the comment (or use the locked form)

Verdict

untested (Info documentation finding; the nonlocked OR cannot be shown unsafe on this tree - no cross-CPU writer exists)