Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 96CD12798F8 for ; Sat, 4 Oct 2025 15:54:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759593297; cv=none; b=Cujc1kuFbC7wzZyc1Tspf+BYcoc/7+wzmh6GbtY/pqSE1maddYOU9HVDyBOdyKbHG5wfrWQknej3MiZy6qEGjmTkpnaSF1VDoh3kbbXFOGvRUtxDRVcBHts7oQA93Z/K9bgNDwi0/xvlDv1SVJjoowVlsfijs4Z0Y2V6oYvVrbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759593297; c=relaxed/simple; bh=cHEwIqDuqIoHTo4TUOhDTRssYI9vglfHz71QKR9pXJ4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cTCVHvx/Y5O4xiJIh1ta1Fc1zyA6bCNhVTLNxOH/ps+4T13KTpblJ91BnVL0WpNmfPmOpMlrkYMP8iqDT6iTn9mecsNb+sWXITao8q7aUBBgwUvo7dcln/iymoceMv806iDgzdc0Z1BagJ1FmJvm793cPIdakFcHmgKyKzey3aE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BBjIGtTx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BBjIGtTx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2055EC4CEF1; Sat, 4 Oct 2025 15:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759593297; bh=cHEwIqDuqIoHTo4TUOhDTRssYI9vglfHz71QKR9pXJ4=; h=From:To:Cc:Subject:Date:Reply-to:From; b=BBjIGtTxUSfR/cnnLw7vDGCZG4TxgPTi2HTKhA97cnQBWAsATam/w6fLWFZReANOg eQfe8GrvkokWXZa9qqq1Ot3CtWKCi5OaK85fIU0juMvYoXtFiKAZDDMQ21wx+Spd3U HGn/17RRk0/sOdnFHx5gldvBmn4VjRBUs57Eir8Q= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-53583: perf: RISC-V: Remove PERF_HES_STOPPED flag checking in riscv_pmu_start() Date: Sat, 4 Oct 2025 17:51:37 +0200 Message-ID: <2025100424-CVE-2023-53583-b831@gregkh> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=5004; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=uwD3u3OY9bQ3zcJIcU3URLB2d+OhFO+arwd3+Z7R9AI=; b=owGbwMvMwCRo6H6F97bub03G02pJDBkPnWp6at9xN+wSFznEsJ27KaEi7Dej6uYZ9vcfMvXnv 9VKu+fWEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABNxVmJYcPPZv+WZbgxvTfPE /n2pvWsZdzy9mGHBDc11AW+/uthdeLr9ps/GNIcVFe7/AA== 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: Remove PERF_HES_STOPPED flag checking in riscv_pmu_start() Since commit 096b52fd2bb4 ("perf: RISC-V: throttle perf events") the perf_sample_event_took() function was added to report time spent in overflow interrupts. If the interrupt takes too long, the perf framework will lower the sysctl_perf_event_sample_rate and max_samples_per_tick. When hwc->interrupts is larger than max_samples_per_tick, the hwc->interrupts will be set to MAX_INTERRUPTS, and events will be throttled within the __perf_event_account_interrupt() function. However, the RISC-V PMU driver doesn't call riscv_pmu_stop() to update the PERF_HES_STOPPED flag after perf_event_overflow() in pmu_sbi_ovf_handler() function to avoid throttling. When the perf framework unthrottled the event in the timer interrupt handler, it triggers riscv_pmu_start() function and causes a WARN_ON_ONCE() warning, as shown below: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 240 at drivers/perf/riscv_pmu.c:184 riscv_pmu_start+0x7c/0x8e Modules linked in: CPU: 0 PID: 240 Comm: ls Not tainted 6.4-rc4-g19d0788e9ef2 #1 Hardware name: SiFive (DT) epc : riscv_pmu_start+0x7c/0x8e ra : riscv_pmu_start+0x28/0x8e epc : ffffffff80aef864 ra : ffffffff80aef810 sp : ffff8f80004db6f0 gp : ffffffff81c83750 tp : ffffaf80069f9bc0 t0 : ffff8f80004db6c0 t1 : 0000000000000000 t2 : 000000000000001f s0 : ffff8f80004db720 s1 : ffffaf8008ca1068 a0 : 0000ffffffffffff a1 : 0000000000000000 a2 : 0000000000000001 a3 : 0000000000000870 a4 : 0000000000000000 a5 : 0000000000000000 a6 : 0000000000000840 a7 : 0000000000000030 s2 : 0000000000000000 s3 : ffffaf8005165800 s4 : ffffaf800424da00 s5 : ffffffffffffffff s6 : ffffffff81cc7590 s7 : 0000000000000000 s8 : 0000000000000006 s9 : 0000000000000001 s10: ffffaf807efbc340 s11: ffffaf807efbbf00 t3 : ffffaf8006a16028 t4 : 00000000dbfbb796 t5 : 0000000700000000 t6 : ffffaf8005269870 status: 0000000200000100 badaddr: 0000000000000000 cause: 0000000000000003 [] riscv_pmu_start+0x7c/0x8e [] perf_adjust_freq_unthr_context+0x15e/0x174 [] perf_event_task_tick+0x88/0x9c [] scheduler_tick+0xfe/0x27c [] update_process_times+0x9a/0xba [] tick_sched_handle+0x32/0x66 [] tick_sched_timer+0x64/0xb0 [] __hrtimer_run_queues+0x156/0x2f4 [] hrtimer_interrupt+0xe2/0x1fe [] riscv_timer_interrupt+0x38/0x42 [] handle_percpu_devid_irq+0x90/0x1d2 [] generic_handle_domain_irq+0x28/0x36 After referring other PMU drivers like Arm, Loongarch, Csky, and Mips, they don't call *_pmu_stop() to update with PERF_HES_STOPPED flag after perf_event_overflow() function nor do they add PERF_HES_STOPPED flag checking in *_pmu_start() which don't cause this warning. Thus, it's recommended to remove this unnecessary check in riscv_pmu_start() function to prevent this warning. The Linux kernel CVE team has assigned CVE-2023-53583 to this issue. Affected and fixed versions =========================== Issue introduced in 6.1 with commit 096b52fd2bb4996fd68d22b3b7ad21a1296db9d3 and fixed in 6.1.40 with commit aeb62beaf9cbd0a72e7f97c9af6d3e7f76ce2946 Issue introduced in 6.1 with commit 096b52fd2bb4996fd68d22b3b7ad21a1296db9d3 and fixed in 6.4.5 with commit 8270d539a943d00cf6a094da0073e2b5972b641d Issue introduced in 6.1 with commit 096b52fd2bb4996fd68d22b3b7ad21a1296db9d3 and fixed in 6.5 with commit 66843b14fb71825fdd73ab12f6594f2243b402be 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-2023-53583 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.c 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/aeb62beaf9cbd0a72e7f97c9af6d3e7f76ce2946 https://git.kernel.org/stable/c/8270d539a943d00cf6a094da0073e2b5972b641d https://git.kernel.org/stable/c/66843b14fb71825fdd73ab12f6594f2243b402be