{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2026-97496",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2026-97496"
  ],
  "published": "2026-09-24T16:08:25Z",
  "summary": "drm/amdkfd: Fix OOB memory exposure in get_wave_state()",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\ndrm/amdkfd: Fix OOB memory exposure in get_wave_state()\n\nThe get_wave_state() function for v9 trusts cp_hqd_cntl_stack_size and\ncp_hqd_cntl_stack_offset values read directly from the MQD, which are\nwritten by GPU microcode and fully attacker-controlled on the\nCRIU-restore path (via AMDKFD_IOC_RESTORE_PROCESS with H3).\n\nthis leads to an unbounded copy_to_user() that can leak adjacent\nGTT/kernel memory. If offset > size, integer underflow produces a ~4 GiB\nread length, if size is set to 1 MiB against a 4 KiB allocation, we leak\n1 MiB of adjacent kernel memory (other queues' MQDs, ring buffers, KASLR\npointers).\n\nFix by clamping both cp_hqd_cntl_stack_size to the actual allocated\nbuffer size (q->ctl_stack_size) and cp_hqd_cntl_stack_offset to the\nclamped size before performing arithmetic and copy_to_user().\n\nThis ensures we never read beyond the allocated kernel BO regardless of\nattacker-supplied MQD field values.",
  "severity": [
    {
      "type": "CVSS_V3",
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H"
    }
  ],
  "affected": [
    {
      "package": {
        "ecosystem": "Raspberry Pi OS:12",
        "name": "linux"
      },
      "versions": [
        "1:6.1.47-1+rpt4"
      ],
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-2712",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v6",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v7",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v7l",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v8",
            "binary_version": "1:6.1.47-1+rpt4"
          }
        ]
      },
      "database_specific": {
        "per_version": {
          "1:6.1.47-1+rpt4": {
            "linux_commit": "655fc658a15ae7a6f37103754adb39ba52a9a14e",
            "upstream_version": "6.1.47",
            "assessment": "commit ancestry (strak rule)",
            "upstream_fixed": null,
            "compiled_filter": false
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2026-97496"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/e2bef0f168be46692a6b900916ff5da3771480ed"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/d9183d974ddd5f09d029beaf359275ac20d4d5fe"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/ec646686613d8ab05b282d1463a7baa49fd6b83b"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/7ef144458f48d5589e36f1b3d83e83db2e5c5ba5"
    }
  ],
  "database_specific": {
    "source": "https://git.kernel.org/pub/scm/linux/security/vulns.git",
    "upstream_modified": "2026-10-03T11:04:09Z",
    "severity": {
      "source": "kernel CNA",
      "cvss_v3_score": 7.1,
      "cvss_v3_severity": "High",
      "scenario": "AV:L - Attacker-controlled cp_hqd_cntl_stack_size/offset enter via AMDKFD_IOC_CRIU_OP KFD_CRIU_OP_RESTORE (kfd_ioctl_criu \u2192 criu_restore \u2192 kfd_criu_restore_queue \u2192 restore_mqd memcpy of the user MQD), then v9 get_wave_state() runs from kfd_ioctl_get_queue_wave_state (AMDKFD_IOC_GET_QUEUE_WAVE_STATE) on /dev/kfd; no remote protocol carries those fields.\nAC:L - restore_mqd() installs the crafted MQD then sets qp->is_active=0, so AMDKFD_IOC_GET_QUEUE_WAVE_STATE deterministically passes dqm get_wave_state()'s !is_active and cwsr_enabled checks (cwsr_enable defaults to 1) and v9 get_wave_state() copy_to_user()s using unclamped size-offset; no race or firmware quirk is required.\nPR:L - AMDKFD_IOC_GET_QUEUE_WAVE_STATE has ioctl flags 0, but the MQD size/offset that make get_wave_state() over-read are attacker-controlled only after KFD_CRIU_OP_RESTORE; kfd_ioctl() admits that op only with capable(CAP_CHECKPOINT_RESTORE) or capable(CAP_SYS_ADMIN), a delegated non-root cap routinely granted to CRIU/container checkpoint services.\nUI:N - The attacker opens /dev/kfd and issues KFD_CRIU_OP_RESTORE then AMDKFD_IOC_GET_QUEUE_WAVE_STATE against its own KFD process; no other user must mount a filesystem, open a file, or otherwise interact.\nS:U - The unbounded copy_to_user() from the kernel MQD control-stack BO in v9 get_wave_state() discloses host kernel/GTT memory inside the same kernel security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - Pre-fix v9 get_wave_state() copy_to_user()s (cp_hqd_cntl_stack_size - cp_hqd_cntl_stack_offset) bytes from mqd+AMDGPU_GPU_PAGE_SIZE without clamping to q->ctl_stack_size, so a restored 1MiB size against a 4KiB allocate_mqd() BO (or offset>size underflow to ~4GiB) dumps adjacent GTT/kernel memory including other MQDs and KASLR pointers.\nI:N - The defective operation is copy_to_user() from the kernel control-stack BO to the caller's ctl_stack_address; restore_mqd() writes only sizeof(struct v9_mqd) plus ctl_stack_size into the buffer allocate_mqd() sized from q->ctl_stack_size, so this bug does not modify kernel memory out of bounds.\nA:H - A restored cp_hqd_cntl_stack_size of ~1MiB or an offset>size underflow to ~4GiB makes get_wave_state() copy_to_user() walk off the small kmap/vmap GTT/VRAM BO into unmapped kernel VA (and can trip CONFIG_HARDENED_USERCOPY), producing a kernel oops."
    }
  }
}
