CVE-2022-49607
MediumIn the Linux kernel, the following vulnerability has been resolved: perf/core: Fix data race between perf_event_set_output() and perf_mmap_close() Yang Jihing reported a race between perf_event_set_output() and perf_mmap_close(): CPU1 CPU2 perf_mmap_close(e2) if (atomic_dec_and_test(&e2->rb->mmap_count)) // 1 - > 0 detach_rest = true ioctl(e1, IOC_SET_OUTPUT, e2) perf_event_set_output(e1, e2) ... list_for_each_entry_rcu(e, &e2->rb->event_list, rb_entry) ring_buffer_attach(e, NULL); // e1 isn't yet added and // therefore not detached ring_buffer_attach(e1, e2->rb) list_add_rcu(&e1->rb_entry, &e2->rb->event_list) After this; e1 is attached to an unmapped rb and a subsequent perf_mmap() will loop forever more: again: mutex_lock(&e->mmap_mutex); if (event->rb) { ... if (!atomic_inc_not_zero(&e->rb->mmap_count)) { ... mutex_unlock(&e->mmap_mutex); goto again; } } The loop in perf_mmap_close() holds e2->mmap_mutex, while the attach in perf_event_set_output() holds e1->mmap_mutex. As such there is no serialization to avoid this race. Change perf_event_set_output() to take both e1->mmap_mutex and e2->mmap_mutex to alleviate that problem. Additionally, have the loop in perf_mmap() detach the rb directly, this avoids having to wait for the concurrent perf_mmap_close() to get around to doing it to make progress.
CVSS 3.1 score
4.7
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H
Weakness type
CWE-362CVE-2022-49607 is a Race Condition vulnerability
What is Race Condition?
The product contains a code sequence that can run concurrently with other code, creating unexpected states. Learn more on MITRE CWE
Affected versions
Linux kernel versions
3.2.49,
3.4.52,
3.9.8,
3.10
and later are affected. Fixed in
4.9.325,
4.14.290,
4.19.254,
5.4.208,
5.10.134,
5.15.58,
5.18.15,
5.19
and their respective stable series.
References
The following references provide additional information about CVE-2022-49607 including vendor advisories, patch commits, exploit details, and third-party analysis. Links are sourced from the NIST NVD database.
-
PatchKernel patch commithttps://git.kernel.org/stable/c/17f5417194136517ee9bbd6511249e5310e5617c
-
PatchKernel patch commithttps://git.kernel.org/stable/c/3bbd868099287ff9027db59029b502fcfa2202a0
-
PatchKernel patch commithttps://git.kernel.org/stable/c/43128b3eee337824158f34da6648163d2f2fb937
Frequently asked questions
-
What is CVE-2022-49607?
CVE-2022-49607 is a Medium severity Linux kernel vulnerability with a CVSS score of 4.7 out of 10 , classified as a Race Condition flaw (CWE-362) . It affects Linux kernel versions from 3.2.49 onward and has been patched in 4.9.325, 4.14.290, 4.19.254 and others. CVE-2022-49607 has not been confirmed as actively exploited and is not listed in the CISA KEV catalog.
-
What is the CVSS score for CVE-2022-49607?
CVE-2022-49607 has a CVSS score of 4.7 out of 10, rated Medium severity (CVSS 3.1). The vector string is
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H. -
Is there a patch available for CVE-2022-49607?
Yes — CVE-2022-49607 has been patched. Fixed versions include 4.9.325, 4.14.290, 4.19.254 and others. If you are running Linux kernel 3.2.49 or later up to the fix versions, apply the relevant patch for your kernel branch.
-
Is CVE-2022-49607 actively exploited?
No — CVE-2022-49607 has not been confirmed as actively exploited. It is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog.
-
What is Race Condition (CWE-362)?
The product contains a code sequence that can run concurrently with other code, creating unexpected states. View CWE-362 on MITRE CWE →