Transaction starters ignore hammer_get_root_volume failure β trans->rootvol==NULL flows into ~25 ondisk derefs and hammer_rel_volume(NULL): kernel NULL-deref panic when root-volume-header reload I/O fails (KKASSERT is the only guard)
Summary
All three transaction starters call hammer_get_root_volume() and handle failure only with KKASSERT(error == 0) (:54,:79,:109). The mount does NOT hold a permanent rootvol reference (released at hammer_vfsops.c:773), so between transactions the refcount cycles to zero, hammer_rel_volume() sets volume->ondisk = NULL and releases the buffer, and the next transaction reloads the header via bread(), which CAN fail on real media/device errors. On a no-INVARIANTS production build the KKASSERT is a no-op: the starter returns with trans->rootvol == NULL, immediately dereferenced at ~25 sinks (trans->rootvol->ondisk->vol0_next_tid at hammer_object.c:2382/2563, vol0_stat_inodes, undomap at hammer_undo.c:486, volume stats, fsid, and at teardown hammer_rel_volume(trans->rootvol,0) -> hammer_rel_interlock). On stock INVARIANTS kernels the KKASSERT fires instead - still a panic, earlier and with a message. Impact ceiling: local DoS/panic requiring a device I/O error precisely in the header-reload window (failing/removable media); not attacker-controllable on healthy hardware. Phase V skipped (Low, hardware-triggered). Same unchecked-get-failure family as DF-0792 but distinct function/file/path. Fix: explicit hpanic on NULL (all builds) or convert the API to return the error for graceful EIO. [VERIFIED pass2: needs device IO failure in header-reload window; KKASSERT-only handling line-certain; fix compile-validated]
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-3231 Β· 9 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | β | 1.1 KB | view raw | |
| README.md | β | 427 B | β raw | |
| VERDICT.md | β | 1.8 KB | β raw | |
| build.sh | β | 106 B | view raw | |
| run.sh | β | 144 B | view raw | |
| manifest.json | β | 547 B | view raw | |
| verdict.json | β | 1.5 KB | view raw | |
| fix.diff | β | 1.1 KB | view raw | |
| env.txt | β | 272 B | view raw |
DF-3231 -- verification pack
Finding: transaction starters ignore hammer_get_root_volume failure (KKASSERT-only)
Status: not_reproduced / impact panic / confidence likely
What was run
n/a
How to reproduce
n/a (needs induced device I/O error in the header-reload window)
Expected
n/a
See VERDICT.md for the full narrative and verdict.json for the persisted machine verdict. Artifacts: fix.diff.
DF-3231 verification
Kernel: DragonFly dfbsd 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64
Bottom line
Not dynamically triggerable without a device I/O failure in the root-volume-header reload window: the mount holds no permanent rootvol reference, so between transactions the refcount cycles to zero, hammer_rel_volume clears ondisk, and the next transaction starter reloads the header with bread - which fails only on failing/removable media. All three starters handle that failure solely with KKASSERT(error == 0) (no-op on production builds), after which trans->rootvol NULL flows into ~25 deref sinks (vol0_next_tid, undomap, volume stats, fsid, hammer_rel_volume). Fault injection is unavailable on this guest. Fix converts the three assertions into explicit panics with a message on all builds; compile-validated.
Kernel references
- sys/vfs/hammer/hammer_transaction.c:53
- sys/vfs/hammer/hammer_transaction.c:79
- sys/vfs/hammer/hammer_transaction.c:109
Exploit chain
(none: availability/correctness finding; no privilege chain)
Fix
explicit panic on root-volume reload failure on all builds
See fix.diff in this directory (git-apply-able against the read-only sys/ tree; applied only inside the disposable verification guest).
Reproduction
build: n/a
run: n/a (needs induced device I/O error in the header-reload window)
expected: n/a
Notes on the PoC (what changed vs the finding sketch)
(none)
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_testableConfirmed kernel references
Detail
Evidence (decisive lines)
VERDICT.md walk over hammer_transaction.c:53/:79/:109 and the release-at-zero path from hammer_vfsops.c:773
Verified recommended fix
explicit panic on root-volume reload failure on all builds
Verdict
Not dynamically triggerable without a device I/O failure in the root-volume-header reload window: the mount holds no permanent rootvol reference, so between transactions the refcount cycles to zero, hammer_rel_volume clears ondisk, and the next transaction starter reloads the header with bread - which fails only on failing/removable media. All three starters handle that failure solely with KKASSERT(error == 0) (no-op on production builds), after which trans->rootvol NULL flows into ~25 deref sinks (vol0_next_tid, undomap, volume stats, fsid, hammer_rel_volume). Fault injection is unavailable on this guest. Fix converts the three assertions into explicit panics with a message on all builds; compile-validated.
No comments yet.