flush_group refcount asymmetry: critical-error unmount decrements flg->refs for inodes that never incremented it
Summary
In this tree flg->refs counts records only (increments hammer_inode.c:2057/2311/2391/2408, decrements hammer_object.c:322 + hammer_inode.c:1575); inodes do not take a reference and hammer_sync_inode_done removes without decrement. However hammer_destroy_inode_callback (hammer_inode.c:1594-1598 - the HAMMER_MOUNT_CRITICAL_ERROR unmount path from hammer_vfsops.c:826-831) executes '--ip->flush_group->refs' for every inode in HAMMER_FST_FLUSH - an unmatched decrement that drives refs negative and triggers the spurious 'Warning, flush_group %p was not empty on umount!' in hammer_free_hmp. The master's KKASSERT(flg->refs == 0) at :423 is unreachable on this path; impact is warning noise and a latent assertion hazard. Teardown-only (requires prior critical I/O error); no attacker-controlled memory effect. Fix: drop the unmatched decrement (or port upstream's unified accounting). [VERIFIED pass2: teardown-only accounting defect certain by inspection; fix compile-validated]
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-3119 Β· 10 files| File | Type | Description | Size | |
|---|---|---|---|---|
| README.md | β | 365 B | β raw | |
| fix.diff | β | 363 B | view raw | |
| README.md | β | 365 B | β raw | |
| VERDICT.md | β | 1.6 KB | β raw | |
| build.sh | β | 106 B | view raw | |
| run.sh | β | 88 B | view raw | |
| manifest.json | β | 460 B | view raw | |
| verdict.json | β | 1.4 KB | view raw | |
| fix.diff | β | 363 B | view raw | |
| env.txt | β | 272 B | view raw |
DF-3119 -- verification pack
Finding: flush_group refcount asymmetry at critical-error unmount
Status: not_reproduced / impact corruption / confidence certain
What was run
n/a
How to reproduce
n/a
Expected
n/a
See VERDICT.md for the full narrative and verdict.json for the persisted machine verdict. Artifacts: README.md, fix.diff.
DF-3119 -- verification pack
Finding: flush_group refcount asymmetry at critical-error unmount
Status: not_reproduced / impact corruption / confidence certain
What was run
n/a
How to reproduce
n/a
Expected
n/a
See VERDICT.md for the full narrative and verdict.json for the persisted machine verdict. Artifacts: README.md, fix.diff.
DF-3119 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
Code-proven teardown accounting defect, not dynamically triggerable without first forcing a HAMMER_MOUNT_CRITICAL_ERROR unmount (requires induced media I/O failure). In this tree flg->refs counts records only (increments hammer_inode.c:2057/2311/2391/2408, decrements hammer_object.c:322 + hammer_inode.c:1575) while inodes never take a reference, yet hammer_destroy_inode_callback executes a --ip->flush_group->refs for every HAMMER_FST_FLUSH inode at critical-error unmount, driving refs negative and printing the spurious flush_group was not empty warning in hammer_free_hmp. Fix drops the unmatched decrement; compile-validated.
Kernel references
Exploit chain
(none: availability/correctness finding; no privilege chain)
Fix
drop the unmatched decrement
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
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)
README.md (original filing analysis, carried forward), VERDICT.md accounting walk with all increment/decrement sites, fix.diff
Verified recommended fix
drop the unmatched decrement
Verdict
Code-proven teardown accounting defect, not dynamically triggerable without first forcing a HAMMER_MOUNT_CRITICAL_ERROR unmount (requires induced media I/O failure). In this tree flg->refs counts records only (increments hammer_inode.c:2057/2311/2391/2408, decrements hammer_object.c:322 + hammer_inode.c:1575) while inodes never take a reference, yet hammer_destroy_inode_callback executes a --ip->flush_group->refs for every HAMMER_FST_FLUSH inode at critical-error unmount, driving refs negative and printing the spurious flush_group was not empty warning in hammer_free_hmp. Fix drops the unmatched decrement; compile-validated.
No comments yet.