vn_stat's MNT_NOSYMFOLLOW symlink-mode adjustment is dead code and reads sb->st_mode before it is ever initialized
| Field | Value |
|---|---|
| ID | DF-2757 |
| Status | new |
| Severity | Info |
| CVSS 3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:N |
| CWE | CWE-456 / CWE-670 |
| File | sys/kern/vfs_vnops.c |
| Lines | 882-886 (publication :897) |
| Area | kern |
| Confidence | certain |
| Discovered | 2026-08-30 |
| Pass | 2 (GLM 5.3 second pass) |
| Bucket | base:kern |
| Reported | pending |
| Known CVE | none |
| CVE match | novel |
Summary
In vn_stat's VLNK case the code does sb->st_mode &= ~ACCESSPERMS /
sb->st_mode |= ACCESSPERMS β reading sb->st_mode before any
assignment (the only write is the unconditional sb->st_mode = mode;
after the switch). The uninitialized-stack read is computed-then-
discarded so nothing leaks, but the intended 0777/0000 cosmetic for
symlinks never takes effect: every symlink stat reports the inode's
raw va_mode regardless of MNT_NOSYMFOLLOW.
Recommended fix
Apply the adjustment to mode before publication (or drop the dead
branches).
Timeline
- 2026-08-30 Discovered during pass-2 audit of vfs_vnops.c (GLM 5.3).
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2757 Β· 8 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | β | 1.4 KB | β raw | |
| README.md | β | 227 B | β raw | |
| build.sh | β | 85 B | view raw | |
| run.sh | β | 49 B | view raw | |
| env.txt | β | 314 B | view raw | |
| manifest.json | β | 623 B | view raw | |
| verdict.json | β | 2.0 KB | view raw | |
| fix.diff | β | 420 B | view raw |
DF-2757 evidence pack
- finding: sys/kern/vfs_vnops.c (882-897)
- verdict: reproduced (certain) - see VERDICT.md
- source-only confirmation (no runtime PoC)
- reproduce: build.sh / run.sh
- fix.diff: present, git-apply-able
DF-2757 - Verification Verdict
Status: reproduced Impact: none (hardening) Confidence: certain
Mechanism
In vn_stat the VLNK case adjusts sb->st_mode (|= or &= ~ ACCESSPERMS) BEFORE sb->st_mode is ever assigned - the final sb->st_mode = mode (897) then overwrites the adjustment, so (a) the NOSYMFOLLOW cosmetic mode is dead code that never takes effect and (b) the adjustment reads sb->st_mode while it is still an uninitialized stack value.
Verdict
source-confirmed (no runtime PoC; deterministic code trace of the cited path:line in the read-only sys/ tree). Code-certain dead-store + uninit-read pattern (the uninit value is discarded, so no disclosure). fix.diff adjusts the local mode variable instead, making the intended symlink-mode cosmetic behavior actually work.
Threat / reachability
Latent code defect; see VERDICT.md.
Privilege escalation assessment
n/a (hardening)
Fix
Adjust mode (the local) instead of sb->st_mode in the VLNK case.
Kernel references
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_testablefix.diff compile-validated in the batch combined kernel build (all 37 diffs of this batch applied to in-guest /usr/src; make -j6 nativekernel KERNCONF=X86_64_GENERIC, see batch build log referenced in VERDICT.md); no behavior A/B performed for this Info-tier item; behavior A/B intentionally skipped for Info tier
batch combined kernel build log (see findings/poc/_batch41 note in VERDICT.md)
Confirmed kernel references
Detail
Exploit chain
no escalation path (Info-tier hardening; see VERDICT.md)
Evidence (decisive lines)
VERDICT.md mechanism/verdict sections; fix.diff
PoC changes
none (source-only confirmation for this Info-tier item)
Verified recommended fix
Adjust mode (the local) instead of sb->st_mode in the VLNK case.
Verdict
source-confirmed (no runtime PoC; deterministic code trace of the cited path:line in the read-only sys/ tree). Code-certain dead-store + uninit-read pattern (the uninit value is discarded, so no disclosure). fix.diff adjusts the local mode variable instead, making the intended symlink-mode cosmetic behavior actually work.
No comments yet.