hammer_ioc_set_pseudofs clobbers hammer_load_pseudofs's error with copyin's result β every load failure (not just the intended ENOENT) is silently ignored and the PFS is created/saved anyway
Summary
hammer_pfs.c:117-118: 'pfsm = hammer_load_pseudofs(trans, localization, &error); error = copyin(...)'. The comment says only ENOENT should be ignored (PFS-creation semantics on a fresh template), but the unconditional assignment discards ANY load error - EIO from media failure, the DF-3109 init_cursor failure inside load, EDEADLK - after which hammer_mkroot_pseudofs and hammer_save_pseudofs still run against the zeroed template. Result: PFS root inodes/config records can be created from a failed load, papering over DF-3109's broken cursor contract at exactly this call site and persisting possibly-inconsistent PFS state to media. Privileged ioctl; data-integrity/robustness on I/O error paths, not a boundary violation. Fix: 'if (error == ENOENT) error = 0;' before the copyin. [VERIFIED pass2: needs induced load failure mid-ioctl; error-clobber line-certain; fix compile-validated]
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-3189 Β· 9 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | β | 457 B | view raw | |
| README.md | β | 360 B | β raw | |
| VERDICT.md | β | 1.5 KB | β raw | |
| build.sh | β | 106 B | view raw | |
| run.sh | β | 88 B | view raw | |
| manifest.json | β | 400 B | view raw | |
| verdict.json | β | 1.2 KB | view raw | |
| fix.diff | β | 457 B | view raw | |
| env.txt | β | 272 B | view raw |
DF-3189 -- verification pack
Finding: hammer_ioc_set_pseudofs clobbers load error with copyin result
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: fix.diff.
DF-3189 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-certain: hammer_ioc_set_pseudofs loads the PFS with hammer_load_pseudofs and then unconditionally overwrites error with the copyin result, discarding every load failure (EIO from media failure, the DF-3109 cursor-init failure, EDEADLK) although the comment promises only ENOENT is ignored; hammer_mkroot_pseudofs and hammer_save_pseudofs then run against the zeroed template and can persist PFS state derived from a failed load. Dynamic triggering requires inducing a load failure mid-ioctl (degraded media), unavailable on this guest. Fix keeps only the intended ENOENT exemption; compile-validated.
Kernel references
Exploit chain
(none: availability/correctness finding; no privilege chain)
Fix
if (error == ENOENT) error = 0 before the copyin
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)
VERDICT.md walk over hammer_pfs.c:112-130
Verified recommended fix
if (error == ENOENT) error = 0 before the copyin
Verdict
Code-certain: hammer_ioc_set_pseudofs loads the PFS with hammer_load_pseudofs and then unconditionally overwrites error with the copyin result, discarding every load failure (EIO from media failure, the DF-3109 cursor-init failure, EDEADLK) although the comment promises only ENOENT is ignored; hammer_mkroot_pseudofs and hammer_save_pseudofs then run against the zeroed template and can persist PFS state derived from a failed load. Dynamic triggering requires inducing a load failure mid-ioctl (degraded media), unavailable on this guest. Fix keeps only the intended ENOENT exemption; compile-validated.
No comments yet.