ipc/shm: serialize orphan cleanup with shm_nattch updates
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 4c677e2eefdba9c5bfc4474e2e91b26ae8458a1d · < db752ebfdaf2c7f27cd9690ef48b616af068319c| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
ipc/shm: serialize orphan cleanup with shm_nattch updates
shm_destroy_orphaned() walks the shm idr under shm_ids(ns).rwsem, but that does not serialize all fields tested by shm_may_destroy(). In particular, shm_nattch is updated while holding shm_perm.lock, and attach paths can do that without holding the rwsem.
Do not decide that an orphaned segment is unused before taking the object lock. Move the shm_may_destroy() check under shm_perm.lock, matching the other destroy paths, and unlock the segment when it no longer qualifies for removal.
From the CVE record · Linux
The Linux kernel’s orphaned shared-memory cleanup can check whether a segment is unused without holding the lock that protects its attachment count. Concurrent attachment updates can therefore cause an orphaned segment to be removed when it should not be. The input does not specify an attacker path or whether network access, authentication, or user interaction is required.
Engineers running the Linux kernel should check their versions; affected versions are not specified.