perf: RISC-V: store available counter mask as bitmap
In the Linux kernel, the following vulnerability has been resolved: perf: RISC-V: store available counter mask as bitmap The available-counter mask was a single unsigned long, but iteration uses RISCV_MAX_COUNTERS, which is 64. On RV32 that reads past the object. Filling with an unsigned-long bit at index 32 and above is also wrong. Use DECLARE_BITMAP and set_bit/bitmap helpers. Walk each bitmap word into CFG_MATCH when checking events, when allocating an index, and when stopping all counters. Set the counter base to i times BITS_PER_LONG. Share the CFG_MATCH ecall through a small helper so the 32-bit argument split is not duplicated. On qemu-system-riscv32 the probe bitmap has bits above XLEN set, so the first word alone is not enough. [pjw@kernel.org: updated to apply; fixed checkpatch.pl issues]
- Products
- Kernel
- Affected versions
- Not specified
- Fixed versions
- 6.1.191, 6.12.111, 6.18.53, 6.6.160, 7.2.7
- CVEs
- CVE-2026-97587
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 7 Nov 2026, 10:52 UTC · Revision 1
Source evidence
perf: RISC-V: store available counter mask as bitmap
core-osv · Original sourcePublished 25 Sept 2026, 10:22 UTC
In the Linux kernel, the following vulnerability has been resolved: perf: RISC-V: store available counter mask as bitmap The available-counter mask was a single unsigned long, but iteration uses RISCV_MAX_COUNTERS, which is 64. On RV32 that reads past the object. Filling with an unsigned-long bit at index 32 and above is also wrong. Use DECLARE_BITMAP and set_bit/bitmap helpers. Walk each bitmap word into CFG_MATCH when checking events, when allocating an index, and when stopping all counters. Set the counter base to i times BITS_PER_LONG. Share the CFG_MATCH ecall through a small helper so the 32-bit argument split is not duplicated. On qemu-system-riscv32 the probe bitmap has bits above XLEN set, so the first word alone is not enough. [pjw@kernel.org: updated to apply; fixed checkpatch.pl issues]
osv:CVE-2026-97587
Kernel
Fixed versions: 6.1.191, 6.6.160, 6.12.111, 6.18.53, 7.2.7
Complete source record
{
"id": "481c348e2cf32eff98760f1cd5b11f15a3e397e5564cab64d3ae86a572820221",
"url": "https://osv.dev/vulnerability/CVE-2026-97587",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "perf: RISC-V: store available counter mask as bitmap",
"summary": "In the Linux kernel, the following vulnerability has been resolved: perf: RISC-V: store available counter mask as bitmap The available-counter mask was a single unsigned long, but iteration uses RISCV_MAX_COUNTERS, which is 64. On RV32 that reads past the object. Filling with an unsigned-long bit at index 32 and above is also wrong. Use DECLARE_BITMAP and set_bit/bitmap helpers. Walk each bitmap word into CFG_MATCH when checking events, when allocating an index, and when stopping all counters. Set the counter base to i times BITS_PER_LONG. Share the CFG_MATCH ecall through a small helper so the 32-bit argument split is not duplicated. On qemu-system-riscv32 the probe bitmap has bits above XLEN set, so the first word alone is not enough. [pjw@kernel.org: updated to apply; fixed checkpatch.pl issues]",
"evidence": "osv:CVE-2026-97587",
"products": [
{
"name": {
"value": "Kernel",
"evidence": "/affected/1/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "6.1.191",
"evidence": "/affected/1/ranges"
},
{
"value": "6.6.160",
"evidence": "/affected/1/ranges"
},
{
"value": "6.12.111",
"evidence": "/affected/1/ranges"
},
{
"value": "6.18.53",
"evidence": "/affected/1/ranges"
},
{
"value": "7.2.7",
"evidence": "/affected/1/ranges"
}
],
"affected_versions": []
}
],
"severity": "unknown",
"structured": {
"id": "CVE-2026-97587",
"aliases": [
"CVE-2026-97587"
],
"affected": [
{
"ranges": [
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "e9991434596f5373dfd75857b445eb92a9253c56"
},
{
"fixed": "433249a4de52ecda40ffa9c466cec1312e62826f"
},
{
"fixed": "5a1b6379eed5b13eac0228b605b0bed988e547e9"
},
{
"fixed": "143668c424772979a45118dc9cc9c2c13a35f41d"
},
{
"fixed": "9bec7beaed074bcae4181fde9ff9dfbe4e7b0957"
},
{
"fixed": "e5481db31f4654e9a1254d5d467d9b1ff2f8b1cb"
},
{
"fixed": "6809da6e9c08ccc9a09cb0a48c61471679274aaa"
}
]
}
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-97587.json"
}
},
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "5.18.0"
},
{
"fixed": "6.1.191"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.2.0"
},
{
"fixed": "6.6.160"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.7.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"
}
]
}
],
"package": {
"name": "Kernel",
"ecosystem": "Linux"
},
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-97587.json"
}
}
],
"modified": "2026-11-01T02:30:52.750962867Z",
"provider": "osv",
"references": [
"https://git.kernel.org/stable/c/143668c424772979a45118dc9cc9c2c13a35f41d",
"https://git.kernel.org/stable/c/433249a4de52ecda40ffa9c466cec1312e62826f",
"https://git.kernel.org/stable/c/5a1b6379eed5b13eac0228b605b0bed988e547e9",
"https://git.kernel.org/stable/c/6809da6e9c08ccc9a09cb0a48c61471679274aaa",
"https://git.kernel.org/stable/c/9bec7beaed074bcae4181fde9ff9dfbe4e7b0957",
"https://git.kernel.org/stable/c/e5481db31f4654e9a1254d5d467d9b1ff2f8b1cb",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/97xxx/CVE-2026-97587.json",
"https://nvd.nist.gov/vuln/detail/CVE-2026-97587",
"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
],
"provider_metadata": {
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/97xxx/CVE-2026-97587.json"
}
},
"related_cves": [
{
"value": "CVE-2026-97587",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": null
},
"source_id": "core-osv",
"document_id": 519055,
"published_at": "2026-09-25T10:22:06.177+00:00"
}