CVE-2025-38154: bpf, sockmap: Avoid using sk_socket after free when sending
In the Linux kernel, the following vulnerability has been resolved:
bpf, sockmap: Avoid using sk_socket after free when sending
The sk->sk_socket is not locked or referenced in backlog thread, and
during the call to skb_send_sock(), there is a race condition with
the release of sk_socket. All types of sockets(tcp/udp/unix/vsock)
will be affected.
Race conditions:
'''
CPU0 CPU1
backlog::skb_send_sock
sendmsg_unlocked
sock_sendmsg
sock_sendmsg_nosec
close(fd):
...
ops->release() -> sock_map_close()
sk_socket->ops = NULL
free(socket)
sock->ops->sendmsg
^
panic here
'''
The ref of psock become 0 after sock_map_close() executed.
'''
void sock_map_close()
{
...
if (likely(psock)) {
...
// !! here we remove psock and the ref of psock become 0
sock_map_remove_links(sk, psock)
psock = sk_psock_get(sk);
if (unlikely(!psock))
goto no_psock; <=== Control jumps here via goto
...
cancel_delayed_work_sync(&psock->work); <=== not executed
sk_psock_put(sk, psock);
...
}
'''
Based on the fact that we already wait for the workqueue to finish in
sock_map_close() if psock is held, we simply increase the psock
reference count to avoid race conditions.
With this patch, if the backlog thread is running, sock_map_close() will
wait for the backlog thread to complete and cancel all pending work.
If no backlog running, any pending work that hasn't started by then will
fail when invoked by sk_psock_get(), as the psock reference count have
been zeroed, and sk_psock_drop() will cancel all jobs via
cancel_delayed_work_sync().
In summary, we require synchronization to coordinate the backlog thread
and close() thread.
The panic I catched:
'''
Workqueue: events sk_psock_backlog
RIP: 0010:sock_sendmsg+0x21d/0x440
RAX: 0000000000000000 RBX: ffffc9000521fad8 RCX: 0000000000000001
...
Call Trace:
<TASK>
? die_addr+0x40/0xa0
? exc_general_protection+0x14c/0x230
? asm_exc_general_protection+0x26/0x30
? sock_sendmsg+0x21d/0x440
? sock_sendmsg+0x3e0/0x440
? __pfx_sock_sendmsg+0x10/0x10
__skb_send_sock+0x543/0xb70
sk_psock_backlog+0x247/0xb80
...
'''
Security readout for executives and security teams
Plain-English summary
A timing flaw in Linux BPF sockmap handling can use a socket after it has been closed and freed. A low-privileged local user or workload may be able to trigger serious kernel failure; the report demonstrates a panic. The supplied evidence does not establish a practical path to data theft, modification, or privilege escalation.
Executive priority
Treat this as expedited kernel maintenance, especially on multi-tenant systems or hosts exposing BPF facilities to untrusted workloads. Accelerate remediation where kernel crashes have appeared. The sources do not support declaring an active-exploitation emergency, but the local low-privilege vector and potential system-wide impact justify high priority.
Technical view
The sockmap backlog worker calls skb_send_sock() without holding a reference to sk_socket, allowing close() to free the socket before sendmsg dereferences its operations table. The stable fix retains the psock reference so sock_map_close() synchronizes with active backlog work and cancels pending work safely.
Likely exposure
Likely exposure is Linux hosts where a low-privileged local user or workload can exercise BPF sockmap send paths. The bundle says TCP, UDP, Unix, and vsock sockets are affected. Its mixed commit and release data, including an ambiguous "0" entry, is insufficient for reliable distribution-package mapping; verify each vendor kernel.
Exploitation context
The record is not in KEV, and the supplied sources do not report active exploitation or a public proof of concept. CVSS describes a local, low-complexity attack requiring low privileges and no user interaction. Evidence in the bundle demonstrates a kernel panic, not a practical privilege-escalation technique.
Researcher notes
This is a race-driven use-after-free involving sk_socket lifetime during asynchronous sockmap backlog sending. The bundle reports an observed panic and rates confidentiality, integrity, and availability impacts high, but it does not demonstrate those broader outcomes. Exact affected package boundaries and exploitability under distribution-specific BPF restrictions require local verification.
Mitigation direction
Inventory running kernels and map distribution packages to vendor advisories or the cited stable fixes.
Install the vendor-supplied kernel containing the backported fix, then reboot into it.
Until patched, reduce untrusted local access and unnecessary BPF sockmap use after compatibility review.
Confirm backport status with the distributor rather than relying only on upstream version numbers.
Validation and detection
Confirm the running kernel after reboot matches the patched vendor package.
Verify applicable source contains the psock reference-count synchronization from the cited stable commits.
Review kernel logs for sock_sendmsg faults, sk_psock_backlog crashes, or general-protection faults.
Test legitimate TCP, UDP, Unix, and vsock sockmap workloads for stability after remediation.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2025-38154 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
1CVSS vectors
3Timeline events
1ADP providers
8Source links
CVSS vector scores
1 official score
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.