CVE
CVE-2023-52707
CNA description
In the Linux kernel, the following vulnerability has been resolved: sched/psi: Fix use-after-free in ep_remove_wait_queue() If a non-root cgroup gets removed when there is a thread that registered trigger and is polling on a pressure file within the cgroup, the polling waitqueue gets freed in the following path: do_rmdir cgroup_rmdir kernfs_drain_open_files cgroup_file_release cgroup_pressure_release psi_trigger_destroy However, the polling thread still has a reference to the pressure file and will access the freed waitqueue when the file is closed or upon exit: fput ep_eventpoll_release ep_free ep_remove_wait_queue remove_wait_queue This results in use-after-free as pasted below. The fundamental problem here is that cgroup_file_release() (and consequently waitqueue's lifetime) is not tied to the file's real lifetime. Using wake_up_pollfree() here might be less than ideal, but it is in line with the comment at commit 42288cb44c4b ("wait: add wake_up_pollfree()") since the waitqueue's lifetime is not tied to file's one and can be considered as another special case. While this would be fixable by somehow making cgroup_file_release() be tied to the fput(), it would require sizable refactoring at cgroups or higher layer which might be more justifiable if we identify more cases like this. BUG: KASAN: use-after-free in _raw_spin_lock_irqsave+0x60/0xc0 Write of size 4 at addr ffff88810e625328 by task a.out/4404 CPU: 19 PID: 4404 Comm: a.out Not tainted 6.2.0-rc6 #38 Hardware name: Amazon EC2 c5a.8xlarge/, BIOS 1.0 10/16/2017 Call…
Affected versions
All Linux kernel vulnerabilities →
- 6.2-rc8This version only
- 6.2-rc7This version only
- 6.2-rc6This version only
- 6.2-rc5This version only
- 6.2-rc4This version only
- 6.2-rc3This version only
- 6.2-rc2This version only
- 6.2-rc1This version only
- ≥ 5.16, < 6.1.13Fixed in 6.1.13
- ≥ 5.11, < 5.15.95Fixed in 5.15.95
- ≥ 5.5, < 5.10.169Fixed in 5.10.169
- ≥ 5.2, < 5.4.232Fixed in 5.4.232
Distribution packages (Debian, Ubuntu, Red Hat…) backport fixes without changing the upstream version: check your distribution’s advisory as well.
Advisories and patches
- git.kernel.org/stable/c/7caeb5457bd01ccba0df1d6f4872f20d28e50b38 · Patch
- git.kernel.org/stable/c/c2dbe32d5db5c4ead121cf86dabd5ab691fb47fe · Patch
- git.kernel.org/stable/c/c6879a4dcefe92d870ab68cabaa9caeda4f2af5a · Patch
- git.kernel.org/stable/c/cca2b3feb70170ef6f0fbc4b4d91eea235a2b73a · Patch
- git.kernel.org/stable/c/ec9c7aa08819f976b2492fa63c41b5712d2924b5 · Patch
Data: NVD (public domain), CISA KEV (CC0), FIRST EPSS, OSV.dev / GitHub Advisory Database (CC-BY 4.0) · This database lists affected versions and fixes only. It never hosts or links exploit code.