sys_mlockall done block unconditionally unwires, making MCL_CURRENT a silent no-op and undoing prior mlock() wiring
Summary
do{...}while(0) at :1064-1089 has no break on success -> falls through to done: label at :1091. done block RB_FOREACH unwires ALL MAP_ENTRY_USER_WIRED entries with no rc check. (1) Every page mlockall(MCL_CURRENT) just wired is immediately unwired -> silent no-op returns 0. (2) ALSO unwires entries from prior mlock() calls (USER_WIRED flag matches). mlockall(MCL_FUTURE) works (sets flag only). Root process believes secrets locked in RAM when they are not -> swapout under pressure -> disk-theft/key-recovery. Additionally: failure path leaks wired_count on the entry where vm_fault_wire failed (USER_WIRED set only AFTER success at :1084, so done block skips it).
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0950 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix for the cited path | 641 B | view raw |
| VERDICT.md | verdict | source-confirmation narrative | 983 B | β raw |
DF-0950 source-confirmation
Verdict: REPRODUCED (source-confirmed)
Impact: dos Confidence: certain
Kernel ref: sys/vm/vm_mmap.c:1089
Mechanism
mlockall(MCL_CURRENT) do/while falls through to done: unwires everything -> silent no-op
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
- m
- /
- v
- m
- _
- m
- m
- a
- p
- .
- c
- :
- 1
- 0
- 8
- 9
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: mlockall(MCL_CURRENT) do/while falls through to done: unwires everything -> silent no-op @ sys/vm/vm_mmap.c:1089. 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-0950/.
Verified recommended fix
only unwind USER_WIRED entries on failure; a successful MCL_CURRENT keeps pages wired. matches finding proposal. Full diff in findings/poc/DF-0950/fix.diff.
Verdict
REPRODUCED (source-confirmed). Source-trace confirmed mlockall(MCL_CURRENT) do/while falls through to done: unwires everything -> silent no-op at sys/vm/vm_mmap.c:1089 against the audited sys/ tree; exact line/condition verified.
No comments yet.