[PATCH bpf-next v4 0/4] bpf: Reject TCP_NODELAY in TCP header option

From: KaFai Wan

Date: Tue Apr 21 2026 - 11:59:12 EST


This small patchset is about avoid infinite recursion in TCP header option callbacks
and bpf-tcp-cc callbacks via TCP_NODELAY setsockopt.

v4:
- Fix the test case for TCP header option callbacks (Martin and Jiayuan)
- Reject TCP_NODELAY in bpf-tcp-cc callbacks (AI and Martin)
- Add a test case for bpf-tcp-cc

v3:
- Remove CONFIG_INET check and add comment (Martin and Jiayuan)
- Fix the test case (Martin)
https://lore.kernel.org/bpf/20260417092035.2299913-1-kafai.wan@xxxxxxxxx/

v2:
- Reject TCP_NODELAY in bpf_sock_ops_setsockopt() (AI and Martin)
https://lore.kernel.org/bpf/20260416112308.1820332-1-kafai.wan@xxxxxxxxx/

v1:
https://lore.kernel.org/bpf/20260414112310.1285783-1-kafai.wan@xxxxxxxxx/

---
KaFai Wan (4):
bpf: Reject TCP_NODELAY in TCP header option callbacks
bpf: Reject TCP_NODELAY in bpf-tcp-cc
selftests/bpf: Test TCP_NODELAY in TCP hdr opt callbacks
selftests/bpf: Verify bpf-tcp-cc rejects TCP_NODELAY

include/linux/bpf.h | 1 +
net/core/filter.c | 30 +++++++++++++++++++
net/ipv4/bpf_tcp_ca.c | 2 +-
.../selftests/bpf/prog_tests/bpf_tcp_ca.c | 4 +++
.../bpf/prog_tests/tcp_hdr_options.c | 6 ++++
tools/testing/selftests/bpf/progs/bpf_cubic.c | 12 ++++++++
.../bpf/progs/test_misc_tcp_hdr_options.c | 15 +++++++++-
7 files changed, 68 insertions(+), 2 deletions(-)

--
2.43.0