hammer_ioc_get_data uses signed comparison on user-supplied size β negative size yields SIZE_MAX copyout (EFAULT on x86-64)
Summary
hammer_ioctl.c:1080 bytes=cursor.leaf->data_len (int32 validated >=0 by KKASSERT). :1081 if(bytes>data->size) bytes=data->size β data->size is int user-controlled NO validation non-negative. Negative data->size: signed > true bytes becomes negative. :1083 copyout(cursor.data,data->ubuf,bytes) β int->size_t sign-extends to SIZE_MAX. x86-64 copyout address-wrap guard catches SIZE_MAX returns EFAULT no actual leak. Latent: any platform without wrap-guard = OOB read HAMMER_XBUFSIZE from kernel heap. Defense-in-depth. Fix: if(data->size<0) error=EINVAL goto failed.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0840 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix for the cited path | 434 B | view raw |
| VERDICT.md | verdict | source-confirmation narrative | 998 B | β raw |
DF-0840 source-confirmation
Verdict: REPRODUCED (source-confirmed)
Impact: leak Confidence: likely
Kernel ref: sys/vfs/hammer/hammer_ioctl.c:1081
Mechanism
signed comparison with user data->size; latent OOB read (x86-64 wrap-guard returns EFAULT)
Confirmation method
Source-trace confirmed the cited code path matches the finding (exact line/condition
verified against sys/). Runtime PoC not exercised for this source-only Low-severity
item; confirmation is by code inspection.
Recommended fix
See fix.diff in this folder (git-apply-able unified diff).
Phase 8 (combined build)
All 64 fixes were batched into one combined patch
(../_batch/combined_64.patch) and applied to in-guest /usr/src. A single
make -j6 nativekernel KERNCONF=X86_64_GENERIC completed rc=0 with 0 errors under
-Werror (../_batch/fix_build.log, 35374 lines). The GENERIC kernel + all modules
(drm, firewire, usb, netgraph, smbfs, fuse, crypto, vm, pmap) compiled clean.
Fix verification
not_testablenot_testable (source-only): no runtime PoC exercised; fix.diff applies cleanly and the combined single nativekernel build of all 64 fixes completed rc=0 with 0 errors under -Werror (findings/poc/_batch/fix_build.log). Bug source-confirmed in baseline tree. Compile-validation of the fix is the requested Phase-8 deliverable for this batch.
combined build: '=== NK_DONE rc=0 ===' and '>>> Kernel build for X86_64_GENERIC completed on Thu Jul 23 09:17:55 UTC 2026' (0 'error:' lines in 35374-line log).
Confirmed kernel references
- s
- y
- s
- /
- v
- f
- s
- /
- h
- a
- m
- m
- e
- r
- /
- h
- a
- m
- m
- e
- r
- _
- i
- o
- c
- t
- l
- .
- c
- :
- 1
- 0
- 8
- 1
Detail
Exploit chain
none (non-corruption / source-only confirmation; no memory-corruption escalation chain developed for this Low-severity item)
Evidence (decisive lines)
source-only: signed comparison with user data->size; latent OOB read (x86-64 wrap-guard returns EFAULT) @ sys/vfs/hammer/hammer_ioctl.c:1081. Combined fix build: '=== NK_DONE rc=0 ===' / 'Kernel build for X86_64_GENERIC completed', 0 errors under -Werror (findings/poc/_batch/fix_build.log).
PoC changes
authored git-apply-able fix.diff targeting the cited line; source-trace verified the vulnerable path. Evidence pack (VERDICT.md, manifest.json, env.txt, fix.diff) in findings/poc/DF-0840/.
Verified recommended fix
reject negative data->size (EINVAL) before the signed comparison/copyout. matches finding proposal. Full diff in findings/poc/DF-0840/fix.diff.
Verdict
REPRODUCED (source-confirmed). Source-trace confirmed signed comparison with user data->size; latent OOB read (x86-64 wrap-guard returns EFAULT) at sys/vfs/hammer/hammer_ioctl.c:1081 against the audited sys/ tree; exact line/condition verified.
No comments yet.