# CVE-2022-50471: xen/gntdev: Accommodate VMA splitting

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.22% (percentile 7, 2026-11-26)
- **Published:** 2025-10-04T15:16:33.489Z
- **Modified:** 2026-06-17T05:23:37.210Z

## Who should check

- Anyone running Linux \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 3c6a888e352283a14f37b9b433cd598a1a3a7dd0; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 7c16d0a4e6a436b4e7c92bead3fab55aaa4c1141; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 4fb4053d90caa9985b87ec0e0c32c66a55bdfa3a; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< cdafa219ace013c594e2491158ad1b51f9923dde; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 5c13a4a0291b30191eff9ead8d010e1ca43a4d0c
- Anyone running Linux 2.6.38

## Description

In the Linux kernel, the following vulnerability has been resolved:

xen/gntdev: Accommodate VMA splitting

Prior to this commit, the gntdev driver code did not handle the
following scenario correctly with paravirtualized (PV) Xen domains:

\* User process sets up a gntdev mapping composed of two grant mappings
  (i.e., two pages shared by another Xen domain).
\* User process munmap()s one of the pages.
\* User process munmap()s the remaining page.
\* User process exits.

In the scenario above, the user process would cause the kernel to log
the following messages in dmesg for the first munmap(), and the second
munmap() call would result in similar log messages:

  BUG: Bad page map in process doublemap.test  pte:... pmd:...
  page:0000000057c97bff refcount:1 mapcount:-1 \\
    mapping:0000000000000000 index:0x0 pfn:...
  ...
  page dumped because: bad pte
  ...
  file:gntdev fault:0x0 mmap:gntdev\_mmap \[xen\_gntdev\] readpage:0x0
  ...
  Call Trace:
   \<TASK\>
   dump\_stack\_lvl+0x46/0x5e
   print\_bad\_pte.cold+0x66/0xb6
   unmap\_page\_range+0x7e5/0xdc0
   unmap\_vmas+0x78/0xf0
   unmap\_region+0xa8/0x110
   \_\_do\_munmap+0x1ea/0x4e0
   \_\_vm\_munmap+0x75/0x120
   \_\_x64\_sys\_munmap+0x28/0x40
   do\_syscall\_64+0x38/0x90
   entry\_SYSCALL\_64\_after\_hwframe+0x61/0xcb
   ...

For each munmap() call, the Xen hypervisor (if built with CONFIG\_DEBUG)
would print out the following and trigger a general protection fault in
the affected Xen PV domain:

  (XEN) d0v... Attempt to implicitly unmap d0's grant PTE ...
  (XEN) d0v... Attempt to implicitly unmap d0's grant PTE ...

As of this writing, gntdev\_grant\_map structure's vma field (referred to
as map-\>vma below) is mainly used for checking the start and end
addresses of mappings. However, with split VMAs, these may change, and
there could be more than one VMA associated with a gntdev mapping.
Hence, remove the use of map-\>vma and rely on map-\>pages\_vm\_start for
the original start address and on (map-\>count \<\< PAGE\_SHIFT) for the
original mapping size. Let the invalidate() and find\_special\_page()
hooks use these.

Also, given that there can be multiple VMAs associated with a gntdev
mapping, move the "mmu\_interval\_notifier\_remove(&map-\>notifier)" call to
the end of gntdev\_put\_map, so that the MMU notifier is only removed
after the closing of the last remaining VMA.

Finally, use an atomic to prevent inadvertent gntdev mapping re-use,
instead of using the map-\>live\_grants atomic counter and/or the map-\>vma
pointer (the latter of which is now removed). This prevents the
userspace from mmap()'ing (with MAP\_FIXED) a gntdev mapping over the
same address range as a previously set up gntdev mapping. This scenario
can be summarized with the following call-trace, which was valid prior
to this commit:

  mmap
    gntdev\_mmap
  mmap (repeat mmap with MAP\_FIXED over the same address range)
    gntdev\_invalidate
      unmap\_grant\_pages (sets 'being\_removed' entries to true)
        gnttab\_unmap\_refs\_async
    unmap\_single\_vma
    gntdev\_mmap (maps the shared pages again)
  munmap
    gntdev\_invalidate
      unmap\_grant\_pages
        (no-op because 'being\_removed' entries are true)
    unmap\_single\_vma (For PV domains, Xen reports that a granted page
      is being unmapped and triggers a general protection fault in the
      affected domain, if Xen was built with CONFIG\_DEBUG)

The fix for this last scenario could be worth its own commit, but we
opted for a single commit, because removing the gntdev\_grant\_map
structure's vma field requires guarding the entry to gntdev\_mmap(), and
the live\_grants atomic counter is not sufficient on its own to prevent
the mmap() over a pre-existing mapping.

## Affected and fixed versions

- Linux: \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 3c6a888e352283a14f37b9b433cd598a1a3a7dd0; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 7c16d0a4e6a436b4e7c92bead3fab55aaa4c1141; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 4fb4053d90caa9985b87ec0e0c32c66a55bdfa3a; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< cdafa219ace013c594e2491158ad1b51f9923dde; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 5c13a4a0291b30191eff9ead8d010e1ca43a4d0c (cvelist)
- Linux: 2.6.38 (cvelist)

## Mitigation

- Upgrade Linux to 5c13a4a0291b30191eff9ead8d010e1ca43a4d0c or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2022-50471. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-50471.md
Affected: Linux >= ab31523c2fcac557226bac72cbdf5fafe01f9a26, < 3c6a888e352283a14f37b9b433cd598a1a3a7dd0; >= ab31523c2fcac557226bac72cbdf5fafe01f9a26, < 7c16d0a4e6a436b4e7c92bead3fab55aaa4c1141; >= ab31523c2fcac557226bac72cbdf5fafe01f9a26, < 4fb4053d90caa9985b87ec0e0c32c66a55bdfa3a; >= ab31523c2fcac557226bac7…
Fixed in: Linux 3c6a888e352283a14f37b9b433cd598a1a3a7dd0, Linux 7c16d0a4e6a436b4e7c92bead3fab55aaa4c1141, Linux 4fb4053d90caa9985b87ec0e0c32c66a55bdfa3a, Linux 5c13a4a0291b30191eff9ead8d010e1ca43a4d0c

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2022-50471 being exploited?

There is no confirmed exploitation: CVE-2022-50471 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.22% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2022-50471?

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2022-50471?

Linux \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 3c6a888e352283a14f37b9b433cd598a1a3a7dd0; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 7c16d0a4e6a436b4e7c92bead3fab55aaa4c1141; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 4fb4053d90caa9985b87ec0e0c32c66a55bdfa3a; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< cdafa219ace013c594e2491158ad1b51f9923dde; \>= ab31523c2fcac557226bac72cbdf5fafe01f9a26, \< 5c13a4a0291b30191eff9ead8d010e1ca43a4d0c; Linux 2.6.38.

### Is there a fix for CVE-2022-50471?

Yes. Fixed in Linux 3c6a888e352283a14f37b9b433cd598a1a3a7dd0, Linux 7c16d0a4e6a436b4e7c92bead3fab55aaa4c1141, Linux 4fb4053d90caa9985b87ec0e0c32c66a55bdfa3a, Linux 5c13a4a0291b30191eff9ead8d010e1ca43a4d0c. Upgrade Linux to 5c13a4a0291b30191eff9ead8d010e1ca43a4d0c or later.

### How do I check if I'm affected by CVE-2022-50471?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/3c6a888e352283a14f37b9b433cd598a1a3a7dd0>
- patch: <https://git.kernel.org/stable/c/7c16d0a4e6a436b4e7c92bead3fab55aaa4c1141>
- patch: <https://git.kernel.org/stable/c/4fb4053d90caa9985b87ec0e0c32c66a55bdfa3a>
- patch: <https://git.kernel.org/stable/c/cdafa219ace013c594e2491158ad1b51f9923dde>
- patch: <https://git.kernel.org/stable/c/5c13a4a0291b30191eff9ead8d010e1ca43a4d0c>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2022-50471>

HTML: <https://flawdb.com/CVE-2022-50471> · JSON: <https://flawdb.com/api/v1/entries/CVE-2022-50471>
