CVE-2021-4440 (GCVE-0-2021-4440)
Vulnerability from cvelistv5
Published
2024-06-25 14:20
Modified
2025-05-04 06:59
Severity ?
VLAI Severity ?
EPSS score ?
Summary
In the Linux kernel, the following vulnerability has been resolved:
x86/xen: Drop USERGS_SYSRET64 paravirt call
commit afd30525a659ac0ae0904f0cb4a2ca75522c3123 upstream.
USERGS_SYSRET64 is used to return from a syscall via SYSRET, but
a Xen PV guest will nevertheless use the IRET hypercall, as there
is no sysret PV hypercall defined.
So instead of testing all the prerequisites for doing a sysret and
then mangling the stack for Xen PV again for doing an iret just use
the iret exit from the beginning.
This can easily be done via an ALTERNATIVE like it is done for the
sysenter compat case already.
It should be noted that this drops the optimization in Xen for not
restoring a few registers when returning to user mode, but it seems
as if the saved instructions in the kernel more than compensate for
this drop (a kernel build in a Xen PV guest was slightly faster with
this patch applied).
While at it remove the stale sysret32 remnants.
[ pawan: Brad Spengler and Salvatore Bonaccorso <carnil@debian.org>
reported a problem with the 5.10 backport commit edc702b4a820
("x86/entry_64: Add VERW just before userspace transition").
When CONFIG_PARAVIRT_XXL=y, CLEAR_CPU_BUFFERS is not executed in
syscall_return_via_sysret path as USERGS_SYSRET64 is runtime
patched to:
.cpu_usergs_sysret64 = { 0x0f, 0x01, 0xf8,
0x48, 0x0f, 0x07 }, // swapgs; sysretq
which is missing CLEAR_CPU_BUFFERS. It turns out dropping
USERGS_SYSRET64 simplifies the code, allowing CLEAR_CPU_BUFFERS
to be explicitly added to syscall_return_via_sysret path. Below
is with CONFIG_PARAVIRT_XXL=y and this patch applied:
syscall_return_via_sysret:
...
<+342>: swapgs
<+345>: xchg %ax,%ax
<+347>: verw -0x1a2(%rip) <------
<+354>: sysretq
]
References
Impacted products
{
"containers": {
"adp": [
{
"affected": [
{
"cpes": [
"cpe:2.3:o:linux:linux_kernel:-:*:*:*:*:*:*:*"
],
"defaultStatus": "unknown",
"product": "linux_kernel",
"vendor": "linux",
"versions": [
{
"lessThan": "1424ab4bb386",
"status": "affected",
"version": "cea750c99d8f",
"versionType": "custom"
}
]
},
{
"cpes": [
"cpe:2.3:o:linux:linux_kernel:-:*:*:*:*:*:*:*"
],
"defaultStatus": "unknown",
"product": "linux_kernel",
"vendor": "linux",
"versions": [
{
"lessThan": "5.10.218",
"status": "affected",
"version": "5.10.215",
"versionType": "custom"
}
]
}
],
"metrics": [
{
"cvssV3_1": {
"attackComplexity": "LOW",
"attackVector": "LOCAL",
"availabilityImpact": "HIGH",
"baseScore": 8.8,
"baseSeverity": "HIGH",
"confidentialityImpact": "HIGH",
"integrityImpact": "HIGH",
"privilegesRequired": "LOW",
"scope": "CHANGED",
"userInteraction": "NONE",
"vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H",
"version": "3.1"
}
},
{
"other": {
"content": {
"id": "CVE-2021-4440",
"options": [
{
"Exploitation": "none"
},
{
"Automatable": "no"
},
{
"Technical Impact": "total"
}
],
"role": "CISA Coordinator",
"timestamp": "2024-06-26T13:55:14.340611Z",
"version": "2.0.3"
},
"type": "ssvc"
}
}
],
"problemTypes": [
{
"descriptions": [
{
"cweId": "CWE-400",
"description": "CWE-400 Uncontrolled Resource Consumption",
"lang": "en",
"type": "CWE"
}
]
}
],
"providerMetadata": {
"dateUpdated": "2024-06-26T14:00:48.356Z",
"orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"shortName": "CISA-ADP"
},
"title": "CISA ADP Vulnrichment"
},
{
"providerMetadata": {
"dateUpdated": "2024-08-03T17:30:07.494Z",
"orgId": "af854a3a-2127-422b-91ae-364da2661108",
"shortName": "CVE"
},
"references": [
{
"tags": [
"x_transferred"
],
"url": "https://git.kernel.org/stable/c/1424ab4bb386df9cc590c73afa55f13e9b00dea2"
},
{
"tags": [
"x_transferred"
],
"url": "https://grsecurity.net/cve-2021-4440_linux_cna_case_study"
}
],
"title": "CVE Program Container"
}
],
"cna": {
"affected": [
{
"defaultStatus": "unaffected",
"product": "Linux",
"programFiles": [
"arch/x86/entry/entry_64.S",
"arch/x86/include/asm/irqflags.h",
"arch/x86/include/asm/paravirt.h",
"arch/x86/include/asm/paravirt_types.h",
"arch/x86/kernel/asm-offsets_64.c",
"arch/x86/kernel/paravirt.c",
"arch/x86/kernel/paravirt_patch.c",
"arch/x86/xen/enlighten_pv.c",
"arch/x86/xen/xen-asm.S",
"arch/x86/xen/xen-ops.h"
],
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"versions": [
{
"lessThan": "1424ab4bb386df9cc590c73afa55f13e9b00dea2",
"status": "affected",
"version": "cea750c99d8f6391080c420f811a46b21bad7cf4",
"versionType": "git"
}
]
},
{
"defaultStatus": "unaffected",
"product": "Linux",
"programFiles": [
"arch/x86/entry/entry_64.S",
"arch/x86/include/asm/irqflags.h",
"arch/x86/include/asm/paravirt.h",
"arch/x86/include/asm/paravirt_types.h",
"arch/x86/kernel/asm-offsets_64.c",
"arch/x86/kernel/paravirt.c",
"arch/x86/kernel/paravirt_patch.c",
"arch/x86/xen/enlighten_pv.c",
"arch/x86/xen/xen-asm.S",
"arch/x86/xen/xen-ops.h"
],
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"versions": [
{
"lessThan": "5.10.218",
"status": "affected",
"version": "5.10.215",
"versionType": "semver"
}
]
}
],
"cpeApplicability": [
{
"nodes": [
{
"cpeMatch": [
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"versionEndExcluding": "5.10.218",
"versionStartIncluding": "5.10.215",
"vulnerable": true
}
],
"negate": false,
"operator": "OR"
}
]
}
],
"descriptions": [
{
"lang": "en",
"value": "In the Linux kernel, the following vulnerability has been resolved:\n\nx86/xen: Drop USERGS_SYSRET64 paravirt call\n\ncommit afd30525a659ac0ae0904f0cb4a2ca75522c3123 upstream.\n\nUSERGS_SYSRET64 is used to return from a syscall via SYSRET, but\na Xen PV guest will nevertheless use the IRET hypercall, as there\nis no sysret PV hypercall defined.\n\nSo instead of testing all the prerequisites for doing a sysret and\nthen mangling the stack for Xen PV again for doing an iret just use\nthe iret exit from the beginning.\n\nThis can easily be done via an ALTERNATIVE like it is done for the\nsysenter compat case already.\n\nIt should be noted that this drops the optimization in Xen for not\nrestoring a few registers when returning to user mode, but it seems\nas if the saved instructions in the kernel more than compensate for\nthis drop (a kernel build in a Xen PV guest was slightly faster with\nthis patch applied).\n\nWhile at it remove the stale sysret32 remnants.\n\n [ pawan: Brad Spengler and Salvatore Bonaccorso \u003ccarnil@debian.org\u003e\n\t reported a problem with the 5.10 backport commit edc702b4a820\n\t (\"x86/entry_64: Add VERW just before userspace transition\").\n\n\t When CONFIG_PARAVIRT_XXL=y, CLEAR_CPU_BUFFERS is not executed in\n\t syscall_return_via_sysret path as USERGS_SYSRET64 is runtime\n\t patched to:\n\n\t.cpu_usergs_sysret64 = { 0x0f, 0x01, 0xf8,\n\t\t\t\t 0x48, 0x0f, 0x07 }, // swapgs; sysretq\n\n\t which is missing CLEAR_CPU_BUFFERS. It turns out dropping\n\t USERGS_SYSRET64 simplifies the code, allowing CLEAR_CPU_BUFFERS\n\t to be explicitly added to syscall_return_via_sysret path. Below\n\t is with CONFIG_PARAVIRT_XXL=y and this patch applied:\n\n\t syscall_return_via_sysret:\n\t ...\n\t \u003c+342\u003e: swapgs\n\t \u003c+345\u003e: xchg %ax,%ax\n\t \u003c+347\u003e: verw -0x1a2(%rip) \u003c------\n\t \u003c+354\u003e: sysretq\n ]"
}
],
"providerMetadata": {
"dateUpdated": "2025-05-04T06:59:54.176Z",
"orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"shortName": "Linux"
},
"references": [
{
"url": "https://git.kernel.org/stable/c/1424ab4bb386df9cc590c73afa55f13e9b00dea2"
},
{
"url": "https://grsecurity.net/cve-2021-4440_linux_cna_case_study"
}
],
"title": "x86/xen: Drop USERGS_SYSRET64 paravirt call",
"x_generator": {
"engine": "bippy-1.2.0"
}
}
},
"cveMetadata": {
"assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"assignerShortName": "Linux",
"cveId": "CVE-2021-4440",
"datePublished": "2024-06-25T14:20:00.740Z",
"dateReserved": "2024-06-25T14:16:59.867Z",
"dateUpdated": "2025-05-04T06:59:54.176Z",
"state": "PUBLISHED"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.1",
"vulnerability-lookup:meta": {
"vulnrichment": {
"containers": "{\"adp\": [{\"title\": \"CVE Program Container\", \"references\": [{\"url\": \"https://git.kernel.org/stable/c/1424ab4bb386df9cc590c73afa55f13e9b00dea2\", \"tags\": [\"x_transferred\"]}, {\"url\": \"https://grsecurity.net/cve-2021-4440_linux_cna_case_study\", \"tags\": [\"x_transferred\"]}], \"providerMetadata\": {\"orgId\": \"af854a3a-2127-422b-91ae-364da2661108\", \"shortName\": \"CVE\", \"dateUpdated\": \"2024-08-03T17:30:07.494Z\"}}, {\"title\": \"CISA ADP Vulnrichment\", \"metrics\": [{\"cvssV3_1\": {\"scope\": \"CHANGED\", \"version\": \"3.1\", \"baseScore\": 8.8, \"attackVector\": \"LOCAL\", \"baseSeverity\": \"HIGH\", \"vectorString\": \"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H\", \"integrityImpact\": \"HIGH\", \"userInteraction\": \"NONE\", \"attackComplexity\": \"LOW\", \"availabilityImpact\": \"HIGH\", \"privilegesRequired\": \"LOW\", \"confidentialityImpact\": \"HIGH\"}}, {\"other\": {\"type\": \"ssvc\", \"content\": {\"id\": \"CVE-2021-4440\", \"role\": \"CISA Coordinator\", \"options\": [{\"Exploitation\": \"none\"}, {\"Automatable\": \"no\"}, {\"Technical Impact\": \"total\"}], \"version\": \"2.0.3\", \"timestamp\": \"2024-06-26T13:55:14.340611Z\"}}}], \"affected\": [{\"cpes\": [\"cpe:2.3:o:linux:linux_kernel:-:*:*:*:*:*:*:*\"], \"vendor\": \"linux\", \"product\": \"linux_kernel\", \"versions\": [{\"status\": \"affected\", \"version\": \"cea750c99d8f\", \"lessThan\": \"1424ab4bb386\", \"versionType\": \"custom\"}], \"defaultStatus\": \"unknown\"}, {\"cpes\": [\"cpe:2.3:o:linux:linux_kernel:-:*:*:*:*:*:*:*\"], \"vendor\": \"linux\", \"product\": \"linux_kernel\", \"versions\": [{\"status\": \"affected\", \"version\": \"5.10.215\", \"lessThan\": \"5.10.218\", \"versionType\": \"custom\"}], \"defaultStatus\": \"unknown\"}], \"problemTypes\": [{\"descriptions\": [{\"lang\": \"en\", \"type\": \"CWE\", \"cweId\": \"CWE-400\", \"description\": \"CWE-400 Uncontrolled Resource Consumption\"}]}], \"providerMetadata\": {\"orgId\": \"134c704f-9b21-4f2e-91b3-4a467353bcc0\", \"shortName\": \"CISA-ADP\", \"dateUpdated\": \"2024-06-26T13:57:16.433Z\"}}], \"cna\": {\"title\": \"x86/xen: Drop USERGS_SYSRET64 paravirt call\", \"affected\": [{\"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\", \"vendor\": \"Linux\", \"product\": \"Linux\", \"versions\": [{\"status\": \"affected\", \"version\": \"cea750c99d8f6391080c420f811a46b21bad7cf4\", \"lessThan\": \"1424ab4bb386df9cc590c73afa55f13e9b00dea2\", \"versionType\": \"git\"}], \"programFiles\": [\"arch/x86/entry/entry_64.S\", \"arch/x86/include/asm/irqflags.h\", \"arch/x86/include/asm/paravirt.h\", \"arch/x86/include/asm/paravirt_types.h\", \"arch/x86/kernel/asm-offsets_64.c\", \"arch/x86/kernel/paravirt.c\", \"arch/x86/kernel/paravirt_patch.c\", \"arch/x86/xen/enlighten_pv.c\", \"arch/x86/xen/xen-asm.S\", \"arch/x86/xen/xen-ops.h\"], \"defaultStatus\": \"unaffected\"}, {\"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\", \"vendor\": \"Linux\", \"product\": \"Linux\", \"versions\": [{\"status\": \"affected\", \"version\": \"5.10.215\", \"lessThan\": \"5.10.218\", \"versionType\": \"semver\"}], \"programFiles\": [\"arch/x86/entry/entry_64.S\", \"arch/x86/include/asm/irqflags.h\", \"arch/x86/include/asm/paravirt.h\", \"arch/x86/include/asm/paravirt_types.h\", \"arch/x86/kernel/asm-offsets_64.c\", \"arch/x86/kernel/paravirt.c\", \"arch/x86/kernel/paravirt_patch.c\", \"arch/x86/xen/enlighten_pv.c\", \"arch/x86/xen/xen-asm.S\", \"arch/x86/xen/xen-ops.h\"], \"defaultStatus\": \"unaffected\"}], \"references\": [{\"url\": \"https://git.kernel.org/stable/c/1424ab4bb386df9cc590c73afa55f13e9b00dea2\"}, {\"url\": \"https://grsecurity.net/cve-2021-4440_linux_cna_case_study\"}], \"x_generator\": {\"engine\": \"bippy-1.2.0\"}, \"descriptions\": [{\"lang\": \"en\", \"value\": \"In the Linux kernel, the following vulnerability has been resolved:\\n\\nx86/xen: Drop USERGS_SYSRET64 paravirt call\\n\\ncommit afd30525a659ac0ae0904f0cb4a2ca75522c3123 upstream.\\n\\nUSERGS_SYSRET64 is used to return from a syscall via SYSRET, but\\na Xen PV guest will nevertheless use the IRET hypercall, as there\\nis no sysret PV hypercall defined.\\n\\nSo instead of testing all the prerequisites for doing a sysret and\\nthen mangling the stack for Xen PV again for doing an iret just use\\nthe iret exit from the beginning.\\n\\nThis can easily be done via an ALTERNATIVE like it is done for the\\nsysenter compat case already.\\n\\nIt should be noted that this drops the optimization in Xen for not\\nrestoring a few registers when returning to user mode, but it seems\\nas if the saved instructions in the kernel more than compensate for\\nthis drop (a kernel build in a Xen PV guest was slightly faster with\\nthis patch applied).\\n\\nWhile at it remove the stale sysret32 remnants.\\n\\n [ pawan: Brad Spengler and Salvatore Bonaccorso \u003ccarnil@debian.org\u003e\\n\\t reported a problem with the 5.10 backport commit edc702b4a820\\n\\t (\\\"x86/entry_64: Add VERW just before userspace transition\\\").\\n\\n\\t When CONFIG_PARAVIRT_XXL=y, CLEAR_CPU_BUFFERS is not executed in\\n\\t syscall_return_via_sysret path as USERGS_SYSRET64 is runtime\\n\\t patched to:\\n\\n\\t.cpu_usergs_sysret64 = { 0x0f, 0x01, 0xf8,\\n\\t\\t\\t\\t 0x48, 0x0f, 0x07 }, // swapgs; sysretq\\n\\n\\t which is missing CLEAR_CPU_BUFFERS. It turns out dropping\\n\\t USERGS_SYSRET64 simplifies the code, allowing CLEAR_CPU_BUFFERS\\n\\t to be explicitly added to syscall_return_via_sysret path. Below\\n\\t is with CONFIG_PARAVIRT_XXL=y and this patch applied:\\n\\n\\t syscall_return_via_sysret:\\n\\t ...\\n\\t \u003c+342\u003e: swapgs\\n\\t \u003c+345\u003e: xchg %ax,%ax\\n\\t \u003c+347\u003e: verw -0x1a2(%rip) \u003c------\\n\\t \u003c+354\u003e: sysretq\\n ]\"}], \"cpeApplicability\": [{\"nodes\": [{\"negate\": false, \"cpeMatch\": [{\"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"vulnerable\": true, \"versionEndExcluding\": \"5.10.218\", \"versionStartIncluding\": \"5.10.215\"}], \"operator\": \"OR\"}]}], \"providerMetadata\": {\"orgId\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"shortName\": \"Linux\", \"dateUpdated\": \"2025-05-04T06:59:54.176Z\"}}}",
"cveMetadata": "{\"cveId\": \"CVE-2021-4440\", \"state\": \"PUBLISHED\", \"dateUpdated\": \"2025-05-04T06:59:54.176Z\", \"dateReserved\": \"2024-06-25T14:16:59.867Z\", \"assignerOrgId\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"datePublished\": \"2024-06-25T14:20:00.740Z\", \"assignerShortName\": \"Linux\"}",
"dataType": "CVE_RECORD",
"dataVersion": "5.1"
}
}
}
Loading…
Loading…
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.
Loading…
Loading…