KaFai Wan
54377fcab5
bpf: Reject TCP_NODELAY in bpf-tcp-cc
...
A BPF TCP congestion control program can call bpf_setsockopt() from
its callbacks. In current kernels, if it calls
bpf_setsockopt(TCP_NODELAY) from cwnd_event_tx_start(), the call can
re-enter the TCP transmit path before the outer tcp_transmit_skb()
has completed and advanced the send head.
This can re-trigger CA_EVENT_TX_START and lead to unbounded recursion:
tcp_transmit_skb()
-> tcp_event_data_sent()
-> tcp_ca_event(sk, CA_EVENT_TX_START)
-> cwnd_event_tx_start()
-> bpf_setsockopt(TCP_NODELAY)
-> tcp_push_pending_frames()
-> tcp_write_xmit()
-> tcp_transmit_skb()
This leads to unbounded recursion and can overflow the kernel stack.
Reject TCP_NODELAY with -EOPNOTSUPP for bpf-tcp-cc by introducing
a dedicated setsockopt proto for BPF_PROG_TYPE_STRUCT_OPS TCP
congestion control programs. To keep it simple, all tcp-cc ops is
rejected for TCP_NODELAY.
Fixes: 7e41df5dbb ("bpf: Add a few optnames to bpf_setsockopt")
Suggested-by: Martin KaFai Lau <martin.lau@linux.dev >
Signed-off-by: KaFai Wan <kafai.wan@linux.dev >
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org >
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev >
Link: https://patch.msgid.link/20260421155804.135786-3-kafai.wan@linux.dev
2026-04-22 12:58:57 -07:00
..
2026-04-13 19:03:11 -07:00
2026-04-08 19:38:52 -07:00
2026-04-16 20:34:34 -07:00
2026-04-04 20:41:25 +02:00
2026-04-13 20:10:58 -07:00
2026-04-05 13:53:04 -07:00
2026-04-15 09:20:49 -07:00
2026-04-16 08:01:16 -07:00
2026-04-15 14:15:25 -07:00
2026-04-17 21:51:05 +02:00
2026-04-08 07:51:26 +02:00
2026-04-17 10:29:01 -07:00
2026-04-02 23:36:21 -07:00
2026-04-06 09:37:50 -05:00
2026-04-06 09:37:51 -05:00
2026-04-15 17:15:18 -07:00
2026-04-17 14:18:55 -07:00
2026-04-11 11:53:54 +01:00
2026-04-05 13:53:07 -07:00
2026-04-15 08:32:10 -07:00
2026-04-09 21:40:22 +02:00
2026-04-13 14:56:54 -07:00
2026-04-03 16:53:50 -04:00
2026-04-07 08:22:24 -06:00
2026-04-09 13:28:05 -04:00
2026-04-13 15:51:31 -07:00
2026-04-10 21:22:32 -07:00
2026-04-16 07:03:40 -07:00
2026-04-06 18:37:52 -07:00
2026-04-22 12:58:57 -07:00
2026-04-12 11:33:23 -07:00
2026-04-04 08:10:37 -06:00
2026-04-15 10:54:24 -07:00
2026-04-11 07:58:33 +02:00
2026-04-14 10:53:44 -07:00
2026-04-15 08:37:45 -07:00
2026-04-04 18:40:58 -06:00
2026-04-04 20:55:56 +02:00
2026-04-07 15:32:20 +02:00
2026-04-02 23:36:24 -07:00
2026-04-05 13:53:28 -07:00
2026-04-05 13:53:19 -07:00
2026-04-14 12:01:12 -05:00
2026-04-17 11:24:00 -07:00
2026-04-08 15:27:47 +02:00
2026-04-03 16:48:01 -07:00
2026-04-06 20:21:37 -06:00
2026-04-14 16:48:56 -07:00
2026-04-16 07:03:40 -07:00
2026-04-05 13:53:07 -07:00
2026-04-05 13:53:07 -07:00
2026-04-07 17:38:07 +02:00
2026-04-15 12:59:16 -07:00
2026-04-06 20:21:37 -06:00
2026-04-06 20:21:37 -06:00
2026-04-08 14:23:29 -07:00
2026-04-16 21:07:13 +02:00
2026-04-12 16:46:29 +08:00
2026-04-05 13:53:45 -07:00
2026-04-05 13:53:25 -07:00
2026-04-15 12:59:16 -07:00
2026-04-06 09:43:18 -05:00
2026-04-05 13:53:44 -07:00
2026-04-07 15:36:02 +02:00
2026-04-08 08:55:15 +02:00
2026-04-12 15:20:46 -07:00
2026-04-13 15:09:49 +02:00
2026-04-13 16:22:30 -07:00
2026-04-15 12:59:16 -07:00
2026-04-09 13:18:27 +01:00
2026-04-14 23:03:02 -07:00
2026-04-09 10:52:35 -04:00
2026-04-05 13:53:28 -07:00
2026-04-13 10:10:28 -07:00
2026-04-05 13:53:04 -07:00
2026-04-09 14:36:52 +02:00
2026-04-09 14:36:52 +02:00
2026-04-05 13:53:40 -07:00
2026-04-03 19:39:52 +02:00
2026-04-13 19:00:43 +02:00
2026-04-05 13:53:46 -07:00
2026-04-03 16:53:50 -04:00
2026-04-13 15:42:19 -07:00
2026-04-03 16:53:50 -04:00
2026-04-05 13:52:55 -07:00
2026-04-18 11:29:14 -07:00
2026-04-05 13:53:04 -07:00
2026-04-05 13:53:00 -07:00
2026-04-05 13:53:32 -07:00
2026-04-05 13:53:33 -07:00
2026-04-05 13:53:01 -07:00
2026-04-02 18:03:03 -07:00
2026-04-05 13:53:36 -07:00
2026-04-05 13:53:45 -07:00
2026-04-18 11:29:14 -07:00
2026-04-05 13:53:41 -07:00
2026-04-08 13:18:57 -07:00
2026-04-15 12:59:16 -07:00
2026-04-15 12:59:16 -07:00
2026-04-13 14:56:28 -07:00
2026-04-14 18:36:10 -07:00
2026-04-13 15:51:31 -07:00
2026-04-17 14:09:02 -07:00
2026-04-05 13:53:12 -07:00
2026-04-05 13:53:17 -07:00
2026-04-05 13:53:19 -07:00
2026-04-05 13:53:10 -07:00
2026-04-10 17:27:39 -05:00
2026-04-04 16:14:37 +05:30
2026-04-06 16:55:16 +02:00
2026-04-15 14:41:21 -07:00
2026-04-05 13:53:35 -07:00
2026-04-12 11:33:23 -07:00
2026-04-07 12:24:49 -07:00
2026-04-10 11:46:15 +01:00
2026-04-06 09:37:51 -05:00
2026-04-14 13:33:36 -07:00
2026-04-13 15:42:19 -07:00
2026-04-12 10:54:31 -07:00
2026-04-05 13:53:06 -07:00
2026-04-13 19:03:11 -07:00
2026-04-08 12:30:31 +02:00
2026-04-17 09:43:12 -07:00
2026-04-05 13:53:08 -07:00
2026-04-13 08:39:51 -07:00
2026-04-05 13:53:44 -07:00
2026-04-05 13:53:41 -07:00
2026-04-04 00:47:50 +02:00
2026-04-05 13:52:58 -07:00
2026-04-05 13:53:04 -07:00
2026-04-04 00:45:14 +02:00
2026-04-05 13:53:07 -07:00