{"id":"CVE-2022-49607","sourceIdentifier":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","published":"2025-02-26T07:01:36.180","lastModified":"2026-06-17T05:18:36.740","vulnStatus":"Modified","cveTags":[],"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nperf/core: Fix data race between perf_event_set_output() and perf_mmap_close()\n\nYang Jihing reported a race between perf_event_set_output() and\nperf_mmap_close():\n\n\tCPU1\t\t\t\t\tCPU2\n\n\tperf_mmap_close(e2)\n\t  if (atomic_dec_and_test(&e2->rb->mmap_count)) // 1 - > 0\n\t    detach_rest = true\n\n\t\t\t\t\t\tioctl(e1, IOC_SET_OUTPUT, e2)\n\t\t\t\t\t\t  perf_event_set_output(e1, e2)\n\n\t  ...\n\t  list_for_each_entry_rcu(e, &e2->rb->event_list, rb_entry)\n\t    ring_buffer_attach(e, NULL);\n\t    // e1 isn't yet added and\n\t    // therefore not detached\n\n\t\t\t\t\t\t    ring_buffer_attach(e1, e2->rb)\n\t\t\t\t\t\t      list_add_rcu(&e1->rb_entry,\n\t\t\t\t\t\t\t\t   &e2->rb->event_list)\n\nAfter this; e1 is attached to an unmapped rb and a subsequent\nperf_mmap() will loop forever more:\n\n\tagain:\n\t\tmutex_lock(&e->mmap_mutex);\n\t\tif (event->rb) {\n\t\t\t...\n\t\t\tif (!atomic_inc_not_zero(&e->rb->mmap_count)) {\n\t\t\t\t...\n\t\t\t\tmutex_unlock(&e->mmap_mutex);\n\t\t\t\tgoto again;\n\t\t\t}\n\t\t}\n\nThe loop in perf_mmap_close() holds e2->mmap_mutex, while the attach\nin perf_event_set_output() holds e1->mmap_mutex. As such there is no\nserialization to avoid this race.\n\nChange perf_event_set_output() to take both e1->mmap_mutex and\ne2->mmap_mutex to alleviate that problem. Additionally, have the loop\nin perf_mmap() detach the rb directly, this avoids having to wait for\nthe concurrent perf_mmap_close() to get around to doing it to make\nprogress."},{"lang":"es","value":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: 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(&amp;e2-&gt;rb-&gt;mmap_count)) // 1 - &gt; 0 detach_rest = true ioctl(e1, IOC_SET_OUTPUT, e2) perf_event_set_output(e1, e2) ... list_for_each_entry_rcu(e, &amp;e2-&gt;rb-&gt;event_list, rb_entry) ring_buffer_attach(e, NULL); // e1 isn't yet added and // therefore not detached ring_buffer_attach(e1, e2-&gt;rb) list_add_rcu(&amp;e1-&gt;rb_entry, &amp;e2-&gt;rb-&gt;event_list) After this; e1 is attached to an unmapped rb and a subsequent perf_mmap() will loop forever more: again: mutex_lock(&amp;e-&gt;mmap_mutex); if (event-&gt;rb) { ... if (!atomic_inc_not_zero(&amp;e-&gt;rb-&gt;mmap_count)) { ... mutex_unlock(&amp;e-&gt;mmap_mutex); goto again; } } The loop in perf_mmap_close() holds e2-&gt;mmap_mutex, while the attach in perf_event_set_output() holds e1-&gt;mmap_mutex. Como tal, no hay serialización para evitar esta ejecución. Cambie perf_event_set_output() para que acepte tanto e1-&gt;mmap_mutex como e2-&gt;mmap_mutex para aliviar ese problema. Además, haga que el bucle en perf_mmap() desconecte el rb directamente, esto evita tener que esperar a que perf_mmap_close() concurrente lo haga para avanzar."}],"affected":[{"source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","affectedData":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","programFiles":["kernel/events/core.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","versions":[{"version":"9bb5d40cd93c9dd4be74834b1dcb1ba03629716b","lessThan":"3bbd868099287ff9027db59029b502fcfa2202a0","versionType":"git","status":"affected"},{"version":"9bb5d40cd93c9dd4be74834b1dcb1ba03629716b","lessThan":"f836f9ac95df15f1e0af4beb0ec20021e8c91998","versionType":"git","status":"affected"},{"version":"9bb5d40cd93c9dd4be74834b1dcb1ba03629716b","lessThan":"17f5417194136517ee9bbd6511249e5310e5617c","versionType":"git","status":"affected"},{"version":"9bb5d40cd93c9dd4be74834b1dcb1ba03629716b","lessThan":"98c3c8fd0d4c560e0f8335b79c407bbf7fc9462c","versionType":"git","status":"affected"},{"version":"9bb5d40cd93c9dd4be74834b1dcb1ba03629716b","lessThan":"43128b3eee337824158f34da6648163d2f2fb937","versionType":"git","status":"affected"},{"version":"9bb5d40cd93c9dd4be74834b1dcb1ba03629716b","lessThan":"da3c256e2d0ebc87c7db0c605c9692b6f1722074","versionType":"git","status":"affected"},{"version":"9bb5d40cd93c9dd4be74834b1dcb1ba03629716b","lessThan":"a9391ff7a7c5f113d6f2bf6621d49110950de49c","versionType":"git","status":"affected"},{"version":"9bb5d40cd93c9dd4be74834b1dcb1ba03629716b","lessThan":"68e3c69803dada336893640110cb87221bb01dcf","versionType":"git","status":"affected"},{"version":"2487f0db30527032c4d56fc2d0b1a240fe89fef8","versionType":"git","status":"affected"},{"version":"703197b61d05f5edae54bad3256901c5a5c8794c","versionType":"git","status":"affected"},{"version":"c52217e88ae0f3a4ae00562d86e338f8f85969b4","versionType":"git","status":"affected"},{"version":"3.2.49","lessThan":"3.3","versionType":"semver","status":"affected"},{"version":"3.4.52","lessThan":"3.5","versionType":"semver","status":"affected"},{"version":"3.9.8","lessThan":"3.10","versionType":"semver","status":"affected"}]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","programFiles":["kernel/events/core.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","versions":[{"version":"3.10","status":"affected"},{"version":"0","lessThan":"3.10","versionType":"semver","status":"unaffected"},{"version":"4.9.325","lessThanOrEqual":"4.9.*","versionType":"semver","status":"unaffected"},{"version":"4.14.290","lessThanOrEqual":"4.14.*","versionType":"semver","status":"unaffected"},{"version":"4.19.254","lessThanOrEqual":"4.19.*","versionType":"semver","status":"unaffected"},{"version":"5.4.208","lessThanOrEqual":"5.4.*","versionType":"semver","status":"unaffected"},{"version":"5.10.134","lessThanOrEqual":"5.10.*","versionType":"semver","status":"unaffected"},{"version":"5.15.58","lessThanOrEqual":"5.15.*","versionType":"semver","status":"unaffected"},{"version":"5.18.15","lessThanOrEqual":"5.18.*","versionType":"semver","status":"unaffected"},{"version":"5.19","lessThanOrEqual":"*","versionType":"original_commit_for_fix","status":"unaffected"}]}]}],"metrics":{"cvssMetricV31":[{"source":"nvd@nist.gov","type":"Primary","cvssData":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H","baseScore":4.7,"baseSeverity":"MEDIUM","attackVector":"LOCAL","attackComplexity":"HIGH","privilegesRequired":"LOW","userInteraction":"NONE","scope":"UNCHANGED","confidentialityImpact":"NONE","integrityImpact":"NONE","availabilityImpact":"HIGH"},"exploitabilityScore":1.0,"impactScore":3.6},{"source":"134c704f-9b21-4f2e-91b3-4a467353bcc0","type":"Secondary","cvssData":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H","baseScore":4.7,"baseSeverity":"MEDIUM","attackVector":"LOCAL","attackComplexity":"HIGH","privilegesRequired":"LOW","userInteraction":"NONE","scope":"UNCHANGED","confidentialityImpact":"NONE","integrityImpact":"NONE","availabilityImpact":"HIGH"},"exploitabilityScore":1.0,"impactScore":3.6}],"ssvcV203":[{"source":"134c704f-9b21-4f2e-91b3-4a467353bcc0","ssvcData":{"timestamp":"2025-10-01T19:35:03.904350Z","id":"CVE-2022-49607","options":[{"exploitation":"none"},{"automatable":"no"},{"technicalImpact":"partial"}],"role":"CISA Coordinator","version":"2.0.3"}}]},"weaknesses":[{"source":"nvd@nist.gov","type":"Primary","description":[{"lang":"en","value":"CWE-362"}]},{"source":"134c704f-9b21-4f2e-91b3-4a467353bcc0","type":"Secondary","description":[{"lang":"en","value":"CWE-362"}]}],"configurations":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.2.49","versionEndExcluding":"3.3","matchCriteriaId":"2A0E6CA1-D820-4022-9A10-55C1BB83F02E"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.4.52","versionEndExcluding":"3.5","matchCriteriaId":"B64F306D-C88E-4F4C-A677-1FD2635830E6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.9.8","versionEndExcluding":"4.9.325","matchCriteriaId":"2A44C19E-9011-43EB-8FE2-EC3270C84A19"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.10","versionEndExcluding":"4.14.290","matchCriteriaId":"1F023E37-5DAE-491D-9971-00FC089E8C7E"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.15","versionEndExcluding":"4.19.254","matchCriteriaId":"56D38C39-4EB7-48A7-85D3-D4854AC7B3E8"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.20","versionEndExcluding":"5.4.208","matchCriteriaId":"58A5EC97-5FF0-4B0A-8074-2A5A57644D59"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"5.10.134","matchCriteriaId":"4B697B47-6B36-47E0-95DC-054EC4633DEA"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.11","versionEndExcluding":"5.15.58","matchCriteriaId":"13CF20C8-4DA9-4A21-AD13-7A5C22E5FB05"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.16","versionEndExcluding":"5.18.15","matchCriteriaId":"EAD6B571-194C-43A2-A4AB-F68F869D13BC"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:5.19:rc1:*:*:*:*:*:*","matchCriteriaId":"A8C30C2D-F82D-4D37-AB48-D76ABFBD5377"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:5.19:rc2:*:*:*:*:*:*","matchCriteriaId":"BF8547FC-C849-4F1B-804B-A93AE2F04A92"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:5.19:rc3:*:*:*:*:*:*","matchCriteriaId":"F3068028-F453-4A1C-B80F-3F5609ACEF60"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:5.19:rc4:*:*:*:*:*:*","matchCriteriaId":"2E9C0DB0-D349-489F-A3D6-B77214E93A8A"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:5.19:rc5:*:*:*:*:*:*","matchCriteriaId":"1A0DE3B7-0FFB-45AA-9BD6-19870CA7C6FD"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:5.19:rc6:*:*:*:*:*:*","matchCriteriaId":"00AE778B-BAEE-49EB-9F84-003B73D7862A"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/17f5417194136517ee9bbd6511249e5310e5617c","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":["Patch"]},{"url":"https://git.kernel.org/stable/c/3bbd868099287ff9027db59029b502fcfa2202a0","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":["Patch"]},{"url":"https://git.kernel.org/stable/c/43128b3eee337824158f34da6648163d2f2fb937","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":["Patch"]},{"url":"https://git.kernel.org/stable/c/68e3c69803dada336893640110cb87221bb01dcf","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":["Patch"]},{"url":"https://git.kernel.org/stable/c/98c3c8fd0d4c560e0f8335b79c407bbf7fc9462c","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":["Patch"]},{"url":"https://git.kernel.org/stable/c/a9391ff7a7c5f113d6f2bf6621d49110950de49c","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":["Patch"]},{"url":"https://git.kernel.org/stable/c/da3c256e2d0ebc87c7db0c605c9692b6f1722074","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":["Patch"]},{"url":"https://git.kernel.org/stable/c/f836f9ac95df15f1e0af4beb0ec20021e8c91998","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":["Patch"]}]}