{"id":"CVE-2025-38595","state":"PUBLISHED","title":"xen: fix UAF in dmabuf_exp_from_pages()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nxen: fix UAF in dmabuf_exp_from_pages()\n\n[dma_buf_fd() fixes; no preferences regarding the tree it goes through -\nup to xen folks]\n\nAs soon as we'd inserted a file reference into descriptor table, another\nthread could close it.  That's fine for the case when all we are doing is\nreturning that descriptor to userland (it's a race, but it's a userland\nrace and there's nothing the kernel can do about it).  However, if we\nfollow fd_install() with any kind of access to objects that would be\ndestroyed on close (be it the struct file itself or anything destroyed\nby its ->release()), we have a UAF.\n\ndma_buf_fd() is a combination of reserving a descriptor and fd_install().\ngntdev dmabuf_exp_from_pages() calls it and then proceeds to access the\nobjects destroyed on close - starting with gntdev_dmabuf itself.\n\nFix that by doing reserving descriptor before anything else and do\nfd_install() only when everything had been set up.","publishedAt":"2025-08-19T17:03:25.527Z","updatedAt":"2026-10-30T12:22:06.267Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"2be49867e68abbeb52d7f5d15eb1216154e2c0a0","versionType":"git"},{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"ba8bc644f168509c16d48444991de7cfea3f12ec","versionType":"git"},{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"e5907885260401bba300d4d18d79875c05b82651","versionType":"git"},{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"3edfd2353f301bfffd5ee41066e37320a59ccc2d","versionType":"git"},{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"d59d49af4aeed9a81e673e37c26c6a3bacf1a181","versionType":"git"},{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"532c8b51b3a8676cbf533a291f8156774f30ea87","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/xen/gntdev-dmabuf.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.19","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.19","versionType":"semver"},{"version":"6.1.191","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.160","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.42","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.10","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16.1","status":"unaffected","lessThanOrEqual":"6.16.*","versionType":"semver"},{"version":"6.17","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/xen/gntdev-dmabuf.c"]}],"references":["https://git.kernel.org/stable/c/2be49867e68abbeb52d7f5d15eb1216154e2c0a0","https://git.kernel.org/stable/c/ba8bc644f168509c16d48444991de7cfea3f12ec","https://git.kernel.org/stable/c/e5907885260401bba300d4d18d79875c05b82651","https://git.kernel.org/stable/c/3edfd2353f301bfffd5ee41066e37320a59ccc2d","https://git.kernel.org/stable/c/d59d49af4aeed9a81e673e37c26c6a3bacf1a181","https://git.kernel.org/stable/c/532c8b51b3a8676cbf533a291f8156774f30ea87"],"weaknesses":[],"ingestedAt":"2026-10-30T12:38:04.623Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38595.json","commit":"db8103c5921aac81d5d90efcf3745980dafabf49","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38595","state":"PUBLISHED","datePublished":"2025-08-19T17:03:25.527Z","dateUpdated":"2026-10-30T12:22:06.267Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:24.028Z"},"containers":{"cna":{"title":"xen: fix UAF in dmabuf_exp_from_pages()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nxen: fix UAF in dmabuf_exp_from_pages()\n\n[dma_buf_fd() fixes; no preferences regarding the tree it goes through -\nup to xen folks]\n\nAs soon as we'd inserted a file reference into descriptor table, another\nthread could close it.  That's fine for the case when all we are doing is\nreturning that descriptor to userland (it's a race, but it's a userland\nrace and there's nothing the kernel can do about it).  However, if we\nfollow fd_install() with any kind of access to objects that would be\ndestroyed on close (be it the struct file itself or anything destroyed\nby its ->release()), we have a UAF.\n\ndma_buf_fd() is a combination of reserving a descriptor and fd_install().\ngntdev dmabuf_exp_from_pages() calls it and then proceeds to access the\nobjects destroyed on close - starting with gntdev_dmabuf itself.\n\nFix that by doing reserving descriptor before anything else and do\nfd_install() only when everything had been set up."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"2be49867e68abbeb52d7f5d15eb1216154e2c0a0","versionType":"git"},{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"ba8bc644f168509c16d48444991de7cfea3f12ec","versionType":"git"},{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"e5907885260401bba300d4d18d79875c05b82651","versionType":"git"},{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"3edfd2353f301bfffd5ee41066e37320a59ccc2d","versionType":"git"},{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"d59d49af4aeed9a81e673e37c26c6a3bacf1a181","versionType":"git"},{"version":"a240d6e42e28c34fdc34b3a98ca838a31c939901","status":"affected","lessThan":"532c8b51b3a8676cbf533a291f8156774f30ea87","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/xen/gntdev-dmabuf.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.19","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.19","versionType":"semver"},{"version":"6.1.191","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.160","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.42","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.10","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16.1","status":"unaffected","lessThanOrEqual":"6.16.*","versionType":"semver"},{"version":"6.17","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/xen/gntdev-dmabuf.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/2be49867e68abbeb52d7f5d15eb1216154e2c0a0"},{"url":"https://git.kernel.org/stable/c/ba8bc644f168509c16d48444991de7cfea3f12ec"},{"url":"https://git.kernel.org/stable/c/e5907885260401bba300d4d18d79875c05b82651"},{"url":"https://git.kernel.org/stable/c/3edfd2353f301bfffd5ee41066e37320a59ccc2d"},{"url":"https://git.kernel.org/stable/c/d59d49af4aeed9a81e673e37c26c6a3bacf1a181"},{"url":"https://git.kernel.org/stable/c/532c8b51b3a8676cbf533a291f8156774f30ea87"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The vulnerability is reached through `IOCTL_GNTDEV_DMABUF_EXP_FROM_REFS` on the local `/dev/xen/gntdev` misc device, requiring local access to the machine (dom0 or a HVM/PVH guest). No network-facing path reaches `dmabuf_exp_from_pages()`.\nAC:L - The attacker controls both sides of the race — one thread issues the export ioctl while another closes the freshly installed fd, whose number is deterministic (lowest free descriptor) — and the window spans a sleepable `mutex_lock()`, making it wide; the ioctl can be retried indefinitely until it wins.\nPR:L - `gntdev_ioctl()` contains no `capable()` or `CAP_*` checks at all, so any user able to open `/dev/xen/gntdev` can trigger it; Xen stacks that use this exact dma-buf path (automotive display virtualization, Qubes vchan) grant unprivileged users access to that node.\nUI:N - Exploitation is entirely self-contained within the attacker's own multi-threaded process issuing an ioctl and a concurrent `close()`; no victim action is required.\nS:U - The freed objects (`struct gntdev_dmabuf`, the gntdev `struct file`) and the resulting corruption all live in the same kernel's memory as the attacker's own domain; nothing crosses the hypervisor or IOMMU boundary.\nC:H - `get_file(gntdev_dmabuf->priv->filp)` reads a pointer out of freed, attacker-groomable `kmalloc-96` memory, and `list_add()` writes kernel heap pointers into that freed slot which can be read back via a resprayed object, yielding kernel memory disclosure; the resulting `struct file` UAF permits arbitrary kernel read.\nI:H - The unmatched `fput()` on `priv->filp` underflows the gntdev file refcount and frees a `struct file` still referenced by an open fd, and the code writes into the freed `gntdev_dmabuf` (`->fd = ret`, `list_add`) — a classic UAF/DirtyCred-style write primitive leading to control-flow hijack and privilege escalation.\nA:H - Losing the race before `list_add()` makes `dmabuf_exp_release()` run `list_del()` on a zeroed `list_head`, causing a NULL-pointer write oops (or a corruption WARN plus heap/list corruption), and the general UAF and file refcount underflow readily panic the kernel."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-10-30T12:22:06.267Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.19","versionEndExcluding":"6.1.191"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.19","versionEndExcluding":"6.6.160"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.19","versionEndExcluding":"6.12.42"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.19","versionEndExcluding":"6.15.10"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.19","versionEndExcluding":"6.16.1"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.19","versionEndExcluding":"6.17"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}