vfs_register() walks sysctl__vfs_children without SYSCTL_XLOCK while unlinking/relinking the iterated oid mid-loop
| Field | Value |
|---|---|
| ID | DF-2919 |
| Status | new |
| Severity | Info |
| CVSS 3.1 | CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:N |
| CWE | CWE-667 Improper Locking |
| File | sys/kern/vfs_init.c |
| Lines | 338-343 |
| Area | kern/vfs |
| Confidence | certain |
| Discovered | 2026-09-02 |
| Pass | 2 (GLM 5.3 second pass) |
| Bucket | base:kern |
| Reported | pending |
| Known CVE | none |
| CVE match | novel |
Summary
The sysctl renumber loop iterates the parent oid list with a naked SLIST_FOREACH while the loop body calls sysctl_unregister_oid()/ sysctl_register_oid() (each taking SYSCTL_XLOCK internally) on the very node being iterated — the iterator's SLIST_NEXT is read from the re-linked node after sorted reinsertion, so entries between the old and new position are skipped; and the unlocked traversal races any concurrent module's sysctl registration under _vfs, allowing traversal onto a node whose owning module is being torn down (UAF read). Benign in practice today because oid names are unique (at most one match exists) and the concurrent actor must be a root-driven module load/unload; hardening-grade. Fix: hold SYSCTL_XLOCK across the whole traversal using the internal register/unregister variants.
Timeline
- 2026-09-02 Discovered during pass-2 audit of vfs_init.c (GLM 5.3).
No comments yet.