CVE-2022-50471
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
04/10/2025
Last modified:
23/01/2026
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
xen/gntdev: Accommodate VMA splitting<br />
<br />
Prior to this commit, the gntdev driver code did not handle the<br />
following scenario correctly with paravirtualized (PV) Xen domains:<br />
<br />
* User process sets up a gntdev mapping composed of two grant mappings<br />
(i.e., two pages shared by another Xen domain).<br />
* User process munmap()s one of the pages.<br />
* User process munmap()s the remaining page.<br />
* User process exits.<br />
<br />
In the scenario above, the user process would cause the kernel to log<br />
the following messages in dmesg for the first munmap(), and the second<br />
munmap() call would result in similar log messages:<br />
<br />
BUG: Bad page map in process doublemap.test pte:... pmd:...<br />
page:0000000057c97bff refcount:1 mapcount:-1 \<br />
mapping:0000000000000000 index:0x0 pfn:...<br />
...<br />
page dumped because: bad pte<br />
...<br />
file:gntdev fault:0x0 mmap:gntdev_mmap [xen_gntdev] readpage:0x0<br />
...<br />
Call Trace:<br />
<br />
dump_stack_lvl+0x46/0x5e<br />
print_bad_pte.cold+0x66/0xb6<br />
unmap_page_range+0x7e5/0xdc0<br />
unmap_vmas+0x78/0xf0<br />
unmap_region+0xa8/0x110<br />
__do_munmap+0x1ea/0x4e0<br />
__vm_munmap+0x75/0x120<br />
__x64_sys_munmap+0x28/0x40<br />
do_syscall_64+0x38/0x90<br />
entry_SYSCALL_64_after_hwframe+0x61/0xcb<br />
...<br />
<br />
For each munmap() call, the Xen hypervisor (if built with CONFIG_DEBUG)<br />
would print out the following and trigger a general protection fault in<br />
the affected Xen PV domain:<br />
<br />
(XEN) d0v... Attempt to implicitly unmap d0&#39;s grant PTE ...<br />
(XEN) d0v... Attempt to implicitly unmap d0&#39;s grant PTE ...<br />
<br />
As of this writing, gntdev_grant_map structure&#39;s vma field (referred to<br />
as map->vma below) is mainly used for checking the start and end<br />
addresses of mappings. However, with split VMAs, these may change, and<br />
there could be more than one VMA associated with a gntdev mapping.<br />
Hence, remove the use of map->vma and rely on map->pages_vm_start for<br />
the original start address and on (map->count live_grants atomic counter and/or the map->vma<br />
pointer (the latter of which is now removed). This prevents the<br />
userspace from mmap()&#39;ing (with MAP_FIXED) a gntdev mapping over the<br />
same address range as a previously set up gntdev mapping. This scenario<br />
can be summarized with the following call-trace, which was valid prior<br />
to this commit:<br />
<br />
mmap<br />
gntdev_mmap<br />
mmap (repeat mmap with MAP_FIXED over the same address range)<br />
gntdev_invalidate<br />
unmap_grant_pages (sets &#39;being_removed&#39; entries to true)<br />
gnttab_unmap_refs_async<br />
unmap_single_vma<br />
gntdev_mmap (maps the shared pages again)<br />
munmap<br />
gntdev_invalidate<br />
unmap_grant_pages<br />
(no-op because &#39;being_removed&#39; entries are true)<br />
unmap_single_vma (For PV domains, Xen reports that a granted page<br />
is being unmapped and triggers a general protection fault in the<br />
affected domain, if Xen was built with CONFIG_DEBUG)<br />
<br />
The fix for this last scenario could be worth its own commit, but we<br />
opted for a single commit, because removing the gntdev_grant_map<br />
structure&#39;s vma field requires guarding the entry to gntdev_mmap(), and<br />
the live_grants atomic counter is not sufficient on its own to prevent<br />
the mmap() over a pre-existing mapping.
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 2.6.38 (including) | 5.10.152 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.75 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 5.19.17 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.0 (including) | 6.0.3 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/3c6a888e352283a14f37b9b433cd598a1a3a7dd0
- https://git.kernel.org/stable/c/4fb4053d90caa9985b87ec0e0c32c66a55bdfa3a
- https://git.kernel.org/stable/c/5c13a4a0291b30191eff9ead8d010e1ca43a4d0c
- https://git.kernel.org/stable/c/7c16d0a4e6a436b4e7c92bead3fab55aaa4c1141
- https://git.kernel.org/stable/c/cdafa219ace013c594e2491158ad1b51f9923dde



