Skip to content
Fencer Intel
high 7.8

CVE-2025-38166 json

bpf: fix ktls panic with sockmap

published last yr. modified 25d ago also EUVD-2025-19778

cvss
7.8
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
0.2%
EPSS 0.2% chance of exploitation in 30 days, percentile 10%
public exploits
0
none known

Summary

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

bpf: fix ktls panic with sockmap

[ 2172.936997] ------------[ cut here ]------------ [ 2172.936999] kernel BUG at lib/iov_iter.c:629! ...... [ 2172.944996] PKRU: 55555554 [ 2172.945155] Call Trace: [ 2172.945299] <TASK> [ 2172.945428] ? die+0x36/0x90 [ 2172.945601] ? do_trap+0xdd/0x100 [ 2172.945795] ? iov_iter_revert+0x178/0x180 [ 2172.946031] ? iov_iter_revert+0x178/0x180 [ 2172.946267] ? do_error_trap+0x7d/0x110 [ 2172.946499] ? iov_iter_revert+0x178/0x180 [ 2172.946736] ? exc_invalid_op+0x50/0x70 [ 2172.946961] ? iov_iter_revert+0x178/0x180 [ 2172.947197] ? asm_exc_invalid_op+0x1a/0x20 [ 2172.947446] ? iov_iter_revert+0x178/0x180 [ 2172.947683] ? iov_iter_revert+0x5c/0x180 [ 2172.947913] tls_sw_sendmsg_locked.isra.0+0x794/0x840 [ 2172.948206] tls_sw_sendmsg+0x52/0x80 [ 2172.948420] ? inet_sendmsg+0x1f/0x70 [ 2172.948634] __sys_sendto+0x1cd/0x200 [ 2172.948848] ? find_held_lock+0x2b/0x80 [ 2172.949072] ? syscall_trace_enter+0x140/0x270 [ 2172.949330] ? __lock_release.isra.0+0x5e/0x170 [ 2172.949595] ? find_held_lock+0x2b/0x80 [ 2172.949817] ? syscall_trace_enter+0x140/0x270 [ 2172.950211] ? lockdep_hardirqs_on_prepare+0xda/0x190 [ 2172.950632] ? ktime_get_coarse_real_ts64+0xc2/0xd0 [ 2172.951036] __x64_sys_sendto+0x24/0x30 [ 2172.951382] do_syscall_64+0x90/0x170 ......

After calling bpf_exec_tx_verdict(), the size of msg_pl->sg may increase, e.g., when the BPF program executes bpf_msg_push_data().

If the BPF program sets cork_bytes and sg.size is smaller than cork_bytes, it will return -ENOSPC and attempt to roll back to the non-zero copy logic. However, during rollback, msg->msg_iter is reset, but since msg_pl->sg.size has been increased, subsequent executions will exceed the actual size of msg_iter. ''' iov_iter_revert(&msg->msg_iter, msg_pl->sg.size - orig_size); '''

The changes in this commit are based on the following considerations:

1. When cork_bytes is set, rolling back to non-zero copy logic is pointless and can directly go to zero-copy logic.

2. We can not calculate the correct number of bytes to revert msg_iter.

Assume the original data is "abcdefgh" (8 bytes), and after 3 pushes by the BPF program, it becomes 11-byte data: "abc?de?fgh?". Then, we set cork_bytes to 6, which means the first 6 bytes have been processed, and the remaining 5 bytes "?fgh?" will be cached until the length meets the cork_bytes requirement.

However, some data in "?fgh?" is not within 'sg->msg_iter' (but in msg_pl instead), especially the data "?" we pushed.

So it doesn't seem as simple as just reverting through an offset of msg_iter.

3. For non-TLS sockets in tcp_bpf_sendmsg, when a "cork" situation occurs, the user-space send() doesn't return an error, and the returned length is the same as the input length parameter, even if some data is cached.

Additionally, I saw that the current non-zero-copy logic for handling corking is written as: ''' line 1177 else if (ret != -EAGAIN) { if (ret == -ENOSPC) ret = 0; goto send_end; '''

So it's ok to just return 'copied' without error when a "cork" situation occurs.

Patch / fix

  • Linux Linux 6.1.142, 6.6.94, 6.12.34, 6.15.3, 6.16
  • linux Debian 12 6.1.147-1
  • linux Debian 14, Debian 13 6.12.35-1

debian advisories DEBIAN-CVE-2025-38166

  • linux Ubuntu 24.04 LTS 6.8.0-100.100
  • linux-aws Ubuntu 24.04 LTS 6.8.0-1046.49
  • linux-gcp Ubuntu 24.04 LTS 6.8.0-1047.50
  • linux-gke Ubuntu 24.04 LTS 6.8.0-1043.48
  • linux-ibm Ubuntu 24.04 LTS 6.8.0-1044.44
  • linux-azure Ubuntu 24.04 LTS 6.8.0-1046.52
  • linux-gkeop Ubuntu 24.04 LTS 6.8.0-1030.33
  • linux-raspi Ubuntu 24.04 LTS 6.8.0-1047.51

ubuntu advisories UBUNTU-CVE-2025-38166

Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

  • kernel RHEL 9 5.14.0-687.5.1.el9_8
  • rv RHEL 9 5.14.0-687.5.1.el9_8
  • perf RHEL 9 5.14.0-687.5.1.el9_8
  • rtla RHEL 9 5.14.0-687.5.1.el9_8
  • libperf RHEL 9 5.14.0-687.5.1.el9_8
  • kernel-rt RHEL 9 5.14.0-687.5.1.el9_8
  • kernel-64k RHEL 9 5.14.0-687.5.1.el9_8
  • kernel-core RHEL 9 5.14.0-687.5.1.el9_8

red hat advisories RHSA-2026:18587RHSA-2026:18134

  • kernel-rt Real Time Module 15 SP6, openSUSE Leap 15.6 6.4.0-150600.10.49.1
  • kernel-syms-rt Real Time Module 15 SP6, openSUSE Leap 15.6 6.4.0-150600.10.49.1
  • kernel-rt_debug Real Time Module 15 SP6, openSUSE Leap 15.6 6.4.0-150600.10.49.1
  • kernel-source-rt Real Time Module 15 SP6, openSUSE Leap 15.6 6.4.0-150600.10.49.1
  • kernel-azure SLE Module for Public Cloud 15 SP7 6.4.0-150700.20.11.1
  • kernel-syms-azure SLE Module for Public Cloud 15 SP7 6.4.0-150700.20.11.1
  • kernel-source-azure SLE Module for Public Cloud 15 SP7 6.4.0-150700.20.11.1
  • kernel-64kb SLE Module for Basesystem 15 SP7 6.4.0-150700.53.11.1

suse advisories SUSE-SU-2025:03023-1SUSE-SU-2025:03011-1SUSE-SU-2025:02997-1SUSE-SU-2025:02996-1SUSE-SU-2025:20586-1SUSE-SU-2025:20602-1

  • kernel AlmaLinux 10 6.12.0-211.7.1.el10_2
  • rv AlmaLinux 10 6.12.0-211.7.1.el10_2
  • perf AlmaLinux 10 6.12.0-211.7.1.el10_2
  • rtla AlmaLinux 10 6.12.0-211.7.1.el10_2
  • libperf AlmaLinux 10 6.12.0-211.7.1.el10_2
  • kernel-rt AlmaLinux 10 6.12.0-211.7.1.el10_2
  • kernel-64k AlmaLinux 10 6.12.0-211.7.1.el10_2
  • kernel-core AlmaLinux 10 6.12.0-211.7.1.el10_2

almalinux advisories ALSA-2026:18134ALSA-2026:18587

  • kernel Azure Linux 3.0 6.6.96.1-1

azure linux advisories AZL-64637

Azure Linux vulnerability data, Copyright (c) Microsoft Corporation, from https://github.com/microsoft/AzureLinuxVulnerabilityData via OSV, under the MIT licence; changed: normalised to fixed package versions per release. MIT

Is CVE-2025-38166 in your stack? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.

Check with Fencer

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2025-38166 updated cvss 5.5

kernel: bpf: fix ktls panic with sockmap

  • Red Hat Enterprise Linux 8 perf, kernel, bpftool, kernel-rt, kernel-core, kernel-tools, +29 more Red Hat Enterprise Linux 9 kernel-rt, kernel-rt-kvm, kernel-rt-core, kernel-rt-modules, kernel-rt-debug-kvm, kernel-rt-debug-core, +12 more
    affected: no fix available “Fix deferred”
  • Red Hat Enterprise Linux AppStream (v. 9) rv 5.14.0-687.5.1.el9_8, perf 5.14.0-687.5.1.el9_8, rtla 5.14.0-687.5.1.el9_8, python3-perf 5.14.0-687.5.1.el9_8, kernel-devel-matched 5.14.0-687.5.1.el9_8, kernel-64k-devel-matched 5.14.0-687.5.1.el9_8, +7 more
    fixed: vendor fix RHSA-2026:18587
  • Red Hat Enterprise Linux AppStream (v. 10) rv 6.12.0-211.7.1.el10_2, perf 6.12.0-211.7.1.el10_2, rtla 6.12.0-211.7.1.el10_2, python3-perf 6.12.0-211.7.1.el10_2, kernel-devel-matched 6.12.0-211.7.1.el10_2, kernel-64k-devel-matched 6.12.0-211.7.1.el10_2, +7 more
    fixed: vendor fix RHSA-2026:18134
  • Red Hat Enterprise Linux BaseOS (v. 9) kernel 5.14.0-687.5.1.el9_8, kernel-64k 5.14.0-687.5.1.el9_8, kernel-core 5.14.0-687.5.1.el9_8, kernel-tools 5.14.0-687.5.1.el9_8, kernel-modules 5.14.0-687.5.1.el9_8, kernel-64k-core 5.14.0-687.5.1.el9_8, +27 more
    fixed: vendor fix RHSA-2026:18587
  • Red Hat Enterprise Linux BaseOS (v. 10) kernel 6.12.0-211.7.1.el10_2, kernel-64k 6.12.0-211.7.1.el10_2, kernel-core 6.12.0-211.7.1.el10_2, kernel-tools 6.12.0-211.7.1.el10_2, kernel-modules 6.12.0-211.7.1.el10_2, kernel-64k-core 6.12.0-211.7.1.el10_2, +28 more
    fixed: vendor fix RHSA-2026:18134
  • Red Hat Enterprise Linux CodeReady Linux Builder (v. 9) libperf 5.14.0-687.5.1.el9_8, kernel-debuginfo-common-s390x 5.14.0-687.5.1.el9_8, kernel-debuginfo-common-x86_64 5.14.0-687.5.1.el9_8, kernel-debuginfo-common-aarch64 5.14.0-687.5.1.el9_8, kernel-debuginfo-common-ppc64le 5.14.0-687.5.1.el9_8
    fixed: vendor fix RHSA-2026:18587
  • Red Hat Enterprise Linux CodeReady Linux Builder (v. 10) libperf 6.12.0-211.7.1.el10_2, kernel-debuginfo-common-s390x 6.12.0-211.7.1.el10_2, kernel-debuginfo-common-x86_64 6.12.0-211.7.1.el10_2, kernel-debuginfo-common-aarch64 6.12.0-211.7.1.el10_2, kernel-debuginfo-common-ppc64le 6.12.0-211.7.1.el10_2
    fixed: vendor fix RHSA-2026:18134
  • Red Hat Enterprise Linux Real Time (v. 9) kernel-rt 5.14.0-687.5.1.el9_8, kernel-rt-64k 5.14.0-687.5.1.el9_8, kernel-rt-core 5.14.0-687.5.1.el9_8, kernel-rt-modules 5.14.0-687.5.1.el9_8, kernel-rt-64k-core 5.14.0-687.5.1.el9_8, kernel-rt-debug-core 5.14.0-687.5.1.el9_8, +14 more
    fixed: vendor fix RHSA-2026:18587
show 4 more
  • Red Hat Enterprise Linux Real Time (v. 10) kernel-rt 6.12.0-211.7.1.el10_2, kernel-rt-64k 6.12.0-211.7.1.el10_2, kernel-rt-core 6.12.0-211.7.1.el10_2, kernel-rt-modules 6.12.0-211.7.1.el10_2, kernel-rt-64k-core 6.12.0-211.7.1.el10_2, kernel-rt-debug-core 6.12.0-211.7.1.el10_2, +14 more
    fixed: vendor fix RHSA-2026:18134
  • Red Hat Enterprise Linux Real Time for NFV (v. 9) kernel-rt 5.14.0-687.5.1.el9_8, kernel-rt-core 5.14.0-687.5.1.el9_8, kernel-rt-modules 5.14.0-687.5.1.el9_8, kernel-rt-debug-core 5.14.0-687.5.1.el9_8, kernel-rt-modules-core 5.14.0-687.5.1.el9_8, kernel-rt-debug-modules 5.14.0-687.5.1.el9_8, +4 more
    fixed: vendor fix RHSA-2026:18587
  • Red Hat Enterprise Linux Real Time for NFV (v. 10) kernel-rt 6.12.0-211.7.1.el10_2, kernel-rt-core 6.12.0-211.7.1.el10_2, kernel-rt-modules 6.12.0-211.7.1.el10_2, kernel-rt-debug-core 6.12.0-211.7.1.el10_2, kernel-rt-modules-core 6.12.0-211.7.1.el10_2, kernel-rt-debug-modules 6.12.0-211.7.1.el10_2, +4 more
    fixed: vendor fix RHSA-2026:18134
  • Red Hat Enterprise Linux 6 perf, kernel, python-perf, kernel-kdump, kernel-firmware, kernel-bootwrapper, +1 more Red Hat Enterprise Linux 7 perf, kernel, bpftool, kernel-rt, python-perf, kernel-kdump, +8 more
    not affected: vulnerable code not present

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

CISA SSVC

Exploitation
none
Automatable
no
Technical impact
total
Assessed
25d ago

Exploit prediction

0.20% chance of exploitation in the next 30 days, higher than 10% of all scored CVEs (FIRST EPSS, 2026-11-09).

CVSS scores

assigned by version score vector
CNA 3.1 7.8 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD 3.1 5.5 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Affected products

  • Linux Linux

Classification

Technology feeds

References

Sources

Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.