DF-3004 / verdict.json
{ "finding_id": "DF-3004", "status": "reproduced", "reproduced": 1, "impact": "corruption", "confidence": "likely", "verdict": "Wrap reproduced and observable; the sync-panic sub-claim did NOT manifest in the canonical crafted case. Offline patch set the INODE records on-disk nlinks (hammer_inode_data+72) to 0 while the direntry still referenced it (CRC32C-verified matching, leaf data CRC + node CRC recomputed). On mount, stat exposed nlink=0 (no load-time validation); unlink decremented unconditionally (hammer_object.c:854) and fstat on a held fd showed nlink=4294967295 - the kernel-side UINT64_MAX wrap, userspace-visible, exactly the poisoned link count. However sync/synctid/umount completed WITHOUT the hammer_sync_inode KKASSERT((int64_t)nlinks >= 0) (hammer_inode.c:2980): analysis of the flush code shows the deleted-direntry dependency adjustment (++nlinks) re-wraps the count back to 0 before the assert comparison (sync_ino_data.nlinks == nlinks == 0), so the single-direntry crafted case does not panic; the assert would fire only for cross-flush-group record mixes. The 0-nlinks load and the unconditional wrap are the reproduced core. Fix (guarded decrement + underflow report) A/B validated on the fix-all kernel.", "exploit_chain": "crafted image: inode nlinks=0 + live direntry -> mount (root) -> open+unlink -> unconditional decrement wraps to UINT64_MAX -> fstat shows 4294967295 (userspace-visible poisoned link count)", "evidence": "df3004b_run.log: before unlink nlink=0; after unlink nlink=4294967295; after 3s flush pause nlink=4294967295; no panic; umount-ok", "kernel_refs": [ "sys/vfs/hammer/hammer_object.c:854", "sys/vfs/hammer/hammer_inode.c:2980" ], "poc_changes": "panic sub-claim refuted for the canonical case with mechanism analysis; open-fd fstat used to observe the wrap", "attempts": 3, "guest_uname": "DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:04 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64", "runtime_sec": 600, "guest_dirty": 0, "build_cmd": "guest: newfs_hammer -f 12G image; host: python3 h1patch2.py IMG 3004 file_3004", "run_cmd": "vnconfig; mount_hammer; ./df3004b /mnt/h1t/d/file_3004; sync; umount", "code_hash": "cdb5649bb32188c07d78a1e98f0c5f5c011ca9bc017118a4ffbc7ed0bfb9549c", "notes": "crafted-image precondition; panic ceiling conditional on flush-group interleaving", "recommended_fix": "guard the decrement + validate nlinks != 0 at hammer_get_inode load", "fix_status": "fixed", "fix_verdict": "A/B on fix kernel #2: same crafted image; after unlink nlink stays 0 (stock: 4294967295 wrap) and HAMMER: nlinks underflow on obj ... is reported; sync+umount clean.", "fix_baseline_reproduced": 1, "fix_patched_reproduced": 0 } |