cve-2021-4440
Vulnerability from cvelistv5
Published
2024-06-25 14:20
Modified
2024-11-04 11:30
Severity ?
EPSS score ?
Summary
x86/xen: Drop USERGS_SYSRET64 paravirt call
References
{ "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": "1424ab4bb386", "status": "affected", "version": "cea750c99d8f", "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" } ] } ], "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": "2024-11-04T11:30:23.940Z", "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-c8e10e5f6187" } } }, "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": "2024-11-04T11:30:23.940Z", "state": "PUBLISHED" }, "dataType": "CVE_RECORD", "dataVersion": "5.1", "meta": { "nvd": "{\"cve\":{\"id\":\"CVE-2021-4440\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-06-25T15:15:11.137\",\"lastModified\":\"2024-07-11T17:15:09.830\",\"vulnStatus\":\"Awaiting Analysis\",\"cveTags\":[],\"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 ]\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se resolvi\u00f3 la siguiente vulnerabilidad: x86/xen: elimine el commit de llamada paravirt USERGS_SYSRET64 afd30525a659ac0ae0904f0cb4a2ca75522c3123 en sentido ascendente. USERGS_SYSRET64 se usa para regresar de una llamada al sistema a trav\u00e9s de SYSRET, pero un invitado Xen PV usar\u00e1 la hiperllamada IRET, ya que no hay ninguna hiperllamada PV sysret definida. Entonces, en lugar de probar todos los requisitos previos para hacer un sysret y luego alterar la pila para Xen PV nuevamente para hacer un iret, simplemente use la salida iret desde el principio. Esto se puede hacer f\u00e1cilmente a trav\u00e9s de una ALTERNATIVA como ya se hace para el caso de compatibilidad con sysenter. Cabe se\u00f1alar que esto reduce la optimizaci\u00f3n en Xen para no restaurar algunos registros al regresar al modo de usuario, pero parece que las instrucciones guardadas en el kernel compensan con creces esta ca\u00edda (una compilaci\u00f3n del kernel en un invitado Xen PV fue un poco m\u00e1s r\u00e1pido con este parche aplicado). Mientras lo hace, elimine los restos obsoletos de sysret32. [pawan: Brad Spengler y Salvatore Bonaccorso informaron de un problema con el commit del backport 5.10 edc702b4a820 (\\\"x86/entry_64: Agregar VERW justo antes de la transici\u00f3n del espacio de usuario\\\"). Cuando CONFIG_PARAVIRT_XXL=y, CLEAR_CPU_BUFFERS no se ejecuta en la ruta syscall_return_via_sysret ya que USERGS_SYSRET64 est\u00e1 parcheado en tiempo de ejecuci\u00f3n para: .cpu_usergs_sysret64 = { 0x0f, 0x01, 0xf8, 0x48, 0x0f, 0x07 }, // swapgs; sysretq al que le falta CLEAR_CPU_BUFFERS. Resulta que eliminar USERGS_SYSRET64 simplifica el c\u00f3digo, permitiendo que CLEAR_CPU_BUFFERS se agregue expl\u00edcitamente a la ruta syscall_return_via_sysret. A continuaci\u00f3n se muestra CONFIG_PARAVIRT_XXL=y y se aplic\u00f3 este parche: syscall_return_via_sysret: ... \u0026lt;+342\u0026gt;: swapgs \u0026lt;+345\u0026gt;: xchg %ax,%ax \u0026lt;+347\u0026gt;: verw -0x1a2(%rip) \u0026lt;---- -- \u0026lt;+354\u0026gt;: sysretq ]\"}],\"metrics\":{\"cvssMetricV31\":[{\"source\":\"134c704f-9b21-4f2e-91b3-4a467353bcc0\",\"type\":\"Secondary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H\",\"attackVector\":\"LOCAL\",\"attackComplexity\":\"LOW\",\"privilegesRequired\":\"LOW\",\"userInteraction\":\"NONE\",\"scope\":\"CHANGED\",\"confidentialityImpact\":\"HIGH\",\"integrityImpact\":\"HIGH\",\"availabilityImpact\":\"HIGH\",\"baseScore\":8.8,\"baseSeverity\":\"HIGH\"},\"exploitabilityScore\":2.0,\"impactScore\":6.0}]},\"weaknesses\":[{\"source\":\"134c704f-9b21-4f2e-91b3-4a467353bcc0\",\"type\":\"Secondary\",\"description\":[{\"lang\":\"en\",\"value\":\"CWE-400\"}]}],\"references\":[{\"url\":\"https://git.kernel.org/stable/c/1424ab4bb386df9cc590c73afa55f13e9b00dea2\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://grsecurity.net/cve-2021-4440_linux_cna_case_study\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}" } }
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.
- 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.