CVE-2022-49607: perf/core: Fix data race between perf_event_set_output() and perf_mmap_close()

Published Feb 26, 2025
·
Updated

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

perf/core: Fix data race between perfeventsetoutput() and perfmmapclose()

Yang Jihing reported a race between perfeventsetoutput() and perfmmapclose():

CPU1 CPU2

perfmmapclose(e2) if (atomicdecandtest(&e2->rb->mmapcount)) // 1 - > 0 detachrest = true

ioctl(e1, IOCSETOUTPUT, e2) perfeventsetoutput(e1, e2)

... listforeachentryrcu(e, &e2->rb->eventlist, rbentry) ringbufferattach(e, NULL); // e1 isn't yet added and // therefore not detached

ringbufferattach(e1, e2->rb) listaddrcu(&e1->rbentry, &e2->rb->eventlist)

After this; e1 is attached to an unmapped rb and a subsequent perfmmap() will loop forever more:

again: mutexlock(&e->mmapmutex); if (event->rb) { ... if (!atomicincnotzero(&e->rb->mmapcount)) { ... mutexunlock(&e->mmapmutex); goto again; } }

The loop in perfmmapclose() holds e2->mmapmutex, while the attach in perfeventsetoutput() holds e1->mmapmutex. As such there is no serialization to avoid this race.

Change perfeventsetoutput() to take both e1->mmapmutex and e2->mmapmutex to alleviate that problem. Additionally, have the loop in perfmmap() detach the rb directly, this avoids having to wait for the concurrent perfmmapclose() to get around to doing it to make progress.

Affected Software

16 affected components
Linux Linux kernel
Linux Linux kernel>=3.2.49<3.3
Linux Linux kernel>=3.4.52<3.5
Linux Linux kernel>=3.9.8<4.9.325
Linux Linux kernel>=4.10<4.14.290
Linux Linux kernel>=4.15<4.19.254
Linux Linux kernel>=4.20<5.4.208
Linux Linux kernel>=5.5<5.10.134
Linux Linux kernel>=5.11<5.15.58
Linux Linux kernel>=5.16<5.18.15
Linux Linux kernel=5.19-rc1
Linux Linux kernel=5.19-rc2
Linux Linux kernel=5.19-rc3
Linux Linux kernel=5.19-rc4
Linux Linux kernel=5.19-rc5
Linux Linux kernel=5.19-rc6

Event History

Feb 26, 2025
CVE Published
via MITRE·02:23 AM
Data Sourced
via MITRE·02:23 AM
Description
Data Sourced
via NVD·07:01 AM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2022-49607?

CVE-2022-49607 has a moderate severity rating due to a race condition in the Linux kernel.

2

How do I fix CVE-2022-49607?

To fix CVE-2022-49607, update your Linux kernel to a version that includes the patch for this vulnerability.

3

Which versions of the Linux kernel are affected by CVE-2022-49607?

CVE-2022-49607 affects multiple versions of the Linux kernel from 3.2.49 up to certain later versions.

4

What are the potential risks of CVE-2022-49607?

The risks of CVE-2022-49607 include potential system instability and denial of service due to race conditions.

5

Who reported the CVE-2022-49607 vulnerability?

CVE-2022-49607 was reported by Yang Jihing.

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