sys_varsym_set replace is a non-atomic remove-then-insert: concurrent same-name sets create duplicate shadowed varsym entries; invalid level values silently return success
| Field | Value |
|---|---|
| ID | DF-2909 |
| Status | new |
| Severity | Low |
| CVSS 3.1 | CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:N |
| CWE | CWE-367 / CWE-754 |
| File | sys/kern/kern_varsym.c |
| Lines | 152-175 (esp. :168-173) |
| Area | kern |
| 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
A 'set' operation is two independent lock cycles β varsymmake(level, name, NULL) to remove, then varsymmake(level, name, buf) to insert β with no atomicity between them. Two threads (or two processes sharing a USER-level set) setting the same name concurrently can both pass the remove step and both insert, leaving duplicate entries for one name in the TAILQ. Lookup/list return the first entry; each unset removes only one copy, so a duplicate survives as a shadowing 'zombie' value. Accounting stays symmetric, so NOT memory corruption. Separately, switch(level) has no default case, so level values outside 1..4 return 0 (success) while doing nothing β silent API misuse instead of EINVAL. Same-credential confusion only. Fix: atomic replace inside varsymmake (single lock cycle) + default: EINVAL.
Timeline
- 2026-09-02 Discovered during pass-2 audit of kern_varsym.c (GLM 5.3).
No comments yet.