CVE-2023-52986

Source
https://cve.org/CVERecord?id=CVE-2023-52986
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2023-52986.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2023-52986
Downstream
Related
Published
2025-03-27T16:43:23.617Z
Modified
2026-03-20T12:32:53.787765Z
Summary
bpf, sockmap: Check for any of tcp_bpf_prots when cloning a listener
Details

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

bpf, sockmap: Check for any of tcpbpfprots when cloning a listener

A listening socket linked to a sockmap has its skprot overridden. It points to one of the struct proto variants in tcpbpf_prots. The variant depends on the socket's family and which sockmap programs are attached.

A child socket cloned from a TCP listener initially inherits their skprot. But before cloning is finished, we restore the child's proto to the listener's original non-tcpbpfprots one. This happens in tcpcreateopenreqchild -> tcpbpfclone.

Today, in tcpbpfclone we detect if the child's proto should be restored by checking only for the TCPBPFBASE proto variant. This is not correct. The skprot of listening socket linked to a sockmap can point to to any variant in tcpbpf_prots.

If the listeners skprot happens to be not the TCPBPFBASE variant, then the child socket unintentionally is left if the inherited skprot by tcpbpfclone.

This leads to issues like infinite recursion on close [1], because the child state is otherwise not set up for use with tcpbpfprot operations.

Adjust the check in tcpbpfclone to detect all of tcpbpfprots variants.

Note that it wouldn't be sufficient to check the socket state when overriding the skprot in tcpbpfupdateproto in order to always use the TCPBPFBASE variant for listening sockets. Since commit b8b8315e39ff ("bpf, sockmap: Remove unhash handler for BPF sockmap usage") it is possible for a socket to transition to TCPLISTEN state while already linked to a sockmap, e.g. connect() -> insert into map -> connect(AFUNSPEC) -> listen().

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/52xxx/CVE-2023-52986.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
e80251555f0befd1271e74b080bccf0ff0348bfc
Fixed
9bd6074e1872d22190a8da30e796cbf937d334f0
Fixed
c681d7a4ed3d360de0574f4d6b7305a8de8dc54f
Fixed
12b0ec7c6953e1602957926439e5297095d7d065
Fixed
ddce1e091757d0259107c6c0c7262df201de2b66

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2023-52986.json"