cve-2021-47465
Vulnerability from cvelistv5
Published
2024-05-22 06:23
Modified
2024-11-07 14:41
Summary
KVM: PPC: Book3S HV: Fix stack handling in idle_kvm_start_guest()
Impacted products
LinuxLinux
LinuxLinux
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "metrics": [
          {
            "cvssV3_1": {
              "attackComplexity": "LOW",
              "attackVector": "LOCAL",
              "availabilityImpact": "HIGH",
              "baseScore": 7.1,
              "baseSeverity": "HIGH",
              "confidentialityImpact": "NONE",
              "integrityImpact": "HIGH",
              "privilegesRequired": "LOW",
              "scope": "UNCHANGED",
              "userInteraction": "NONE",
              "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H",
              "version": "3.1"
            }
          },
          {
            "other": {
              "content": {
                "id": "CVE-2021-47465",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2024-05-29T18:41:27.701748Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "problemTypes": [
          {
            "descriptions": [
              {
                "description": "CWE-noinfo Not enough information",
                "lang": "en",
                "type": "CWE"
              }
            ]
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2024-11-07T14:41:05.510Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      },
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-04T05:39:59.601Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/80bbb0bc3a0288442f7fe6fc514f4ee1cb06ccb7"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/fbd724c49bead048ae9fc1a5b7bff2fb3e54f855"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/6d077c37c4643394b1bae9682da48164fc147ea8"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/9b4416c5095c20e110c82ae602c254099b83b72f"
          }
        ],
        "title": "CVE Program Container"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "arch/powerpc/kvm/book3s_hv_rmhandlers.S"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "80bbb0bc3a02",
              "status": "affected",
              "version": "10d91611f426",
              "versionType": "git"
            },
            {
              "lessThan": "fbd724c49bea",
              "status": "affected",
              "version": "10d91611f426",
              "versionType": "git"
            },
            {
              "lessThan": "6d077c37c464",
              "status": "affected",
              "version": "10d91611f426",
              "versionType": "git"
            },
            {
              "lessThan": "9b4416c5095c",
              "status": "affected",
              "version": "10d91611f426",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "arch/powerpc/kvm/book3s_hv_rmhandlers.S"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "5.2"
            },
            {
              "lessThan": "5.2",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.4.*",
              "status": "unaffected",
              "version": "5.4.156",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.10.*",
              "status": "unaffected",
              "version": "5.10.76",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.14.*",
              "status": "unaffected",
              "version": "5.14.15",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "5.15",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nKVM: PPC: Book3S HV: Fix stack handling in idle_kvm_start_guest()\n\nIn commit 10d91611f426 (\"powerpc/64s: Reimplement book3s idle code in\nC\") kvm_start_guest() became idle_kvm_start_guest(). The old code\nallocated a stack frame on the emergency stack, but didn\u0027t use the\nframe to store anything, and also didn\u0027t store anything in its caller\u0027s\nframe.\n\nidle_kvm_start_guest() on the other hand is written more like a normal C\nfunction, it creates a frame on entry, and also stores CR/LR into its\ncallers frame (per the ABI). The problem is that there is no caller\nframe on the emergency stack.\n\nThe emergency stack for a given CPU is allocated with:\n\n  paca_ptrs[i]-\u003eemergency_sp = alloc_stack(limit, i) + THREAD_SIZE;\n\nSo emergency_sp actually points to the first address above the emergency\nstack allocation for a given CPU, we must not store above it without\nfirst decrementing it to create a frame. This is different to the\nregular kernel stack, paca-\u003ekstack, which is initialised to point at an\ninitial frame that is ready to use.\n\nidle_kvm_start_guest() stores the backchain, CR and LR all of which\nwrite outside the allocation for the emergency stack. It then creates a\nstack frame and saves the non-volatile registers. Unfortunately the\nframe it creates is not large enough to fit the non-volatiles, and so\nthe saving of the non-volatile registers also writes outside the\nemergency stack allocation.\n\nThe end result is that we corrupt whatever is at 0-24 bytes, and 112-248\nbytes above the emergency stack allocation.\n\nIn practice this has gone unnoticed because the memory immediately above\nthe emergency stack happens to be used for other stack allocations,\neither another CPUs mc_emergency_sp or an IRQ stack. See the order of\ncalls to irqstack_early_init() and emergency_stack_init().\n\nThe low addresses of another stack are the top of that stack, and so are\nonly used if that stack is under extreme pressue, which essentially\nnever happens in practice - and if it did there\u0027s a high likelyhood we\u0027d\ncrash due to that stack overflowing.\n\nStill, we shouldn\u0027t be corrupting someone else\u0027s stack, and it is purely\nluck that we aren\u0027t corrupting something else.\n\nTo fix it we save CR/LR into the caller\u0027s frame using the existing r1 on\nentry, we then create a SWITCH_FRAME_SIZE frame (which has space for\npt_regs) on the emergency stack with the backchain pointing to the\nexisting stack, and then finally we switch to the new frame on the\nemergency stack."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2024-11-04T12:06:28.290Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/80bbb0bc3a0288442f7fe6fc514f4ee1cb06ccb7"
        },
        {
          "url": "https://git.kernel.org/stable/c/fbd724c49bead048ae9fc1a5b7bff2fb3e54f855"
        },
        {
          "url": "https://git.kernel.org/stable/c/6d077c37c4643394b1bae9682da48164fc147ea8"
        },
        {
          "url": "https://git.kernel.org/stable/c/9b4416c5095c20e110c82ae602c254099b83b72f"
        }
      ],
      "title": "KVM: PPC: Book3S HV: Fix stack handling in idle_kvm_start_guest()",
      "x_generator": {
        "engine": "bippy-9e1c9544281a"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2021-47465",
    "datePublished": "2024-05-22T06:23:25.027Z",
    "dateReserved": "2024-05-22T06:20:56.198Z",
    "dateUpdated": "2024-11-07T14:41:05.510Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2021-47465\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-05-22T07:15:11.367\",\"lastModified\":\"2024-11-07T15:35:01.090\",\"vulnStatus\":\"Awaiting Analysis\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nKVM: PPC: Book3S HV: Fix stack handling in idle_kvm_start_guest()\\n\\nIn commit 10d91611f426 (\\\"powerpc/64s: Reimplement book3s idle code in\\nC\\\") kvm_start_guest() became idle_kvm_start_guest(). The old code\\nallocated a stack frame on the emergency stack, but didn\u0027t use the\\nframe to store anything, and also didn\u0027t store anything in its caller\u0027s\\nframe.\\n\\nidle_kvm_start_guest() on the other hand is written more like a normal C\\nfunction, it creates a frame on entry, and also stores CR/LR into its\\ncallers frame (per the ABI). The problem is that there is no caller\\nframe on the emergency stack.\\n\\nThe emergency stack for a given CPU is allocated with:\\n\\n  paca_ptrs[i]-\u003eemergency_sp = alloc_stack(limit, i) + THREAD_SIZE;\\n\\nSo emergency_sp actually points to the first address above the emergency\\nstack allocation for a given CPU, we must not store above it without\\nfirst decrementing it to create a frame. This is different to the\\nregular kernel stack, paca-\u003ekstack, which is initialised to point at an\\ninitial frame that is ready to use.\\n\\nidle_kvm_start_guest() stores the backchain, CR and LR all of which\\nwrite outside the allocation for the emergency stack. It then creates a\\nstack frame and saves the non-volatile registers. Unfortunately the\\nframe it creates is not large enough to fit the non-volatiles, and so\\nthe saving of the non-volatile registers also writes outside the\\nemergency stack allocation.\\n\\nThe end result is that we corrupt whatever is at 0-24 bytes, and 112-248\\nbytes above the emergency stack allocation.\\n\\nIn practice this has gone unnoticed because the memory immediately above\\nthe emergency stack happens to be used for other stack allocations,\\neither another CPUs mc_emergency_sp or an IRQ stack. See the order of\\ncalls to irqstack_early_init() and emergency_stack_init().\\n\\nThe low addresses of another stack are the top of that stack, and so are\\nonly used if that stack is under extreme pressue, which essentially\\nnever happens in practice - and if it did there\u0027s a high likelyhood we\u0027d\\ncrash due to that stack overflowing.\\n\\nStill, we shouldn\u0027t be corrupting someone else\u0027s stack, and it is purely\\nluck that we aren\u0027t corrupting something else.\\n\\nTo fix it we save CR/LR into the caller\u0027s frame using the existing r1 on\\nentry, we then create a SWITCH_FRAME_SIZE frame (which has space for\\npt_regs) on the emergency stack with the backchain pointing to the\\nexisting stack, and then finally we switch to the new frame on the\\nemergency stack.\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: KVM: PPC: Book3S HV: Arreglar el manejo de la pila en idle_kvm_start_guest() En el commit 10d91611f426 (\\\"powerpc/64s: Reimplementar el c\u00f3digo inactivo de book3s en C\\\") kvm_start_guest() se convirti\u00f3 en idle_kvm_start_guest() . El c\u00f3digo antiguo asignaba un marco de pila en la pila de emergencia, pero no usaba el marco para almacenar nada y tampoco almacenaba nada en el marco de la persona que llama. idle_kvm_start_guest(), por otro lado, se escribe m\u00e1s como una funci\u00f3n C normal, crea un marco al ingresar y tambi\u00e9n almacena CR/LR en el marco de la persona que llama (seg\u00fan la ABI). El problema es que no hay ning\u00fan marco de llamada en la pila de emergencia. La pila de emergencia para una CPU determinada se asigna con: paca_ptrs[i]-\u0026gt;emergency_sp = alloc_stack(limit, i) + THREAD_SIZE; Entonces, Emergency_sp en realidad apunta a la primera direcci\u00f3n encima de la asignaci\u00f3n de pila de emergencia para una CPU determinada; no debemos almacenar encima de ella sin primero disminuirla para crear un marco. Esto es diferente a la pila normal del kernel, paca-\u0026gt;kstack, que se inicializa para apuntar a un marco inicial que est\u00e1 listo para usar. idle_kvm_start_guest() almacena la cadena posterior, CR y LR, todos los cuales escriben fuera de la asignaci\u00f3n para la pila de emergencia. Luego crea un marco de pila y guarda los registros no vol\u00e1tiles. Desafortunadamente, el marco que crea no es lo suficientemente grande para acomodar los registros no vol\u00e1tiles, por lo que guardar los registros no vol\u00e1tiles tambi\u00e9n escribe fuera de la asignaci\u00f3n de pila de emergencia. El resultado final es que corrompemos todo lo que est\u00e9 entre 0 y 24 bytes y entre 112 y 248 bytes por encima de la asignaci\u00f3n de pila de emergencia. En la pr\u00e1ctica, esto ha pasado desapercibido porque la memoria inmediatamente encima de la pila de emergencia se usa para otras asignaciones de pila, ya sea otra CPU mc_emergency_sp o una pila IRQ. Vea el orden de las llamadas a irqstack_early_init() y Emergency_stack_init(). Las direcciones bajas de otra pila est\u00e1n en la parte superior de esa pila, por lo que solo se usan si esa pila est\u00e1 bajo una presi\u00f3n extrema, lo que esencialmente nunca sucede en la pr\u00e1ctica, y si as\u00ed fuera, existe una alta probabilidad de que fallemos debido a que esa pila se desborde. . A\u00fan as\u00ed, no deber\u00edamos estar corrompiendo la pila de otra persona, y es pura suerte que no estemos corrompiendo algo m\u00e1s. Para solucionarlo, guardamos CR/LR en el marco de la persona que llama usando el r1 existente en la entrada, luego creamos un marco SWITCH_FRAME_SIZE (que tiene espacio para pt_regs) en la pila de emergencia con la cadena posterior apuntando a la pila existente, y finalmente cambiamos al nuevo marco en la pila de emergencia.\"}],\"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:U/C:N/I:H/A:H\",\"attackVector\":\"LOCAL\",\"attackComplexity\":\"LOW\",\"privilegesRequired\":\"LOW\",\"userInteraction\":\"NONE\",\"scope\":\"UNCHANGED\",\"confidentialityImpact\":\"NONE\",\"integrityImpact\":\"HIGH\",\"availabilityImpact\":\"HIGH\",\"baseScore\":7.1,\"baseSeverity\":\"HIGH\"},\"exploitabilityScore\":1.8,\"impactScore\":5.2}]},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/6d077c37c4643394b1bae9682da48164fc147ea8\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/80bbb0bc3a0288442f7fe6fc514f4ee1cb06ccb7\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/9b4416c5095c20e110c82ae602c254099b83b72f\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/fbd724c49bead048ae9fc1a5b7bff2fb3e54f855\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading...

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.