CVE-2024-38601: ring-buffer: Fix a race between readers and resize checks

Published Jun 19, 2024
·
Updated

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

ring-buffer: Fix a race between readers and resize checks

The Linux kernel CVE team has assigned CVE-2024-38601 to this issue.

Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024061923-CVE-2024-38601-dc52@gregkh/T

Other sources

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

ring-buffer: Fix a race between readers and resize checks

The reader code in rbgetreaderpage() swaps a new reader page into the ring buffer by doing cmpxchg on old->list.prev->next to point it to the new page. Following that, if the operation is successful, old->list.next->prev gets updated too. This means the underlying doubly-linked list is temporarily inconsistent, page->prev->next or page->next->prev might not be equal back to page for some page in the ring buffer.

The resize operation in ringbufferresize() can be invoked in parallel. It calls rbcheckpages() which can detect the described inconsistency and stop further tracing:

[ 190.271762] ------------[ cut here ]------------ [ 190.271771] WARNING: CPU: 1 PID: 6186 at kernel/trace/ringbuffer.c:1467 rbcheckpages.isra.0+0x6a/0xa0 [ 190.271789] Modules linked in: [...] [ 190.271991] Unloaded tainted modules: inteluncorefrequency(E):1 skxedac(E):1 [ 190.272002] CPU: 1 PID: 6186 Comm: cmd.sh Kdump: loaded Tainted: G E 6.9.0-rc6-default #5 158d3e1e6d0b091c34c3b96bfd99a1c58306d79f [ 190.272011] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.0-0-gd239552c-rebuilt.opensuse.org 04/01/2014 [ 190.272015] RIP: 0010:rbcheckpages.isra.0+0x6a/0xa0 [ 190.272023] Code: [...] [ 190.272028] RSP: 0018:ffff9c37463abb70 EFLAGS: 00010206 [ 190.272034] RAX: ffff8eba04b6cb80 RBX: 0000000000000007 RCX: ffff8eba01f13d80 [ 190.272038] RDX: ffff8eba01f130c0 RSI: ffff8eba04b6cd00 RDI: ffff8eba0004c700 [ 190.272042] RBP: ffff8eba0004c700 R08: 0000000000010002 R09: 0000000000000000 [ 190.272045] R10: 00000000ffff7f52 R11: ffff8eba7f600000 R12: ffff8eba0004c720 [ 190.272049] R13: ffff8eba00223a00 R14: 0000000000000008 R15: ffff8eba067a8000 [ 190.272053] FS: 00007f1bd64752c0(0000) GS:ffff8eba7f680000(0000) knlGS:0000000000000000 [ 190.272057] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 190.272061] CR2: 00007f1bd6662590 CR3: 000000010291e001 CR4: 0000000000370ef0 [ 190.272070] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 190.272073] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 190.272077] Call Trace: [ 190.272098] <TASK> [ 190.272189] ringbufferresize+0x2ab/0x460 [ 190.272199] tracingresizeringbuffer.part.0+0x23/0xa0 [ 190.272206] tracingresizeringbuffer+0x65/0x90 [ 190.272216] tracingentrieswrite+0x74/0xc0 [ 190.272225] vfswrite+0xf5/0x420 [ 190.272248] ksyswrite+0x67/0xe0 [ 190.272256] dosyscall64+0x82/0x170 [ 190.272363] entrySYSCALL64afterhwframe+0x76/0x7e [ 190.272373] RIP: 0033:0x7f1bd657d263 [ 190.272381] Code: [...] [ 190.272385] RSP: 002b:00007ffe72b643f8 EFLAGS: 00000246 ORIGRAX: 0000000000000001 [ 190.272391] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f1bd657d263 [ 190.272395] RDX: 0000000000000002 RSI: 0000555a6eb538e0 RDI: 0000000000000001 [ 190.272398] RBP: 0000555a6eb538e0 R08: 000000000000000a R09: 0000000000000000 [ 190.272401] R10: 0000555a6eb55190 R11: 0000000000000246 R12: 00007f1bd6662500 [ 190.272404] R13: 0000000000000002 R14: 00007f1bd6667c00 R15: 0000000000000002 [ 190.272412] </TASK> [ 190.272414] ---[ end trace 0000000000000000 ]---

Note that ringbufferresize() calls rbcheckpages() only if the parent tracebuffer has recording disabled. Recent commit d78ab792705c ("tracing: Stop current tracer when resizing buffer") causes that it is now always the case which makes it more likely to experience this issue.

The window to hit this race is nonetheless very small. To help reproducing it, one can add a delay loop in rbgetreaderpage():

ret = rbheadpagereplace(reader, cpubuffer->readerpage); if (!ret) goto spin; for (unsigned i = 0; i < 1U << 26; i++) / inserted delay loop / asm volatile ("" : : : "memory"); rblisthead(reader->list.next)->prev = &cpubuffer->readerpage->list;

.. ---truncated---

— NVD

Affected Software

21 affected componentsFixes available
redhat/kernel<4.19.316
4.19.316
redhat/kernel<5.4.278
5.4.278
redhat/kernel<5.10.219
5.10.219
redhat/kernel<5.15.161
5.15.161
redhat/kernel<6.1.93
6.1.93
redhat/kernel<6.6.33
6.6.33
redhat/kernel<6.8.12
6.8.12
redhat/kernel<6.9.3
6.9.3
redhat/kernel<6.10
6.10
Linux Linux kernel>=3.5<4.19.316
Linux Linux kernel>=4.20<5.4.278
Linux Linux kernel>=5.5<5.10.219
Linux Linux kernel>=5.11<5.15.161
Linux Linux kernel>=5.16<6.1.93
Linux Linux kernel>=6.2<6.6.33
Linux Linux kernel>=6.7<6.8.12
Linux Linux kernel>=6.9<6.9.3
debian/linux<6.1.94-1
6.1.94-1
debian/linux<6.8.12-1
6.8.12-1
debian/linux<6.8.12-1
6.8.12-1
debian/linux
6.1.176-16.1.190-16.12.107-16.12.115-27.2.12-17.2.15-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 4.19.316
  2. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 5.4.278
  3. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 5.10.219
  4. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 5.15.161
  5. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.1.93
  6. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.6.33
  7. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.8.12
  8. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.9.3
  9. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.10
  10. Upgrade

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

    Fixed in 6.1.94-1
  11. Upgrade

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

    Fixed in 6.8.12-1
  12. Upgrade

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

    Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.115-2Fixed in 7.2.12-1Fixed in 7.2.15-1
  13. Upgrade

    Upgrade Linux kernel to a version that resolves this vulnerability.

    Patch d78ab792705c

Event History

Jun 19, 2024
CVE Published
via MITRE·01:48 PM
Data Sourced
via MITRE·01:48 PM
Description
Data Sourced
via NVD·02:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·02:15 PM
DescriptionSeverityAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is the severity of CVE-2024-38601?

CVE-2024-38601 has a medium severity rating due to its potential impact on the Linux kernel's stability.

2

How do I fix CVE-2024-38601?

To fix CVE-2024-38601, update to the latest kernel versions recommended by Red Hat or Debian, specifically those mentioned in the advisory.

3

Which versions of the Linux kernel are affected by CVE-2024-38601?

CVE-2024-38601 affects several kernel versions including 4.19, 5.4, 5.10, 5.15, and multiple 6.x versions.

4

Are there any known exploits for CVE-2024-38601?

As of now, there are no widely reported exploits specifically targeting CVE-2024-38601.

5

What types of systems are impacted by CVE-2024-38601?

CVE-2024-38601 impacts systems running vulnerable versions of the Linux kernel across various distributions.

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