CVE-2026-143092: xen/gntdev: fix deadlock between map ioctl and mmap
In the Linux kernel, the following vulnerability has been resolved:
xen/gntdev: fix deadlock between map ioctl and mmap
Commit 45ca1afe2fd1 ("xen/gntdev: fix error handling in ioctl") moved copytouser() in gntdevioctlmapgrantref() under priv->lock. A fault in copytouser() takes mmaplock, while gntdevmmap() is called with mmaplock held and takes priv->lock:
ioctl thread mmap thread mutexlock(&priv->lock) mmapwritelock(mm) gntdevmmap() mutexlock(&priv->lock) copytouser() faults mmapreadlock(mm)
Reproduced on Debian 6.12.111 in a Xen guest, with the ioctl argument on a MAPPRIVATE file page that has not been written yet. sysrq-w:
task:repro state:D stack:0 pid:4479 tgid:4477 ppid:1 flags:0x00000000 rwsemdownreadslowpath+0x25c/0x480 downreadkillable+0x48/0xc0 lockmmandfindvma+0x96/0x250 douseraddrfault+0x12d/0x620 excpagefault+0x7e/0x180 asmexcpagefault+0x26/0x30 copytouser+0x36/0x50 gntdevioctl+0x3b9/0xa00 [xengntdev] x64sysioctl+0x97/0xc0 task:repro state:D stack:0 pid:4480 tgid:4477 ppid:1 flags:0x00000000 mutexlock.constprop.0+0x41b/0x720 gntdevmmap+0x4d/0x330 [xengntdev] mmapregion+0x697/0xb10 mmapregion+0x78/0xa0 dommap+0x45d/0x630 vmmmappgoff+0xf8/0x1c0
Drop priv->lock before copytouser() again. On failure, re-take it and remove the map by index, as IOCTLGNTDEVUNMAPGRANTREF does, since another thread may have unmapped it meanwhile.
Affected Software
Event History
Frequently Asked Questions
Which systems are exposed to this deadlock?
The issue was reproduced in a Xen guest using the xen_gntdev driver. Systems that do not use the gntdev interface are not shown by the provided data to be exposed.
What conditions are required to trigger the problem?
A gntdev map ioctl must race with mmap activity so that the ioctl holds priv->lock while copy_to_user() faults and waits for mmap_lock, while mmap holds mmap_lock and waits for priv->lock. The reported reproduction used an ioctl argument located on a MAP_PRIVATE file-backed page that had not yet been written.
How can I recognize an affected system at runtime?
The symptom is tasks stuck in uninterruptible D state. Stack traces can show one task blocked in _copy_to_user() through gntdev_ioctl while waiting on mmap_lock, and another blocked in gntdev_mmap() while waiting on priv->lock.