)]}'
{
  "commit": "0dfe6be08778102bf2fde61c5c99ea2cceb0b73a",
  "tree": "7cc03b6013f97ba7d27eb8e5e750c4d0b14b4c44",
  "parents": [
    "cc9b4ef8f3b465f4625ca40bf6af5e033df2bd75"
  ],
  "author": {
    "name": "liutong",
    "email": "liutong@iscas.ac.cn",
    "time": "Sun Jun 28 13:55:09 2026 +0530"
  },
  "committer": {
    "name": "Anup Patel",
    "email": "anup@brainfault.org",
    "time": "Sun Jun 28 14:04:17 2026 +0530"
  },
  "message": "lib: sbi_pmu: fix integer overflow in pmu_ctr_idx_validate\n\npmu_ctr_idx_validate() checks whether counter indices are in range\nusing cbase + sbi_fls(cmask) \u003c total_ctrs.  Both operands are unsigned\nlong, so a crafted cbase close to ULONG_MAX causes the addition to wrap\naround to a small value that passes the comparison.\n\nOnce validation is bypassed, sbi_pmu_ctr_cfg_match() with the\nSKIP_MATCH flag uses the overflowed index directly as an array subscript\ninto phs-\u003eactive_events[], producing an out-of-bounds read in M-mode.\nThrough the firmware-event code path, the same overflowed index reaches\nfw_counters_data[] and fw_counters_started, giving an attacker OOB\nwrite-zero and OOB bit-set primitives in M-mode memory.\n\nFix pmu_ctr_idx_validate() by checking for unsigned overflow before the\ncomparison, and add a secondary bounds check on cidx_first in the\nSKIP_MATCH path so that even if validation is somehow bypassed in the\nfuture, the array access remains bounded.\n\nSigned-off-by: liutong \u003cliutong@iscas.ac.cn\u003e\nReviewed-by: Anup Patel \u003canup@brainfault.org\u003e\nLink: https://lore.kernel.org/r/20260624035049.1753003-1-liutong@iscas.ac.cn\nSigned-off-by: Anup Patel \u003canup@brainfault.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "480a972307a50018d21455cdc707014d3b9abe91",
      "old_mode": 33188,
      "old_path": "lib/sbi/sbi_pmu.c",
      "new_id": "a0f6d2facb0011e11db76a34fa688dfd93e5efcf",
      "new_mode": 33188,
      "new_path": "lib/sbi/sbi_pmu.c"
    }
  ]
}
