β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-3126

cd9660_vptofh truncates ino_t into int ifid_ino; cd9660_vget_internal's int lbn truncation makes the volume-space bounds check bypassable β€” NFS file-handle inode aliasing and negative-offset bread on crafted/large images

Summary

vptofh stores ip->i_number (ino_t, up to ~2^43 since isodirino = (extent+ext_attr)<<bshift) into int ifid_ino (:924); fhtovp passes it back sign-extended (:677). In vget_internal the int lbn = lblkno(imp, ino) (:774) truncates, so for ino >= 2^42 (extent 0x80000000 in a crafted image, or legitimate >4GB-path extents) lbn is negative and the guard 'lbn >= imp->volume_space_size' (:775) is skipped (signed compare against a negative value false). The subsequent bread at lblktooff(imp, lbn) < 0 is contained to EIO by the device strategy's dscheck bounds, so no corruption demonstrable; the observable defect is NFS file-handle aliasing (truncated handles resolve to the wrong vnode / ESTALE churn) on exports of such images. NFS-export-gated (cd9660 fhtovp is the only VFS_VGET caller). Not run (NFS-export setup root-gated; memory-safety ceiling traced to EIO). Fix: widen the guard arithmetic to off_t and reject ino >= volume_space_size<<bshift in vptofh. [VERIFIED pass2: NFS-export gated; memory-safety ceiling traced to EIO containment; fix compile-validated]

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-3126 Β· 9 files
FileTypeDescriptionSize
fix.diff β€” 542 B view raw
README.md β€” 408 B ↓ raw
VERDICT.md β€” 1.6 KB ↓ raw
build.sh β€” 106 B view raw
run.sh β€” 120 B view raw
manifest.json β€” 498 B view raw
verdict.json β€” 1.3 KB view raw
fix.diff β€” 542 B view raw
env.txt β€” 272 B view raw

DF-3126 -- verification pack

Finding: cd9660 vptofh int truncation and vget_internal int lbn guard bypass

Status: not_reproduced / impact denial_of_service / confidence likely

What was run

n/a

How to reproduce

n/a (requires NFS-exported cd9660 mount)

Expected

n/a

See VERDICT.md for the full narrative and verdict.json for the persisted machine verdict. Artifacts: fix.diff.

VERDICT.md
↓ download raw

DF-3126 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 exercised: cd9660_vptofh/vget reachability requires an NFS export of a cd9660 mount (VFS_VGET is called only from the NFS file-handle path) and the memory-safety ceiling is traced to EIO: for an ino above 2^42 the int lbn truncation makes the lbn >= volume_space_size guard pass on negative values, but the subsequent bread at the negative lblktooff offset is contained by the device strategy bounds check. The observable defect is NFS file-handle aliasing (truncated ifid_ino binds handles to the wrong vnode). Fix widens the guard to off_t and the compile-validated patch is included.

Kernel references

Exploit chain

(none: availability/correctness finding; no privilege chain)

Fix

off_t lbn guard + reject oversized ino

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 (requires NFS-exported cd9660 mount)

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_testable
↓ fix.diffper-fix-DF-3126

Confirmed kernel references

Detail

Evidence (decisive lines)

VERDICT.md line walk over vptofh (:924), fhtovp (:677) and vget_internal (:774-775)

Verified recommended fix

off_t lbn guard + reject oversized ino

Verdict

Not dynamically exercised: cd9660_vptofh/vget reachability requires an NFS export of a cd9660 mount (VFS_VGET is called only from the NFS file-handle path) and the memory-safety ceiling is traced to EIO: for an ino above 2^42 the int lbn truncation makes the lbn >= volume_space_size guard pass on negative values, but the subsequent bread at the negative lblktooff offset is contained by the device strategy bounds check. The observable defect is NFS file-handle aliasing (truncated ifid_ino binds handles to the wrong vnode). Fix widens the guard to off_t and the compile-validated patch is included.