dirfs_fsync returns 0 unconditionally β host fsync() failures are swallowed (and the double-fsync retry stores -1, not errno)
Summary
dirfs_fsync computes 'if (fsync(dnp->dn_fd) == -1) error = fsync(dnp->dn_fd);' (:588-591 - a literal double call; on failure error holds -1, not errno) and then 'return 0;' (:595), discarding the result. POSIX fsync() must report I/O errors; databases and durability-sensitive tools silently believe data is durable. Code-certain contract breach; trigger needs a failing host fsync. Fix: error = errno once + return error. [VERIFIED pass2: dead code in-tree - no Makefile not in conf files kldload fails mount refuses real kernels; return-0 fsync breach code-certain]
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-3058 Β· 7 files| File | Type | Description | Size | |
|---|---|---|---|---|
| README.md | β | 284 B | β raw | |
| VERDICT.md | β | 1.1 KB | β raw | |
| env.txt | β | 248 B | view raw | |
| fix.diff | β | 125 B | view raw | |
| manifest.json | β | 591 B | view raw | |
| run.log | β | 197 B | view raw | |
| verdict.json | β | 1.3 KB | view raw |
DF-3058 - dirfs_fsync returns 0 unconditionally (double-fsync retry stores -1)
Severity Low | verdict: not_reproduced | impact: none
Reproduce
No runnable PoC on this rig (see VERDICT.md for why).
See VERDICT.md for the full narrative and run.log for the decisive output.
DF-3058 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
Not executable on this rig: dirfs is dead code in the current tree - sys/vfs/dirfs/ has no Makefile, is not referenced by sys/conf/files, is in no kernel config, and kldload dirfs fails (module not built). mount_dirfs additionally refuses to run on non-vkernel platforms (sbin/mount_dirfs/mount_dirfs.c:105). The contract breach is code-certain from source: dirfs_vnops.c:588-595 computes error = fsync(dnp->dn_fd) twice (second call on failure stores -1, not errno) and then returns 0 unconditionally.
Kernel references
Fix
See fix.diff.
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 + run.log + sources
PoC changes
none
Verified recommended fix
diff: error = fsync(dnp->dn_fd); if (error) error = errno; ... return error (drop the second fsync call and the forced 0).
Verdict
Not executable on this rig: dirfs is dead code in the current tree - sys/vfs/dirfs/ has no Makefile, is not referenced by sys/conf/files, is in no kernel config, and kldload dirfs fails (module not built). mount_dirfs additionally refuses to run on non-vkernel platforms (sbin/mount_dirfs/mount_dirfs.c:105). The contract breach is code-certain from source: dirfs_vnops.c:588-595 computes error = fsync(dnp->dn_fd) twice (second call on failure stores -1, not errno) and then returns 0 unconditionally.
No comments yet.