CVE-2022-50257
In the Linux kernel, the following vulnerability has been resolved:
xen/gntdev: Prevent leaking grants
Prior to this commit, if a grant mapping operation failed partially, some of the entries in the map_ops array would be invalid, whereas all of the entries in the kmap_ops array would be valid. This in turn would cause the following logic in gntdev_map_grant_pages to become invalid:
Assume that use_ptemod is true (i.e., the domain mapping the granted pages is a paravirtualized domain).
Leer descripción completaMostrar menos
In the code excerpt above, note that the "alloced" variable is only incremented when both kmap_ops[i].status and map_ops[i].status are set to GNTST_okay (i.e., both mapping operations are successful). However, as also noted above, there are cases where a grant mapping operation fails partially, breaking the assumption of the code excerpt above.
The aforementioned causes map->live_grants to be incorrectly set. In some cases, all of the map_ops mappings fail, but all of the kmap_ops mappings succeed, meaning that live_grants may remain zero. This in turn makes it impossible to unmap the successfully grant-mapped pages pointed to by kmap_ops, because unmap_grant_pages has the following snippet of code at its beginning:
In other cases where only some of the map_ops mappings fail but all kmap_ops mappings succeed, live_grants is made positive, but when the user requests unmapping the grant-mapped pages, __unmap_grant_pages_done will then make map->live_grants negative, because the latter function does not check if all of the pages that were requested to be unmapped were actually unmapped, and the same function unconditionally subtracts "data->count" (i.e., a value that can be greater than map->live_grants) from map->live_grants. The side effects of a negative live_grants value have not been studied.
The net effect of all of this is that grant references are leaked in one of the above conditions. In Qubes OS v4.1 (which uses Xen's grant mechanism extensively for X11 GUI isolation), this issue manifests itself with warning messages like the following to be printed out by the Linux kernel in the VM that had granted pages (that contain X11 GUI window data) to dom0: "g.e. 0x1234 still pending", especially after the user rapidly resizes GUI VM windows (causing some grant-mapping operations to partially or completely fail, due to the fact that the VM unshares some of the pages as part of the window resizing, making the pages impossible to grant-map from dom0).
The fix for this issue involves counting all successful map_ops and kmap_ops mappings separately, and then adding the sum to live_grants. During unmapping, only the number of successfully unmapped grants is subtracted from live_grants. The code is also modified to check for negative live_grants values after the subtraction and warn the user.
Detalles técnicos trazas, registros y código del informe original
for (i = 0; i < map->count; i++) {
if (map->map_ops[i].status == GNTST_okay) {
map->unmap_ops[i].handle = map->map_ops[i].handle;
if (!use_ptemod)
alloced++;
}
if (use_ptemod) {
if (map->kmap_ops[i].status == GNTST_okay) {
if (map->map_ops[i].status == GNTST_okay)
alloced++;
map->kunmap_ops[i].handle = map->kmap_ops[i].handle;
}
}
}
...
atomic_add(alloced, &map->live_grants);
if (atomic_read(&map->live_grants) == 0)
return; /* Nothing to do */CVSS
- Versión: 3.1
- Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Puntuación base: 5.5
Probabilidad de explotación (EPSS)
- Probabilidad de explotación en los próximos 30 días: 0.16%
- Percentil entre todas las CVEs puntuadas: 5
- Fecha de la puntuación: 5/10/2026
EPSS (Exploit Prediction Scoring System, de FIRST) estima la probabilidad de que una vulnerabilidad sea explotada en 30 días. Complementa a CVSS (impacto) y a CISA KEV (explotación confirmada).
Tecnologías afectadas (1)
CWE
- NVD-CWE-noinfo
Referencias
- https://git.kernel.org/stable/c/0991028cd49567d7016d1b224fe0117c35059f86
- https://git.kernel.org/stable/c/0bccddd9b8f03ad57bb738f0d3da8845d4e1e579
- https://git.kernel.org/stable/c/1cb73704cb4778299609634a790a80daba582f7d
- https://git.kernel.org/stable/c/273f6a4f71be12e2ec80a4919837d6e4fa933a04
- https://git.kernel.org/stable/c/3d056d81b93a787613eda44aeb21fc14c3392b34
- https://git.kernel.org/stable/c/49bb053b1ec367b6883030eb2cca696e91435679
- https://git.kernel.org/stable/c/49db6cb81400ba863e1a85e55fcdf1031807c23f
- https://git.kernel.org/stable/c/b043f2cab100bed3e0a999dcf38cc05b1e4a7e41
- https://git.kernel.org/stable/c/cb1ccfe7655380f77a58b340072f5f40bc285902
JSON original (NVD)
Mostrar
{
"id": "CVE-2022-50257",
"cveTags": [],
"metrics": {
"cvssMetricV31": [
{
"type": "Primary",
"source": "nvd@nist.gov",
"cvssData": {
"scope": "UNCHANGED",
"version": "3.1",
"baseScore": 5.5,
"attackVector": "LOCAL",
"baseSeverity": "MEDIUM",
"vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
"integrityImpact": "NONE",
"userInteraction": "NONE",
"attackComplexity": "LOW",
"availabilityImpact": "HIGH",
"privilegesRequired": "LOW",
"confidentialityImpact": "NONE"
},
"impactScore": 3.6,
"exploitabilityScore": 1.8
}
]
},
"affected": [
{
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"affectedData": [
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"product": "Linux",
"versions": [
{
"status": "affected",
"version": "36cd49b071fceca70326d9db786aa15e9fffd677",
"lessThan": "b043f2cab100bed3e0a999dcf38cc05b1e4a7e41",
"versionType": "git"
},
{
"status": "affected",
"version": "2fe26a9a70482bea7827803fdec98050fec68b20",
"lessThan": "49bb053b1ec367b6883030eb2cca696e91435679",
"versionType": "git"
},
{
"status": "affected",
"version": "73e9e72247b98da65bc32d41a961e820cca5f503",
"lessThan": "cb1ccfe7655380f77a58b340072f5f40bc285902",
"versionType": "git"
},
{
"status": "affected",
"version": "ee25841221c17228cbd30262a90f3b03ad80cdf6",
"lessThan": "3d056d81b93a787613eda44aeb21fc14c3392b34",
"versionType": "git"
},
{
"status": "affected",
"version": "79963021fd718b74bed4cbc98f5f49d3ba6fb48c",
"lessThan": "49db6cb81400ba863e1a85e55fcdf1031807c23f",
"versionType": "git"
},
{
"status": "affected",
"version": "87a54feba68f5e47925c8e49100db9b2a8add761",
"lessThan": "1cb73704cb4778299609634a790a80daba582f7d",
"versionType": "git"
},
{
"status": "affected",
"version": "dbe97cff7dd9f0f75c524afdd55ad46be3d15295",
"lessThan": "0bccddd9b8f03ad57bb738f0d3da8845d4e1e579",
"versionType": "git"
},
{
"status": "affected",
"version": "dbe97cff7dd9f0f75c524afdd55ad46be3d15295",
"lessThan": "273f6a4f71be12e2ec80a4919837d6e4fa933a04",
"versionType": "git"
},
{
"status": "affected",
"version": "dbe97cff7dd9f0f75c524afdd55ad46be3d15295",
"lessThan": "0991028cd49567d7016d1b224fe0117c35059f86",
"versionType": "git"
},
{
"status": "affected",
"version": "d4a49d20cd7cdb6bd075cd04c2cd00a7eba907ed",
"versionType": "git"
},
{
"status": "affected",
"version": "4.9.322",
"lessThan": "4.9.332",
"versionType": "semver"
},
{
"status": "affected",
"version": "4.14.287",
"lessThan": "4.14.298",
"versionType": "semver"
},
{
"status": "affected",
"version": "4.19.251",
"lessThan": "4.19.264",
"versionType": "semver"
},
{
"status": "affected",
"version": "5.4.204",
"lessThan": "5.4.223",
"versionType": "semver"
},
{
"status": "affected",
"version": "5.10.129",
"lessThan": "5.10.153",
"versionType": "semver"
},
{
"status": "affected",
"version": "5.15.51",
"lessThan": "5.15.75",
"versionType": "semver"
},
{
"status": "affected",
"version": "5.18.8",
"lessThan": "5.19",
"versionType": "semver"
}
],
"programFiles": [
"drivers/xen/gntdev.c"
],
"defaultStatus": "unaffected"
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"product": "Linux",
"versions": [
{
"status": "affected",
"version": "5.19"
},
{
"status": "unaffected",
"version": "0",
"lessThan": "5.19",
"versionType": "semver"
},
{
"status": "unaffected",
"version": "4.9.332",
"versionType": "semver",
"lessThanOrEqual": "4.9.*"
},
{
"status": "unaffected",
"version": "4.14.298",
"versionType": "semver",
"lessThanOrEqual": "4.14.*"
},
{
"status": "unaffected",
"version": "4.19.264",
"versionType": "semver",
"lessThanOrEqual": "4.19.*"
},
{
"status": "unaffected",
"version": "5.4.223",
"versionType": "semver",
"lessThanOrEqual": "5.4.*"
},
{
"status": "unaffected",
"version": "5.10.153",
"versionType": "semver",
"lessThanOrEqual": "5.10.*"
},
{
"status": "unaffected",
"version": "5.15.75",
"versionType": "semver",
"lessThanOrEqual": "5.15.*"
},
{
"status": "unaffected",
"version": "5.19.17",
"versionType": "semver",
"lessThanOrEqual": "5.19.*"
},
{
"status": "unaffected",
"version": "6.0.3",
"versionType": "semver",
"lessThanOrEqual": "6.0.*"
},
{
"status": "unaffected",
"version": "6.1",
"versionType": "original_commit_for_fix",
"lessThanOrEqual": "*"
}
],
"programFiles": [
"drivers/xen/gntdev.c"
],
"defaultStatus": "affected"
}
]
}
],
"published": "2025-09-15T14:15:36.487",
"references": [
{
"url": "https://git.kernel.org/stable/c/0991028cd49567d7016d1b224fe0117c35059f86",
"tags": [
"Patch"
],
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
},
{
"url": "https://git.kernel.org/stable/c/0bccddd9b8f03ad57bb738f0d3da8845d4e1e579",
"tags": [
"Patch"
],
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
},
{
"url": "https://git.kernel.org/stable/c/1cb73704cb4778299609634a790a80daba582f7d",
"tags": [
"Patch"
],
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
},
{
"url": "https://git.kernel.org/stable/c/273f6a4f71be12e2ec80a4919837d6e4fa933a04",
"tags": [
"Patch"
],
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
},
{
"url": "https://git.kernel.org/stable/c/3d056d81b93a787613eda44aeb21fc14c3392b34",
"tags": [
"Patch"
],
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
},
{
"url": "https://git.kernel.org/stable/c/49bb053b1ec367b6883030eb2cca696e91435679",
"tags": [
"Patch"
],
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
},
{
"url": "https://git.kernel.org/stable/c/49db6cb81400ba863e1a85e55fcdf1031807c23f",
"tags": [
"Patch"
],
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
},
{
"url": "https://git.kernel.org/stable/c/b043f2cab100bed3e0a999dcf38cc05b1e4a7e41",
"tags": [
"Patch"
],
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
},
{
"url": "https://git.kernel.org/stable/c/cb1ccfe7655380f77a58b340072f5f40bc285902",
"tags": [
"Patch"
],
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
}
],
"vulnStatus": "Analyzed",
"weaknesses": [
{
"type": "Primary",
"source": "nvd@nist.gov",
"description": [
{
"lang": "en",
"value": "NVD-CWE-noinfo"
}
]
}
],
"descriptions": [
{
"lang": "en",
"value": "In the Linux kernel, the following vulnerability has been resolved:\n\nxen/gntdev: Prevent leaking grants\n\nPrior to this commit, if a grant mapping operation failed partially,\nsome of the entries in the map_ops array would be invalid, whereas all\nof the entries in the kmap_ops array would be valid. This in turn would\ncause the following logic in gntdev_map_grant_pages to become invalid:\n\n for (i = 0; i < map->count; i++) {\n if (map->map_ops[i].status == GNTST_okay) {\n map->unmap_ops[i].handle = map->map_ops[i].handle;\n if (!use_ptemod)\n alloced++;\n }\n if (use_ptemod) {\n if (map->kmap_ops[i].status == GNTST_okay) {\n if (map->map_ops[i].status == GNTST_okay)\n alloced++;\n map->kunmap_ops[i].handle = map->kmap_ops[i].handle;\n }\n }\n }\n ...\n atomic_add(alloced, &map->live_grants);\n\nAssume that use_ptemod is true (i.e., the domain mapping the granted\npages is a paravirtualized domain). In the code excerpt above, note that\nthe \"alloced\" variable is only incremented when both kmap_ops[i].status\nand map_ops[i].status are set to GNTST_okay (i.e., both mapping\noperations are successful). However, as also noted above, there are\ncases where a grant mapping operation fails partially, breaking the\nassumption of the code excerpt above.\n\nThe aforementioned causes map->live_grants to be incorrectly set. In\nsome cases, all of the map_ops mappings fail, but all of the kmap_ops\nmappings succeed, meaning that live_grants may remain zero. This in turn\nmakes it impossible to unmap the successfully grant-mapped pages pointed\nto by kmap_ops, because unmap_grant_pages has the following snippet of\ncode at its beginning:\n\n if (atomic_read(&map->live_grants) == 0)\n return; /* Nothing to do */\n\nIn other cases where only some of the map_ops mappings fail but all\nkmap_ops mappings succeed, live_grants is made positive, but when the\nuser requests unmapping the grant-mapped pages, __unmap_grant_pages_done\nwill then make map->live_grants negative, because the latter function\ndoes not check if all of the pages that were requested to be unmapped\nwere actually unmapped, and the same function unconditionally subtracts\n\"data->count\" (i.e., a value that can be greater than map->live_grants)\nfrom map->live_grants. The side effects of a negative live_grants value\nhave not been studied.\n\nThe net effect of all of this is that grant references are leaked in one\nof the above conditions. In Qubes OS v4.1 (which uses Xen's grant\nmechanism extensively for X11 GUI isolation), this issue manifests\nitself with warning messages like the following to be printed out by the\nLinux kernel in the VM that had granted pages (that contain X11 GUI\nwindow data) to dom0: \"g.e. 0x1234 still pending\", especially after the\nuser rapidly resizes GUI VM windows (causing some grant-mapping\noperations to partially or completely fail, due to the fact that the VM\nunshares some of the pages as part of the window resizing, making the\npages impossible to grant-map from dom0).\n\nThe fix for this issue involves counting all successful map_ops and\nkmap_ops mappings separately, and then adding the sum to live_grants.\nDuring unmapping, only the number of successfully unmapped grants is\nsubtracted from live_grants. The code is also modified to check for\nnegative live_grants values after the subtraction and warn the user."
}
],
"lastModified": "2026-06-17T05:23:05.447",
"configurations": [
{
"nodes": [
{
"negate": false,
"cpeMatch": [
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "9C120049-173C-49B6-A1E4-C5A5FF085E42",
"versionEndExcluding": "4.9.332",
"versionStartIncluding": "4.9.322"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "2ECA2DC9-70EC-496B-9585-D51251A637A1",
"versionEndExcluding": "4.14.298",
"versionStartIncluding": "4.14.287"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "60728B5D-21DF-443F-861E-B44519EF93D2",
"versionEndExcluding": "4.19.264",
"versionStartIncluding": "4.19.251"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "AF92F6AB-6E27-4912-8706-1049054D6598",
"versionEndExcluding": "5.4.223",
"versionStartIncluding": "5.4.204"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "19A498DA-A3C8-43F5-9FDC-A6AE227709F8",
"versionEndExcluding": "5.10.153",
"versionStartIncluding": "5.10.129"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "6C3B74F0-E4D8-4FD9-85A8-58C3737A7DF3",
"versionEndExcluding": "5.15.75",
"versionStartIncluding": "5.15.51"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "E06CA42F-27CC-4023-9E3C-6658682BFC33",
"versionEndExcluding": "5.19",
"versionStartIncluding": "5.18.8"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "384E617D-9912-4E61-834B-33877B9B7688",
"versionEndExcluding": "5.19.17",
"versionStartIncluding": "5.19.1"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "5BCD8201-B847-4442-B894-70D430128DEF",
"versionEndExcluding": "6.0.3",
"versionStartIncluding": "6.0"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:5.19:-:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "9D759CCF-9E1B-41B2-81AA-CB580C5F3EEC"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:5.19:rc4:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "2E9C0DB0-D349-489F-A3D6-B77214E93A8A"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:5.19:rc5:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "1A0DE3B7-0FFB-45AA-9BD6-19870CA7C6FD"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:5.19:rc6:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "00AE778B-BAEE-49EB-9F84-003B73D7862A"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:5.19:rc7:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "C178431E-AD82-4B3D-B70F-A273A02ABD5D"
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:5.19:rc8:*:*:*:*:*:*",
"vulnerable": true,
"matchCriteriaId": "2CF5D19C-C418-4B57-B52D-7795547F4096"
}
],
"operator": "OR"
}
]
}
],
"sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
}