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 B9B65303A0A for ; Wed, 12 Nov 2025 10:24:30 +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=1762943070; cv=none; b=Z46Va73VhVvvr5NRji8I80zsUgElqwH93BsK7mQJsUHS6mVf+LW07/7BkYrth8Iqmx9yIkpV/dnfxeMdTZ5b4zkoH5FuNUVX8FIwkmP/gpJVDgLwcPiPn4cxo+IJlLgtlqnzTmoeVfqwGzSh0/PmzwE8YH0uUvAu1jH2EQG9Hu0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762943070; c=relaxed/simple; bh=l1gNKnjPcNmV7okMCK7BiYerKNEj83VFuqEdRlMaD14=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YGuSza+qnUu5uI3YsaXsST5hukRrsvLPvAPQItAm+H5Xo8ADlv3PGPQBqYusefFqk5Dp5U2CRNECX4D3qzaUFcgpdipjo/nmBUbu7HBCFtCXuZZ51+j/yhY4aRd2IPdvOrOObrQ86g2Lw9gXA7t/GB+DUHFLtjGR1xNCtkRWtB0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FyEICEGs; 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="FyEICEGs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7123CC4CEF8; Wed, 12 Nov 2025 10:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1762943070; bh=l1gNKnjPcNmV7okMCK7BiYerKNEj83VFuqEdRlMaD14=; h=From:To:Cc:Subject:Date:Reply-to:From; b=FyEICEGsg5xLNtXtQoV24g8Mtxhr8dPqdQKiqDQ1p9Fb2KyzeP7e1mM1rNDTrN8fY 8Tym8N/oNrl+1IirkR4mhcGu4XoYHJov1L8eBND4L6kuVS1f1aQCOV5TMA1GIxAl6P gtGSBRwRYH0UqAaLZO887BO8c//oQXE8g+mVv8bY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-40122: perf/x86/intel: Fix IA32_PMC_x_CFG_B MSRs access error Date: Wed, 12 Nov 2025 19:23:58 +0900 Message-ID: <2025111252-CVE-2025-40122-6893@gregkh> X-Mailer: git-send-email 2.51.2 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=4582; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=vyRJNe+8hzC3XWCcNQ5iy8odNc4hwYboaAhdMsE2fX4=; b=owGbwMvMwCRo6H6F97bub03G02pJDJkiCRaV80/H1z1/uknf9GTEvdIABvllopOiC7WSbgfVq ZqZuGt3xLIwCDIxyIopsnzZxnN0f8UhRS9D29Mwc1iZQIYwcHEKwEQub2SYn/JIbaZArUJQvsXK +Hl5bpf+PRZgZpjNVmIZVDYruvrt61f7O49Pa/v2/MNdAA== 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/x86/intel: Fix IA32_PMC_x_CFG_B MSRs access error When running perf_fuzzer on PTL, sometimes the below "unchecked MSR access error" is seen when accessing IA32_PMC_x_CFG_B MSRs. [ 55.611268] unchecked MSR access error: WRMSR to 0x1986 (tried to write 0x0000000200000001) at rIP: 0xffffffffac564b28 (native_write_msr+0x8/0x30) [ 55.611280] Call Trace: [ 55.611282] [ 55.611284] ? intel_pmu_config_acr+0x87/0x160 [ 55.611289] intel_pmu_enable_acr+0x6d/0x80 [ 55.611291] intel_pmu_enable_event+0xce/0x460 [ 55.611293] x86_pmu_start+0x78/0xb0 [ 55.611297] x86_pmu_enable+0x218/0x3a0 [ 55.611300] ? x86_pmu_enable+0x121/0x3a0 [ 55.611302] perf_pmu_enable+0x40/0x50 [ 55.611307] ctx_resched+0x19d/0x220 [ 55.611309] __perf_install_in_context+0x284/0x2f0 [ 55.611311] ? __pfx_remote_function+0x10/0x10 [ 55.611314] remote_function+0x52/0x70 [ 55.611317] ? __pfx_remote_function+0x10/0x10 [ 55.611319] generic_exec_single+0x84/0x150 [ 55.611323] smp_call_function_single+0xc5/0x1a0 [ 55.611326] ? __pfx_remote_function+0x10/0x10 [ 55.611329] perf_install_in_context+0xd1/0x1e0 [ 55.611331] ? __pfx___perf_install_in_context+0x10/0x10 [ 55.611333] __do_sys_perf_event_open+0xa76/0x1040 [ 55.611336] __x64_sys_perf_event_open+0x26/0x30 [ 55.611337] x64_sys_call+0x1d8e/0x20c0 [ 55.611339] do_syscall_64+0x4f/0x120 [ 55.611343] entry_SYSCALL_64_after_hwframe+0x76/0x7e On PTL, GP counter 0 and 1 doesn't support auto counter reload feature, thus it would trigger a #GP when trying to write 1 on bit 0 of CFG_B MSR which requires to enable auto counter reload on GP counter 0. The root cause of causing this issue is the check for auto counter reload (ACR) counter mask from user space is incorrect in intel_pmu_acr_late_setup() helper. It leads to an invalid ACR counter mask from user space could be set into hw.config1 and then written into CFG_B MSRs and trigger the MSR access warning. e.g., User may create a perf event with ACR counter mask (config2=0xcb), and there is only 1 event created, so "cpuc->n_events" is 1. The correct check condition should be "i + idx >= cpuc->n_events" instead of "i + idx > cpuc->n_events" (it looks a typo). Otherwise, the counter mask would traverse twice and an invalid "cpuc->assign[1]" bit (bit 0) is set into hw.config1 and cause MSR accessing error. Besides, also check if the ACR counter mask corresponding events are ACR events. If not, filter out these counter mask. If a event is not a ACR event, it could be scheduled to an HW counter which doesn't support ACR. It's invalid to add their counter index in ACR counter mask. Furthermore, remove the WARN_ON_ONCE() since it's easily triggered as user could set any invalid ACR counter mask and the warning message could mislead users. The Linux kernel CVE team has assigned CVE-2025-40122 to this issue. Affected and fixed versions =========================== Issue introduced in 6.16 with commit ec980e4facef8110f6fce27e5b6344660117f01f and fixed in 6.17.3 with commit c6cca4213b618c92e4972919ee568f0fb87313b1 Issue introduced in 6.16 with commit ec980e4facef8110f6fce27e5b6344660117f01f and fixed in 6.18-rc1 with commit 43796f30507802d93ead2dc44fc9637f34671a89 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-2025-40122 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: arch/x86/events/intel/core.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/c6cca4213b618c92e4972919ee568f0fb87313b1 https://git.kernel.org/stable/c/43796f30507802d93ead2dc44fc9637f34671a89