CVE-2024-39486·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: drm/drm_file: Fix pid refcounting race <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de> filp->pid is supposed to be a refcounted pointer; however, before this patch, drm_file_update_pid() only increments the refcount of a struct pid after storing a pointer to it in filp->pid and dropping the dev->filelist_mutex, making the following race possible: process A process B ========= ========= begin drm_file_update_pid mutex_lock(&dev->filelist_mutex) rcu_replace_pointer(filp->pid, <pid B>, 1) mutex_unlock(&dev->filelist_mutex) begin drm_file_update_pid mutex_lock(&dev->filelist_mutex) rcu_replace_pointer(filp->pid, <pid A>, 1) mutex_unlock(&dev->filelist_mutex) get_pid(<pid A>) synchronize_rcu() put_pid(<pid B>) *** pid B reaches refcount 0 and is freed here *** get_pid(<pid B>) *** UAF *** synchronize_rcu() put_pid(<pid A>) As far as I know, this race can only occur with CONFIG_PREEMPT_RCU=y because it requires RCU to detect a quiescent state in code that is not explicitly calling into the scheduler. This race leads to use-after-free of a "struct pid". It is probably somewhat hard to hit because process A has to pass through a synchronize_rcu() operation while process B is between mutex_unlock() and get_pid(). Fix it by ensuring that by the time a pointer to the current task's pid is stored in the file, an extra reference to the pid has been taken. This fix also removes the condition for synchronize_rcu(); I think that optimization is unnecessary complexity, since in that case we would usually have bailed out on the lockless check above.
- Severity
- high
- Software
- Kernel
- Fixed in
- 6.9.8
- Published
- 2024-07-06
Affected versions
From: 6.7
Until: 6.9.8
Fixed in: 6.9.8
How to fix this CVE
Update your Linux kernel to version 6.9.8 or later to resolve a use-after-free race condition in the DRM file handling subsystem. This vulnerability affects systems with CONFIG_PREEMPT_RCU enabled and can lead to kernel memory corruption. Apply the patch immediately, especially for systems running graphical environments or GPU drivers that interact with the DRM subsystem.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Step 1: Check current kernel version with: uname -r
- Step 2: Verify if CONFIG_PREEMPT_RCU is enabled: grep CONFIG_PREEMPT_RCU /boot/config-$(uname -r) or cat /proc/config.gz | gunzip | grep CONFIG_PREEMPT_RCU
- Step 3: Look for UAF-related kernel panics in dmesg: dmesg | grep -i 'use-after-free\|uaf\|drm_file'
- Step 4: After patching, confirm kernel version is 6.9.8 or higher: uname -r | awk -F. '{print ($1 > 6 || ($1 == 6 && $2 > 9) || ($1 == 6 && $2 == 9 && $3 >= 8)) ? "PATCHED" : "VULNERABLE"}'
FAQ
What is CVE-2024-39486?
This vulnerability is a race condition in the Linux kernel's DRM (Direct Rendering Manager) file handling code that can lead to use-after-free of process ID structures. The flaw exists in the drm_file_update_pid() function where concurrent processes can trigger premature deallocation of pid references.
Is CVE-2024-39486 being actively exploited?
No, there is no evidence of active exploitation in the wild, and no public exploits are available. However, the vulnerability is real and can cause kernel instability on affected systems.
What versions of Kernel are affected by CVE-2024-39486?
Linux kernel versions 6.7 through 6.9.8 are affected. The vulnerability was resolved in kernel 6.9.8 and later stable releases.
How do I check if my server is vulnerable to CVE-2024-39486?
Run 'uname -r' to get your kernel version. If it is between 6.7 and 6.9.7 (inclusive), you are vulnerable. Additionally, confirm CONFIG_PREEMPT_RCU is enabled with 'grep CONFIG_PREEMPT_RCU /boot/config-$(uname -r)'.
Does Defensia detect CVE-2024-39486?
Yes — Defensia's CVE advisory scanner compares installed kernel package versions against the NVD database. If the Linux kernel is installed on a monitored server running an affected version, CVE-2024-39486 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- https://git.kernel.org/stable/c/0acce2a5c619ef1abdee783d7fea5eac78ce4844
- https://git.kernel.org/stable/c/16682588ead4a593cf1aebb33b36df4d1e9e4ffa
- https://git.kernel.org/stable/c/4f2a129b33a2054e62273edd5a051c34c08d96e9
- https://git.kernel.org/stable/c/0acce2a5c619ef1abdee783d7fea5eac78ce4844
- https://git.kernel.org/stable/c/16682588ead4a593cf1aebb33b36df4d1e9e4ffa
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2024-39486. Free for 1 server.
Get started free