From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94A274908C4 for ; Fri, 25 Sep 2026 10:25:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790331940; cv=none; b=ty6BmdiSKFlklC59j9JHQV5AMiJaRpUEz3D1Uga8ytScH0/xESF9p9vYY0J8pNfe/5B3zByTG5tPTYvD2SavIG9OvgQ1zrAuibSlN72GQn01/N19ldN2kIE35Q5CbyFRVtKBe89gYO4lp07tN96Dwncztx57e+v9ggEUwoHYA2o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790331940; c=relaxed/simple; bh=a6wcuT91sCSTHwPUKGIx+byMXOBwkeRaRkFM/MoHx7M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=E9Y7l0kBQD6Y/XpQa7XP/NJ5C2TNsfBABSik27hiTWZ+LIEqAkOSN24ft1qtVlk2n3gsy5ZvEGzLzcIljO2GnDoM5wROqEhn+bO/UyPkKvJc1Yy3KFIej5VQ5caaGwJPwufdxIgl+jLNYQBmdV6qZoJ9ZGekG0qvKDmtFkYkvMA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=e1y6oVNi; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="e1y6oVNi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DE9B1F000FF; Fri, 25 Sep 2026 10:25:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790331938; bh=r4ER8isRac6J5jp5FclnEKcLk9PeJZaVjTfd3NB3iaQ=; h=From:To:Cc:Subject:Date:Reply-To; b=e1y6oVNitrcq+JFr0SbTs/ylQjSfWrA32iV/cYnaU2mq3lQEQBWJpevmRg4LbyJvK WfKxIdwmsAdLXEdaKI/uwH2j9XEX3c/O2WX258hFIFL0sxUYOJ71c0UUusAIHmyqEx RRfZCJkNkhWl9LwMcQnKiVNn95qqmC7k/lUJlV0U= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-97587: perf: RISC-V: store available counter mask as bitmap Date: Fri, 25 Sep 2026 12:22:47 +0200 Message-ID: <2026092557-CVE-2026-97587-d030@gregkh> X-Mailer: git-send-email 2.55.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2993; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=YLu8Ayn+npDza6Rk81r/ZidSbwS2gAHWT5Z7EQP2Rn4=; b=owGbwMvMwCRo6H6F97bub03G02pJDFnbvF2ZBc6uueC9LlpXUH335IpPbUXHqv2CuyVZC99/U Du/ZIZ0RywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEwks5lhwfKyAx3NVgLbZh20 /xxZ6+OeYRqtyjA/VXxq8LQQgXbVgO2fz8xe6mDCIdgAAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== 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] The Linux kernel CVE team has assigned CVE-2026-97587 to this issue. Affected and fixed versions =========================== Issue introduced in 5.18 with commit e9991434596f5373dfd75857b445eb92a9253c56 and fixed in 6.12.111 with commit 143668c424772979a45118dc9cc9c2c13a35f41d Issue introduced in 5.18 with commit e9991434596f5373dfd75857b445eb92a9253c56 and fixed in 6.18.53 with commit 9bec7beaed074bcae4181fde9ff9dfbe4e7b0957 Issue introduced in 5.18 with commit e9991434596f5373dfd75857b445eb92a9253c56 and fixed in 7.2.7 with commit e5481db31f4654e9a1254d5d467d9b1ff2f8b1cb Issue introduced in 5.18 with commit e9991434596f5373dfd75857b445eb92a9253c56 and fixed in 7.3-rc3 with commit 6809da6e9c08ccc9a09cb0a48c61471679274aaa Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2026-97587 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/perf/riscv_pmu_legacy.c drivers/perf/riscv_pmu_sbi.c include/linux/perf/riscv_pmu.h Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/143668c424772979a45118dc9cc9c2c13a35f41d https://git.kernel.org/stable/c/9bec7beaed074bcae4181fde9ff9dfbe4e7b0957 https://git.kernel.org/stable/c/e5481db31f4654e9a1254d5d467d9b1ff2f8b1cb https://git.kernel.org/stable/c/6809da6e9c08ccc9a09cb0a48c61471679274aaa