# CVE-2023-53368: tracing: Fix race issue between cpu buffer write and swap

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 4.7
- **CVSS:** 4.7 (v3.1, CNA) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.15% (percentile 2, 2026-11-26)
- **CWE:** CWE-362
- **Published:** 2025-09-17T14:56:56.752Z
- **Modified:** 2026-06-17T06:45:07.260Z

## Who should check

- Anyone running Linux \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 90e037cabc2c2dfc39b3dd9c5b22ea91f995539a; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< c5d30d6aa83d99fba8dfdd9cf6c4e4e7a63244db; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 6182318ac04648b46db9d441fd7d696337fcdd0b; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 74c85396bd73eca80b96510b4edf93b9a3aff75f; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 89c89da92a60028013f9539be0dcce7e44405a43; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 37ca1b686078b00cc4ffa008e2190615f7709b5d; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 3163f635b20e9e1fb4659e74f47918c9dddfe64e
- Anyone running Linux 3.10

## Description

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

tracing: Fix race issue between cpu buffer write and swap

Warning happened in rb\_end\_commit() at code:
	if (RB\_WARN\_ON(cpu\_buffer, !local\_read(&cpu\_buffer-\>committing)))

  WARNING: CPU: 0 PID: 139 at kernel/trace/ring\_buffer.c:3142
	rb\_commit+0x402/0x4a0
  Call Trace:
   ring\_buffer\_unlock\_commit+0x42/0x250
   trace\_buffer\_unlock\_commit\_regs+0x3b/0x250
   trace\_event\_buffer\_commit+0xe5/0x440
   trace\_event\_buffer\_reserve+0x11c/0x150
   trace\_event\_raw\_event\_sched\_switch+0x23c/0x2c0
   \_\_traceiter\_sched\_switch+0x59/0x80
   \_\_schedule+0x72b/0x1580
   schedule+0x92/0x120
   worker\_thread+0xa0/0x6f0

It is because the race between writing event into cpu buffer and swapping
cpu buffer through file per\_cpu/cpu0/snapshot:

  Write on CPU 0             Swap buffer by per\_cpu/cpu0/snapshot on CPU 1
  --------                   --------
                             tracing\_snapshot\_write()
                               \[...\]

  ring\_buffer\_lock\_reserve()
    cpu\_buffer = buffer-\>buffers\[cpu\]; // 1. Suppose find 'cpu\_buffer\_a';
    \[...\]
    rb\_reserve\_next\_event()
      \[...\]

                               ring\_buffer\_swap\_cpu()
                                 if (local\_read(&cpu\_buffer\_a-\>committing))
                                     goto out\_dec;
                                 if (local\_read(&cpu\_buffer\_b-\>committing))
                                     goto out\_dec;
                                 buffer\_a-\>buffers\[cpu\] = cpu\_buffer\_b;
                                 buffer\_b-\>buffers\[cpu\] = cpu\_buffer\_a;
                                 // 2. cpu\_buffer has swapped here.

      rb\_start\_commit(cpu\_buffer);
      if (unlikely(READ\_ONCE(cpu\_buffer-\>buffer)
          != buffer)) { // 3. This check passed due to 'cpu\_buffer-\>buffer'
        \[...\]           //    has not changed here.
        return NULL;
      }
                                 cpu\_buffer\_b-\>buffer = buffer\_a;
                                 cpu\_buffer\_a-\>buffer = buffer\_b;
                                 \[...\]

      // 4. Reserve event from 'cpu\_buffer\_a'.

  ring\_buffer\_unlock\_commit()
    \[...\]
    cpu\_buffer = buffer-\>buffers\[cpu\]; // 5. Now find 'cpu\_buffer\_b' !!!
    rb\_commit(cpu\_buffer)
      rb\_end\_commit()  // 6. WARN for the wrong 'committing' state !!!

Based on above analysis, we can easily reproduce by following testcase:
  \`\`\` bash
  \#!/bin/bash

  dmesg -n 7
  sysctl -w kernel.panic\_on\_warn=1
  TR=/sys/kernel/tracing
  echo 7 \> ${TR}/buffer\_size\_kb
  echo "sched:sched\_switch" \> ${TR}/set\_event
  while \[ true \]; do
          echo 1 \> ${TR}/per\_cpu/cpu0/snapshot
  done &
  while \[ true \]; do
          echo 1 \> ${TR}/per\_cpu/cpu0/snapshot
  done &
  while \[ true \]; do
          echo 1 \> ${TR}/per\_cpu/cpu0/snapshot
  done &
  \`\`\`

To fix it, IIUC, we can use smp\_call\_function\_single() to do the swap on
the target cpu where the buffer is located, so that above race would be
avoided.

## Affected and fixed versions

- Linux: \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 90e037cabc2c2dfc39b3dd9c5b22ea91f995539a; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< c5d30d6aa83d99fba8dfdd9cf6c4e4e7a63244db; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 6182318ac04648b46db9d441fd7d696337fcdd0b; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 74c85396bd73eca80b96510b4edf93b9a3aff75f; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 89c89da92a60028013f9539be0dcce7e44405a43; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 37ca1b686078b00cc4ffa008e2190615f7709b5d; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 3163f635b20e9e1fb4659e74f47918c9dddfe64e (cvelist)
- Linux: 3.10 (cvelist)

## Mitigation

- Upgrade Linux to 3163f635b20e9e1fb4659e74f47918c9dddfe64e or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2023-53368. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2023-53368.md
Affected: Linux >= f1affcaaa861f27752a769f889bf1486ebd301fe, < 90e037cabc2c2dfc39b3dd9c5b22ea91f995539a; >= f1affcaaa861f27752a769f889bf1486ebd301fe, < c5d30d6aa83d99fba8dfdd9cf6c4e4e7a63244db; >= f1affcaaa861f27752a769f889bf1486ebd301fe, < 6182318ac04648b46db9d441fd7d696337fcdd0b; >= f1affcaaa861f27752a769f…
Fixed in: Linux 90e037cabc2c2dfc39b3dd9c5b22ea91f995539a, Linux 6182318ac04648b46db9d441fd7d696337fcdd0b, Linux 74c85396bd73eca80b96510b4edf93b9a3aff75f, Linux 89c89da92a60028013f9539be0dcce7e44405a43, Linux 37ca1b686078b00cc4ffa008e2190615f7709b5d, Linux 3163f635b20e9e1fb4659e74f47918c9dddfe64e

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2023-53368 being exploited?

There is no confirmed exploitation: CVE-2023-53368 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.15% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2023-53368?

Medium: CVSS 4.7 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2023-53368?

Linux \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 90e037cabc2c2dfc39b3dd9c5b22ea91f995539a; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< c5d30d6aa83d99fba8dfdd9cf6c4e4e7a63244db; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 6182318ac04648b46db9d441fd7d696337fcdd0b; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 74c85396bd73eca80b96510b4edf93b9a3aff75f; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 89c89da92a60028013f9539be0dcce7e44405a43; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 37ca1b686078b00cc4ffa008e2190615f7709b5d; \>= f1affcaaa861f27752a769f889bf1486ebd301fe, \< 3163f635b20e9e1fb4659e74f47918c9dddfe64e; Linux 3.10.

### Is there a fix for CVE-2023-53368?

Yes. Fixed in Linux 90e037cabc2c2dfc39b3dd9c5b22ea91f995539a, Linux 6182318ac04648b46db9d441fd7d696337fcdd0b, Linux 74c85396bd73eca80b96510b4edf93b9a3aff75f, Linux 89c89da92a60028013f9539be0dcce7e44405a43, Linux 37ca1b686078b00cc4ffa008e2190615f7709b5d, Linux 3163f635b20e9e1fb4659e74f47918c9dddfe64e. Upgrade Linux to 3163f635b20e9e1fb4659e74f47918c9dddfe64e or later.

### How do I check if I'm affected by CVE-2023-53368?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/90e037cabc2c2dfc39b3dd9c5b22ea91f995539a>
- patch: <https://git.kernel.org/stable/c/c5d30d6aa83d99fba8dfdd9cf6c4e4e7a63244db>
- patch: <https://git.kernel.org/stable/c/6182318ac04648b46db9d441fd7d696337fcdd0b>
- patch: <https://git.kernel.org/stable/c/74c85396bd73eca80b96510b4edf93b9a3aff75f>
- patch: <https://git.kernel.org/stable/c/89c89da92a60028013f9539be0dcce7e44405a43>
- patch: <https://git.kernel.org/stable/c/37ca1b686078b00cc4ffa008e2190615f7709b5d>
- patch: <https://git.kernel.org/stable/c/3163f635b20e9e1fb4659e74f47918c9dddfe64e>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2023-53368>

HTML: <https://flawdb.com/CVE-2023-53368> · JSON: <https://flawdb.com/api/v1/entries/CVE-2023-53368>
