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

b_cmd=READ guard tests m.flags for XFR_BAD_SUBDISK (never set there) - condition always true, intended bad-subdisk exclusion dead

Summary

XFR_BAD_SUBDISK is only ever set on rqe->flags, so the guard on m.flags is always true and the bad subdisk's rqe also gets READ - against the comment's intent. No current runtime effect (bad rqes never launched) but a latent hazard exactly on the launch-path machinery where DF-4721 lives. Test-rqe->flags one-token fix.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-4716 Β· 3 files
FileTypeDescriptionSize
README.md β€” 963 B ↓ raw
fix.diff β€” 552 B view raw
verdict.json β€” 1.1 KB view raw

DF-4716 β€” vinumraid5: b_cmd=READ condition tests m.flags for XFR_BAD_SUBDISK (never set there) β€” always true, intended "not the bad subdisk" check dead

sys/dev/raid/vinum/vinumraid5.c:536-538:

if ((m.flags & XFR_PARITYOP)            /* parity operation, */
&&((m.flags & XFR_BAD_SUBDISK) == 0))       /* and not the bad subdisk, */
    rqe->b.b_cmd = BUF_CMD_READ;        /* we must read first */

XFR_BAD_SUBDISK is only ever set on rqe->flags (line 523), never on m.flags, so the second clause is always true and the bad subdisk's rqe also gets b_cmd = BUF_CMD_READ. The comment makes the intent unambiguous: the check should test rqe->flags.

Current effect: none β€” XFR_BAD_SUBDISK rqes are never launched (vinumrequest.c:410) and completion filters re-check the flags β€” so this is filed as Info (latent correctness hazard guarding the DF-4721-class launch paths). fix.diff corrects the operand. Not PoC-verified (no runtime observable).

Fix verification

not_testable
↓ fix.diffper-fix-DF-4716

Confirmed kernel references

Detail

Evidence (decisive lines)

source trace only: request.h:48 (XFR_BAD_SUBDISK set only via rqe->flags at vinumraid5.c:523), vinumrequest.c:410 (launch skip)

PoC changes

n/a (no seeded PoC; static finding)

Verified recommended fix

test rqe->flags instead of m.flags (fix.diff)

Verdict

wrong-operand condition (m.flags instead of rqe->flags) makes the 'not the bad subdisk' guard at vinumraid5.c:536-538 always true; dead-effect today because XFR_BAD_SUBDISK rqes are never launched, but it is the exact kind of stale guard that hides launch-path lifetime bugs (cf. DF-4721). Info-level hardening; fix.diff corrects the operand. Not PoC-verified: no runtime-observable effect.