{
  "cveId": "CVE-2021-47465",
  "url": "https://patchblox.com/security/cve/CVE-2021-47465",
  "summary": "CVE-2021-47465 is fixed in linux on 1 platform, first by DEBIAN-CVE-2021-47465, released May 22, 2024. It is not reported as exploited. Patch Radar priority: Routine.",
  "title": "linux: In the Linux kernel, the following vulnerability has been resolved:  KVM: PPC: Book3S HV: Fix stack handling in idle_...",
  "description": "In the Linux kernel, the following vulnerability has been resolved:  KVM: PPC: Book3S HV: Fix stack handling in idle_kvm_start_guest()  In commit 10d91611f426 (\u0022powerpc/64s: Reimplement book3s idle code in C\u0022) kvm_start_guest() became idle_kvm_start_guest(). The old code allocated a stack frame on the emergency stack, but didn\u0027t use the frame to store anything, and also didn\u0027t store anything in its caller\u0027s frame.  idle_kvm_start_guest() on the other hand is written more like a normal C function, it creates a frame on entry, and also stores CR/LR into its callers frame (per the ABI). The problem is that there is no caller frame on the emergency stack.  The emergency stack for a given CPU is allocated with:    paca_ptrs[i]-\u003Eemergency_sp = alloc_stack(limit, i) \u002B THREAD_SIZE;  So emergency_sp actually points to the first address above the emergency stack allocation for a given CPU, we must not store above it without first decrementing it to create a frame. This is different to the regular kernel stack, paca-\u003Ekstack, which is initialised to point at an initial frame that is ready to use.  idle_kvm_start_guest() stores the backchain, CR and LR all of which write outside the allocation for the emergency stack. It then creates a stack frame and saves the non-volatile registers. Unfortunately the frame it creates is not large enough to fit the non-volatiles, and so the saving of the non-volatile registers also writes outside the emergency stack allocation.  The end result is that we corrupt whatever is at 0-24 bytes, and 112-248 bytes above the emergency stack allocation.  In practice this has gone unnoticed because the memory immediately above the emergency stack happens to be used for other stack allocations, either another CPUs mc_emergency_sp or an IRQ stack. See the order of calls to irqstack_early_init() and emergency_stack_init().  The low addresses of another stack are the top of that stack, and so are only used if that stack is under extreme pressue, which essentially never happens in practice - and if it did there\u0027s a high likelyhood we\u0027d crash due to that stack overflowing.  Still, we shouldn\u0027t be corrupting someone else\u0027s stack, and it is purely luck that we aren\u0027t corrupting something else.  To fix it we save CR/LR into the caller\u0027s frame using the existing r1 on entry, we then create a SWITCH_FRAME_SIZE frame (which has space for pt_regs) on the emergency stack with the backchain pointing to the existing stack, and then finally we switch to the new frame on the emergency stack.",
  "published": "2024-05-22T07:15:11Z",
  "severity": "medium",
  "cvss": 5.5,
  "cvssVector": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
  "epss": 0.00224,
  "epssPercentile": 0.13122,
  "priority": "Routine",
  "priorityTier": 4,
  "exploited": false,
  "vendorExploited": false,
  "disclosed": false,
  "fixes": [
    {
      "platform": "linux",
      "product": "linux",
      "release": "Debian 12.15 (bookworm)",
      "fixedVersion": "5.14.16-1",
      "fix": "DEBIAN-CVE-2021-47465",
      "url": "https://patchblox.com/security/fix/linux/debian-cve-2021-47465",
      "released": "2024-05-22T07:15:11Z"
    },
    {
      "platform": "linux",
      "product": "linux",
      "release": "Debian 13.5 (trixie)",
      "fixedVersion": "5.14.16-1",
      "fix": "DEBIAN-CVE-2021-47465",
      "url": "https://patchblox.com/security/fix/linux/debian-cve-2021-47465",
      "released": "2024-05-22T07:15:11Z"
    },
    {
      "platform": "linux",
      "product": "linux",
      "release": "Debian 14",
      "fixedVersion": "5.14.16-1",
      "fix": "DEBIAN-CVE-2021-47465",
      "url": "https://patchblox.com/security/fix/linux/debian-cve-2021-47465",
      "released": "2024-05-22T07:15:11Z"
    }
  ],
  "noFixYet": [],
  "dataAsOf": "2026-11-08T00:53:09Z",
  "attribution": {
    "text": "Data: Patchblox Patch Radar",
    "url": "https://patchblox.com/security/patch-radar",
    "terms": "https://patchblox.com/security/patch-radar/use-the-data"
  }
}