{"id":"CVE-2026-97587","summary":"perf: RISC-V: store available counter mask as bitmap","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nperf: RISC-V: store available counter mask as bitmap\n\nThe available-counter mask was a single unsigned long, but iteration\nuses RISCV_MAX_COUNTERS, which is 64. On RV32 that reads past the object.\nFilling with an unsigned-long bit at index 32 and above is also wrong.\n\nUse DECLARE_BITMAP and set_bit/bitmap helpers. Walk each bitmap word\ninto CFG_MATCH when checking events, when allocating an index, and when\nstopping all counters. Set the counter base to i times BITS_PER_LONG.\nShare the CFG_MATCH ecall through a small helper so the 32-bit argument\nsplit is not duplicated. On qemu-system-riscv32 the probe bitmap has bits\nabove XLEN set, so the first word alone is not enough.\n\n[pjw@kernel.org: updated to apply; fixed checkpatch.pl issues]","modified":"2026-09-27T03:47:31.010739313Z","published":"2026-09-25T10:22:06.177Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/97xxx/CVE-2026-97587.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/143668c424772979a45118dc9cc9c2c13a35f41d"},{"type":"WEB","url":"https://git.kernel.org/stable/c/6809da6e9c08ccc9a09cb0a48c61471679274aaa"},{"type":"WEB","url":"https://git.kernel.org/stable/c/9bec7beaed074bcae4181fde9ff9dfbe4e7b0957"},{"type":"WEB","url":"https://git.kernel.org/stable/c/e5481db31f4654e9a1254d5d467d9b1ff2f8b1cb"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/97xxx/CVE-2026-97587.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-97587"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"e9991434596f5373dfd75857b445eb92a9253c56"},{"fixed":"143668c424772979a45118dc9cc9c2c13a35f41d"},{"fixed":"9bec7beaed074bcae4181fde9ff9dfbe4e7b0957"},{"fixed":"e5481db31f4654e9a1254d5d467d9b1ff2f8b1cb"},{"fixed":"6809da6e9c08ccc9a09cb0a48c61471679274aaa"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-97587.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.18.0"},{"fixed":"6.12.111"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.53"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.2.7"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-97587.json"}}],"schema_version":"1.9.0"}