objcache_destroy() purges remote CPUs' per-cpu magazines under only a local critical section β no cross-CPU exclusion (contract-reliant teardown; KKASSERT panic / magazine UAF if any in-flight get/put exists)
| Field | Value |
|---|---|
| ID | DF-2814 |
| Status | new |
| Severity | Low |
| CVSS 3.1 | CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:H |
| CWE | CWE-667 Improper Locking |
| File | sys/kern/kern_objcache.c |
| Lines | 929-939 (vs doc :96-97; mag_purge :780-788) |
| Area | kern |
| Confidence | speculative |
| Discovered | 2026-08-31 |
| Pass | 2 (GLM 5.3 second pass) |
| Bucket | base:kern |
| Reported | pending |
| Known CVE | none |
| CVE match | novel |
Summary
percpu_objcache is documented as "protected by crit_enter()" on ITS OWN cpu, yet objcache_destroy() iterates ALL cpus and calls mag_purge(freeit=TRUE) on each cpucache's magazines with only a crit_enter() on the DESTROYER's cpu β zero protection against a get/put in flight on the remote cpu. mag_purge's "mag ripped out" defense is neutralized for freeit=TRUE: the KKASSERT panics INVARIANTS kernels, and on stock kernels *magp=NULL + kfree(mag) leaves cpucache->previous_magazine pointing at freed memory β magazine UAF on the next get/put. In-tree destroy callers audited all quiesce via module refcounts/mount locks first β speculative/defense-in-depth; if any future caller races: panic or magazine UAF.
Recommended fix
Quiesce remote CPUs before purging their magazines (IPI-run the mag_purge pair on the owning cpu), or add an explicit per-cache dying flag checked under crit in get/put that diverts to the depot/free path once teardown begins.
Timeline
- 2026-08-31 Discovered during pass-2 audit of kern_objcache.c (GLM 5.3).
No comments yet.