tcp_bpf: Call sk_msg_free() when tcp_bpf_send_verdict() fails to allocate psock->cork.
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 4f738adba30a7cfc006f605707e7aee847ffefa0 · < 539920180c55f5e13a2488a2339f94e6b8cb69e0| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
tcp_bpf: Call sk_msg_free() when tcp_bpf_send_verdict() fails to allocate psock->cork.
syzbot reported the splat below. [0]
The repro does the following:
1. Load a sk_msg prog that calls bpf_msg_cork_bytes(msg, cork_bytes) 2. Attach the prog to a SOCKMAP 3. Add a socket to the SOCKMAP 4. Activate fault injection 5. Send data less than cork_bytes
At 5., the data is carried over to the next sendmsg() as it is smaller than the cork_bytes specified by bpf_msg_cork_bytes().
Then, tcp_bpf_send_verdict() tries to allocate psock->cork to hold the data, but this fails silently due to fault injection + __GFP_NOWARN.
If the allocation fails, we need to revert the sk->sk_forward_alloc change done by sk_msg_alloc().
From the CVE record · Linux
The Linux kernel’s tcp_bpf code fails to undo a socket accounting change when it cannot allocate memory for corked data. A local reproducer that loads and attaches a sk_msg BPF program, adds a socket to a SOCKMAP, enables fault injection, and sends less data than the configured cork size triggers a kernel warning.
Engineers running Linux kernels with tcp_bpf should check their kernel’s fix status; affected versions were not provided.