# CVE-2023-52446: bpf: Fix a race condition between btf\_put() and map\_free()

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

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; 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.32% (percentile 17, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2024-02-22T16:21:38.408Z
- **Modified:** 2026-06-17T06:42:42.877Z

## Who should check

- Anyone running Linux \>= 958cf2e273f0929c66169e0788031310e8118722, \< d048dced8ea5eac6723ae873a40567e6f101ea42; \>= 958cf2e273f0929c66169e0788031310e8118722, \< f9ff6ef1c73cd9e1a6bb1ab3e57c5d141a536306; \>= 958cf2e273f0929c66169e0788031310e8118722, \< 59e5791f59dd83e8aa72a4e74217eabb6e8cfd90
- Anyone running Linux 6.2

## Description

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

bpf: Fix a race condition between btf\_put() and map\_free()

When running \`./test\_progs -j\` in my local vm with latest kernel,
I once hit a kasan error like below:

  \[ 1887.184724\] BUG: KASAN: slab-use-after-free in bpf\_rb\_root\_free+0x1f8/0x2b0
  \[ 1887.185599\] Read of size 4 at addr ffff888106806910 by task kworker/u12:2/2830
  \[ 1887.186498\]
  \[ 1887.186712\] CPU: 3 PID: 2830 Comm: kworker/u12:2 Tainted: G           OEL     6.7.0-rc3-00699-g90679706d486-dirty \#494
  \[ 1887.188034\] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
  \[ 1887.189618\] Workqueue: events\_unbound bpf\_map\_free\_deferred
  \[ 1887.190341\] Call Trace:
  \[ 1887.190666\]  \<TASK\>
  \[ 1887.190949\]  dump\_stack\_lvl+0xac/0xe0
  \[ 1887.191423\]  ? nf\_tcp\_handle\_invalid+0x1b0/0x1b0
  \[ 1887.192019\]  ? panic+0x3c0/0x3c0
  \[ 1887.192449\]  print\_report+0x14f/0x720
  \[ 1887.192930\]  ? preempt\_count\_sub+0x1c/0xd0
  \[ 1887.193459\]  ? \_\_virt\_addr\_valid+0xac/0x120
  \[ 1887.194004\]  ? bpf\_rb\_root\_free+0x1f8/0x2b0
  \[ 1887.194572\]  kasan\_report+0xc3/0x100
  \[ 1887.195085\]  ? bpf\_rb\_root\_free+0x1f8/0x2b0
  \[ 1887.195668\]  bpf\_rb\_root\_free+0x1f8/0x2b0
  \[ 1887.196183\]  ? \_\_bpf\_obj\_drop\_impl+0xb0/0xb0
  \[ 1887.196736\]  ? preempt\_count\_sub+0x1c/0xd0
  \[ 1887.197270\]  ? preempt\_count\_sub+0x1c/0xd0
  \[ 1887.197802\]  ? \_raw\_spin\_unlock+0x1f/0x40
  \[ 1887.198319\]  bpf\_obj\_free\_fields+0x1d4/0x260
  \[ 1887.198883\]  array\_map\_free+0x1a3/0x260
  \[ 1887.199380\]  bpf\_map\_free\_deferred+0x7b/0xe0
  \[ 1887.199943\]  process\_scheduled\_works+0x3a2/0x6c0
  \[ 1887.200549\]  worker\_thread+0x633/0x890
  \[ 1887.201047\]  ? \_\_kthread\_parkme+0xd7/0xf0
  \[ 1887.201574\]  ? kthread+0x102/0x1d0
  \[ 1887.202020\]  kthread+0x1ab/0x1d0
  \[ 1887.202447\]  ? pr\_cont\_work+0x270/0x270
  \[ 1887.202954\]  ? kthread\_blkcg+0x50/0x50
  \[ 1887.203444\]  ret\_from\_fork+0x34/0x50
  \[ 1887.203914\]  ? kthread\_blkcg+0x50/0x50
  \[ 1887.204397\]  ret\_from\_fork\_asm+0x11/0x20
  \[ 1887.204913\]  \</TASK\>
  \[ 1887.204913\]  \</TASK\>
  \[ 1887.205209\]
  \[ 1887.205416\] Allocated by task 2197:
  \[ 1887.205881\]  kasan\_set\_track+0x3f/0x60
  \[ 1887.206366\]  \_\_kasan\_kmalloc+0x6e/0x80
  \[ 1887.206856\]  \_\_kmalloc+0xac/0x1a0
  \[ 1887.207293\]  btf\_parse\_fields+0xa15/0x1480
  \[ 1887.207836\]  btf\_parse\_struct\_metas+0x566/0x670
  \[ 1887.208387\]  btf\_new\_fd+0x294/0x4d0
  \[ 1887.208851\]  \_\_sys\_bpf+0x4ba/0x600
  \[ 1887.209292\]  \_\_x64\_sys\_bpf+0x41/0x50
  \[ 1887.209762\]  do\_syscall\_64+0x4c/0xf0
  \[ 1887.210222\]  entry\_SYSCALL\_64\_after\_hwframe+0x63/0x6b
  \[ 1887.210868\]
  \[ 1887.211074\] Freed by task 36:
  \[ 1887.211460\]  kasan\_set\_track+0x3f/0x60
  \[ 1887.211951\]  kasan\_save\_free\_info+0x28/0x40
  \[ 1887.212485\]  \_\_\_\_kasan\_slab\_free+0x101/0x180
  \[ 1887.213027\]  \_\_kmem\_cache\_free+0xe4/0x210
  \[ 1887.213514\]  btf\_free+0x5b/0x130
  \[ 1887.213918\]  rcu\_core+0x638/0xcc0
  \[ 1887.214347\]  \_\_do\_softirq+0x114/0x37e

The error happens at bpf\_rb\_root\_free+0x1f8/0x2b0:

  00000000000034c0 \<bpf\_rb\_root\_free\>:
  ; {
    34c0: f3 0f 1e fa                   endbr64
    34c4: e8 00 00 00 00                callq   0x34c9 \<bpf\_rb\_root\_free+0x9\>
    34c9: 55                            pushq   %rbp
    34ca: 48 89 e5                      movq    %rsp, %rbp
  ...
  ;       if (rec && rec-\>refcount\_off \>= 0 &&
    36aa: 4d 85 ed                      testq   %r13, %r13
    36ad: 74 a9                         je      0x3658 \<bpf\_rb\_root\_free+0x198\>
    36af: 49 8d 7d 10                   leaq    0x10(%r13), %rdi
    36b3: e8 00 00 00 00                callq   0x36b8 \<bpf\_rb\_root\_free+0x1f8\>
                                        \<==== kasan function
    36b8: 45 8b 7d 10                   movl    0x10(%r13), %r15d
                                        \<==== use-after-free load
    36bc: 45 85 ff                      testl   %r15d, %r15d
    36bf: 78 8c                         js      0x364d \<bpf\_rb\_root\_free+0x18d\>

So the problem 
---truncated---

## Affected and fixed versions

- Linux: \>= 958cf2e273f0929c66169e0788031310e8118722, \< d048dced8ea5eac6723ae873a40567e6f101ea42; \>= 958cf2e273f0929c66169e0788031310e8118722, \< f9ff6ef1c73cd9e1a6bb1ab3e57c5d141a536306; \>= 958cf2e273f0929c66169e0788031310e8118722, \< 59e5791f59dd83e8aa72a4e74217eabb6e8cfd90 (cvelist)
- Linux: 6.2 (cvelist)

## Mitigation

- Upgrade Linux to 59e5791f59dd83e8aa72a4e74217eabb6e8cfd90 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-52446. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2023-52446.md
Affected: Linux >= 958cf2e273f0929c66169e0788031310e8118722, < d048dced8ea5eac6723ae873a40567e6f101ea42; >= 958cf2e273f0929c66169e0788031310e8118722, < f9ff6ef1c73cd9e1a6bb1ab3e57c5d141a536306; >= 958cf2e273f0929c66169e0788031310e8118722, < 59e5791f59dd83e8aa72a4e74217eabb6e8cfd90; Linux 6.2
Fixed in: Linux 59e5791f59dd83e8aa72a4e74217eabb6e8cfd90

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-52446 being exploited?

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

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

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

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

Linux \>= 958cf2e273f0929c66169e0788031310e8118722, \< d048dced8ea5eac6723ae873a40567e6f101ea42; \>= 958cf2e273f0929c66169e0788031310e8118722, \< f9ff6ef1c73cd9e1a6bb1ab3e57c5d141a536306; \>= 958cf2e273f0929c66169e0788031310e8118722, \< 59e5791f59dd83e8aa72a4e74217eabb6e8cfd90; Linux 6.2.

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

Yes. Fixed in Linux 59e5791f59dd83e8aa72a4e74217eabb6e8cfd90. Upgrade Linux to 59e5791f59dd83e8aa72a4e74217eabb6e8cfd90 or later.

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

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/d048dced8ea5eac6723ae873a40567e6f101ea42>
- patch: <https://git.kernel.org/stable/c/f9ff6ef1c73cd9e1a6bb1ab3e57c5d141a536306>
- patch: <https://git.kernel.org/stable/c/59e5791f59dd83e8aa72a4e74217eabb6e8cfd90>

## 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-52446>

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