CVE-2022-49781: perf/x86/amd: Fix crash due to race between amd_pmu_enable_all, perf NMI and throttling

Published May 1, 2025
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

perf/x86/amd: Fix crash due to race between amdpmuenableall, perf NMI and throttling

amdpmuenableall() does:

if (!testbit(idx, cpuc->activemask)) continue;

amdpmuenableevent(cpuc->events[idx]);

A perf NMI of another event can come between these two steps. Perf NMI handler internally disables and enables all events, including the one which nmi-intercepted amdpmuenableall() was in process of enabling. If that unintentionally enabled event has very low sampling period and causes immediate successive NMI, causing the event to be throttled, cpuc->events[idx] and cpuc->activemask gets cleared by x86pmustop(). This will result in amdpmuenableevent() getting called with event=NULL when amdpmuenableall() resumes after handling the NMIs. This causes a kernel crash:

BUG: kernel NULL pointer dereference, address: 0000000000000198 #PF: supervisor read access in kernel mode #PF: errorcode(0x0000) - not-present page [...] Call Trace: <TASK> amdpmuenableall+0x68/0xb0 ctxresched+0xd9/0x150 eventfunction+0xb8/0x130 ? hrtimerstartrangens+0x141/0x4a0 ? perfdurationwarn+0x30/0x30 remotefunction+0x4d/0x60 flushsmpcallfunctionqueue+0xc4/0x500 flushsmpcallfunctionqueue+0x11d/0x1b0 doidle+0x18f/0x2d0 cpustartupentry+0x19/0x20 startsecondary+0x121/0x160 secondarystartup64noverify+0xe5/0xeb </TASK>

amdpmudisableall()/amdpmuenableall() calls inside perf NMI handler were recently added as part of BRS enablement but I'm not sure whether we really need them. We can just disable BRS in the beginning and enable it back while returning from NMI. This will solve the issue by not enabling those events whose activemasks are set but are not yet enabled in hw pmu.

Affected Software

12 affected componentsFixes available
The Linux Foundation Linux Kernel
Linux Linux kernel>=5.19<6.0.10
Linux Linux kernel=6.1-rc1
Linux Linux kernel=6.1-rc2
Linux Linux kernel=6.1-rc3
Linux Linux kernel=6.1-rc4
Linux Linux kernel=6.1-rc5
linux/kernel>=5.19.0<6.0.10
6.0.10
debian/linux<6.0.10-1
6.0.10-1
debian/linux<6.0.10-1
6.0.10-1
debian/linux<6.0.10-1
6.0.10-1
debian/linux
6.0.10-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 6.0.10
  2. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 6.0.10-1
  3. Configuration

    Disable BRS at the beginning of perf NMI handling and re-enable it before returning from the NMI.

    AMD perf NMI handling BRS = disabled during NMI handling; re-enabled when returning from NMI

Event History

May 1, 2025
CVE Published
via MITRE·02:09 PM
Data Sourced
via MITRE·02:09 PM
Description
Data Sourced
via OSV·02:09 PM
DescriptionAffected Software
Data Sourced
via NVD·03:16 PM
Description
Nov 7, 2025
Data Sourced
via NVD·05:47 PM
RemedySeverityWeaknessAffected Software
Nov 3, 2026
Data Sourced
via OSV·08:03 AM
Severity

Frequently Asked Questions

1

What is the severity of CVE-2022-49781?

CVE-2022-49781 has been classified with a severity level that typically indicates a potential risk of system crashes due to a race condition.

2

How do I fix CVE-2022-49781?

To address CVE-2022-49781, ensure that you apply the latest security patches from the Linux kernel updates provided by your distribution.

3

What systems are affected by CVE-2022-49781?

CVE-2022-49781 impacts the Linux kernel, particularly systems using AMD processors that utilize the performance monitoring unit (PMU).

4

What are the potential impacts of CVE-2022-49781?

The potential impacts of CVE-2022-49781 include system crashes and instability during performance monitoring operations.

5

When was CVE-2022-49781 disclosed?

CVE-2022-49781 was disclosed in late 2022, highlighting a critical issue addressed by the Linux kernel maintainers.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203