net: shaper: rework the VALID marking (again)
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
6.18.347.0.117.1In the Linux kernel, the following vulnerability has been resolved:
net: shaper: rework the VALID marking (again)
Recent commit changed the semantics from NOT_VALID to VALID. I didn't realize that the flags are not stored atomically with the entry in XArray. There's still a race of reader observing a VALID mark for a slot, getting interrupted, writer replacing the entry with a different one, reader continuing, fetching the entry which is now a different pointer than the pointer for which VALID was meant.
The biggest consequence of this is that we may see a UAF since net_shaper_rollback() assumed that entries without VALID can be freed without observing RCU.
Looks like the XArray marks are buying us nothing at this point. Let's convert the code to an explicit valid field. The smp_load_acquire() / smp_store_release() barriers are marginally cleaner.
From the CVE record · Linux
The Linux kernel net shaper has a race between a reader and a writer replacing an entry. Under that concurrent access, the reader may observe an invalid entry, potentially causing a use-after-free. The input does not specify an attack path, authentication requirements, or user interaction.
Anyone running a Linux kernel with the affected net shaper code should check their version; affected versions are not specified.