* [PATCH net v3 0/2] tcp: initialize missing request_sock fields in syncookie path
@ 2026-11-17 12:47 Thaison Phan
2026-11-17 12:47 ` [PATCH net v3 1/2] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check() Thaison Phan
2026-11-17 12:47 ` [PATCH net v3 2/2] tcp: accecn: initialize AccECN fields in syncookie path Thaison Phan
0 siblings, 2 replies; 6+ messages in thread
From: Thaison Phan @ 2026-11-17 12:47 UTC (permalink / raw)
To: Eric Dumazet, Neal Cardwell, Kuniyuki Iwashima, David S . Miller,
David Ahern, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Ilpo Järvinen, Olivier Tilmans, Chia-Yu Chang,
Stan Iliev, netdev, bpf, linux-kernel, Thaison Phan
Initialize missing request_sock fields for TCP connections accepted via
SYN cookies, where cookie_tcp_reqsk_alloc() and
bpf_sk_assign_tcp_reqsk() allocate without __GFP_ZERO:
- Patch 1 initializes ireq->ir_rmt_addr and ireq->ir_loc_addr to
LOOPBACK4_IPV6 in cookie_v6_check(), matching tcp_v6_init_req().
- Patch 2 initializes saw_accecn_opt, accecn_fail_mode, and syn_ect_rcv
in cookie_tcp_reqsk_init() and sets syn_ect_snt in
cookie_{v4,v6}_check(), matching tcp_openreq_init() and
tcp_{v4,v6}_send_synack().
An AI coding assistant helped audit the request_sock initialization
paths, write the QEMU reproducer, and draft the changelogs.
v3:
- Patch 2: clarify syn_ect_snt / tcp_accecn_third_ack() description
for AccECN connections and reference RFC 9768 Table 4
(Chia-Yu Chang)
v2: https://lore.kernel.org/netdev/20261116023709.132684-1-thaisonphan@google.com/
- Patch 1: clarify how KASAN (via SLUB_RCU_DEBUG) exposed the bug,
explain how it was observed, and include the inet_sock_set_state
trace line (Eric Dumazet)
- Patch 2: drop redundant treq->syn_ect_snt = 0 in
cookie_tcp_reqsk_init() and clarify how the bug was found and
observed via TCP_INFO (Eric Dumazet)
- Add Eric Dumazet's Reviewed-by tags
v1: https://lore.kernel.org/netdev/20261114161248.3428695-1-thaisonphan@google.com/
Thaison Phan (2):
tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check()
tcp: accecn: initialize AccECN fields in syncookie path
net/ipv4/syncookies.c | 4 ++++
net/ipv6/syncookies.c | 4 ++++
2 files changed, 8 insertions(+)
base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4
--
2.56.1.703.gf848ed807c-goog
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH net v3 1/2] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check() 2026-11-17 12:47 [PATCH net v3 0/2] tcp: initialize missing request_sock fields in syncookie path Thaison Phan @ 2026-11-17 12:47 ` Thaison Phan 2026-11-17 12:47 ` [PATCH net v3 2/2] tcp: accecn: initialize AccECN fields in syncookie path Thaison Phan 1 sibling, 0 replies; 6+ messages in thread From: Thaison Phan @ 2026-11-17 12:47 UTC (permalink / raw) To: Eric Dumazet, Neal Cardwell, Kuniyuki Iwashima, David S . Miller, David Ahern, Jakub Kicinski, Paolo Abeni Cc: Simon Horman, Ilpo Järvinen, Olivier Tilmans, Chia-Yu Chang, Stan Iliev, netdev, bpf, linux-kernel, Thaison Phan Commit a3a128f611a9 ("inet: consolidate inet_csk_clone_lock()") moved the LOOPBACK4_IPV6 initialization for passive IPv6 TCP sockets from tcp_v6_syn_recv_sock() to tcp_v6_init_req(). IPv6 SYN cookie connections allocate a fresh request_sock without __GFP_ZERO and call tcp_v6_syn_recv_sock() without tcp_v6_init_req(), leaving ireq->ir_rmt_addr and ireq->ir_loc_addr uninitialized in cookie_v6_check(). inet_csk_clone_lock() then copies uninitialized slab bytes into sk_daddr, sk_rcv_saddr, and inet_saddr, exposing them to tracepoints and bpf_sock and causing inet_daddr != LOOPBACK4_IPV6 checks (such as IP_OPTIONS in do_ip_setsockopt()) to misclassify native IPv6 child sockets as IPv4-mapped. This was originally noticed via an out-of-tree socket hook observing inet_sk(sk)->inet_saddr != LOOPBACK4_IPV6 on KASAN test runs. KASAN enables SLUB_RCU_DEBUG by default, introducing an RCU grace period that prevents cookie_v6_check() from reusing the warm request_sock initialized during the initial SYN. Upstream, with tcp_syncookies=2, SLUB_RCU_DEBUG=y, and slub_debug=P, sock:inet_sock_set_state shows slab poison instead of 127.0.0.6: ... sock:inet_sock_set_state: family=AF_INET6 protocol=IPPROTO_TCP \ sport=59839 dport=41050 \ saddr=90.90.90.90 daddr=90.90.90.90 \ saddrv6=::1 daddrv6=::1 \ oldstate=TCP_LISTEN newstate=TCP_SYN_RECV Initialize ireq->ir_rmt_addr and ireq->ir_loc_addr to LOOPBACK4_IPV6 in cookie_v6_check() to match tcp_v6_init_req(). Tested against a QEMU reproducer checking inet_sock_set_state and IP_OPTIONS, as well as the packetdrill syncookie selftests. Fixes: a3a128f611a9 ("inet: consolidate inet_csk_clone_lock()") Signed-off-by: Thaison Phan <thaisonphan@google.com> Reviewed-by: Eric Dumazet <edumazet@kernel.org> --- v3: - no changes v2: https://lore.kernel.org/netdev/20261116023709.132684-2-thaisonphan@google.com/ - clarify how KASAN (via SLUB_RCU_DEBUG) exposed the uninitialized request_sock, how the issue was observed, and include the inet_sock_set_state trace line (Eric Dumazet) - add Reviewed-by tag from Eric Dumazet v1: https://lore.kernel.org/netdev/20261114161248.3428695-2-thaisonphan@google.com/ net/ipv6/syncookies.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index b581cb1ee2e8..b33011b71fff 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c @@ -17,6 +17,7 @@ #include <net/ipv6.h> #include <net/tcp.h> #include <net/tcp_ecn.h> +#include <net/transp_v6.h> #define COOKIEBITS 24 /* Upper bits store count */ #define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1) @@ -205,6 +206,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr; ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr; + ireq->ir_rmt_addr = LOOPBACK4_IPV6; + ireq->ir_loc_addr = LOOPBACK4_IPV6; if (security_inet_conn_request(sk, skb, req)) { SKB_DR_SET(reason, SECURITY_HOOK); -- 2.56.1.703.gf848ed807c-goog ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net v3 2/2] tcp: accecn: initialize AccECN fields in syncookie path 2026-11-17 12:47 [PATCH net v3 0/2] tcp: initialize missing request_sock fields in syncookie path Thaison Phan 2026-11-17 12:47 ` [PATCH net v3 1/2] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check() Thaison Phan @ 2026-11-17 12:47 ` Thaison Phan 2026-11-17 18:06 ` Matthieu Baerts ` (2 more replies) 1 sibling, 3 replies; 6+ messages in thread From: Thaison Phan @ 2026-11-17 12:47 UTC (permalink / raw) To: Eric Dumazet, Neal Cardwell, Kuniyuki Iwashima, David S . Miller, David Ahern, Jakub Kicinski, Paolo Abeni Cc: Simon Horman, Ilpo Järvinen, Olivier Tilmans, Chia-Yu Chang, Stan Iliev, netdev, bpf, linux-kernel, Thaison Phan cookie_tcp_reqsk_alloc() and bpf_sk_assign_tcp_reqsk() allocate struct request_sock without __GFP_ZERO, leaving saw_accecn_opt, accecn_fail_mode, syn_ect_rcv, and syn_ect_snt uninitialized. When accecn_ok is negotiated in cookie_{v4,v6}_check(), tcp_ecn_openreq_child() reads all four fields to initialize the child socket's AccECN state. In addition, because the temporary request_sock used to send a cookie SYN-ACK is immediately freed, treq->syn_ect_snt is lost. For AccECN connections where the listener marks ECT on the SYN-ACK, leaving syn_ect_snt as 0 causes tcp_accecn_third_ack() to see a mismatch between the expected Not-ECT and the peer's reflected ECT in the ACE field, erroneously flagging TCP_ACCECN_ACE_FAIL_RECV in accecn_fail_mode. Refer to Table 4 of RFC 9768 for more details. Initialize saw_accecn_opt, accecn_fail_mode, and syn_ect_rcv in cookie_tcp_reqsk_init() to match tcp_openreq_init(), and set syn_ect_snt from the listener's TOS/tclass in cookie_{v4,v6}_check() to match tcp_{v4,v6}_send_synack(). Found by AI-assisted code inspection comparing tcp_openreq_init() and cookie_tcp_reqsk_init() while investigating the cookie_v6_check() LOOPBACK4_IPV6 bug. Reproduced in a QEMU VM with tcp_syncookies=2, tcp_ecn=3, SLUB_RCU_DEBUG=y, and slub_debug=P, observing bogus tcpi_accecn_fail_mode and tcpi_accecn_opt_seen values in TCP_INFO on the accepted child socket (and tcpi_accecn_fail_mode=0x2 on ECT(0) listeners), and tested with packetdrill AccECN and syncookie selftests. Fixes: 3cae34274c79 ("tcp: accecn: AccECN negotiation") Fixes: b40671b5ee58 ("tcp: accecn: AccECN option failure handling") Signed-off-by: Thaison Phan <thaisonphan@google.com> Reviewed-by: Eric Dumazet <edumazet@kernel.org> --- v3: - clarify syn_ect_snt / tcp_accecn_third_ack() description for AccECN connections and reference RFC 9768 Table 4 (Chia-Yu Chang) v2: https://lore.kernel.org/netdev/20261116023709.132684-3-thaisonphan@google.com/ - drop redundant treq->syn_ect_snt = 0 in cookie_tcp_reqsk_init() (Eric Dumazet) - clarify how the bug was discovered and observed via TCP_INFO (Eric Dumazet) - add Reviewed-by tag from Eric Dumazet v1: https://lore.kernel.org/netdev/20261114161248.3428695-3-thaisonphan@google.com/ net/ipv4/syncookies.c | 4 ++++ net/ipv6/syncookies.c | 1 + 2 files changed, 5 insertions(+) diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 4e0ff3b82062..1a837ed6efa0 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c @@ -290,6 +290,9 @@ static int cookie_tcp_reqsk_init(struct sock *sk, struct sk_buff *skb, */ treq->txhash = treq->snt_isn; treq->syn_tos = TCP_SKB_CB(skb)->ip_dsfield; + treq->saw_accecn_opt = TCP_ACCECN_OPT_NOT_SEEN; + treq->accecn_fail_mode = 0; + treq->syn_ect_rcv = 0; #if IS_ENABLED(CONFIG_MPTCP) treq->is_mptcp = sk_is_mptcp(sk); @@ -502,6 +505,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) ireq->rcv_wscale = rcv_wscale; ireq->ecn_ok &= cookie_ecn_ok(net, &rt->dst); treq->accecn_ok = ireq->ecn_ok && cookie_accecn_ok(th); + treq->syn_ect_snt = READ_ONCE(inet_sk(sk)->tos) & INET_ECN_MASK; ret = tcp_get_cookie_sock(sk, skb, req, &rt->dst); /* ip_queue_xmit() depends on our flow being setup diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index b33011b71fff..7435ebcc366c 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c @@ -276,6 +276,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) ireq->rcv_wscale = rcv_wscale; ireq->ecn_ok &= cookie_ecn_ok(net, dst); tcp_rsk(req)->accecn_ok = ireq->ecn_ok && cookie_accecn_ok(th); + tcp_rsk(req)->syn_ect_snt = READ_ONCE(np->tclass) & INET_ECN_MASK; ret = tcp_get_cookie_sock(sk, skb, req, dst); if (!ret) { -- 2.56.1.703.gf848ed807c-goog ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net v3 2/2] tcp: accecn: initialize AccECN fields in syncookie path 2026-11-17 12:47 ` [PATCH net v3 2/2] tcp: accecn: initialize AccECN fields in syncookie path Thaison Phan @ 2026-11-17 18:06 ` Matthieu Baerts [not found] ` <sashiko-outbox-220941@kernel.org> 2026-11-19 12:47 ` netdev-bot+sashiko 2 siblings, 0 replies; 6+ messages in thread From: Matthieu Baerts @ 2026-11-17 18:06 UTC (permalink / raw) To: Thaison Phan Cc: Eric Dumazet, Neal Cardwell, Kuniyuki Iwashima, David S . Miller, David Ahern, Jakub Kicinski, Paolo Abeni, Simon Horman, Ilpo Järvinen, Olivier Tilmans, Chia-Yu Chang, Stan Iliev, netdev, bpf, linux-kernel Hi Thaison, On 17/11/2026 13:47, Thaison Phan wrote: > cookie_tcp_reqsk_alloc() and bpf_sk_assign_tcp_reqsk() allocate struct > request_sock without __GFP_ZERO, leaving saw_accecn_opt, > accecn_fail_mode, syn_ect_rcv, and syn_ect_snt uninitialized. When > accecn_ok is negotiated in cookie_{v4,v6}_check(), > tcp_ecn_openreq_child() reads all four fields to initialize the child > socket's AccECN state. > > In addition, because the temporary request_sock used to send a cookie > SYN-ACK is immediately freed, treq->syn_ect_snt is lost. For AccECN > connections where the listener marks ECT on the SYN-ACK, leaving > syn_ect_snt as 0 causes tcp_accecn_third_ack() to see a mismatch between > the expected Not-ECT and the peer's reflected ECT in the ACE field, > erroneously flagging TCP_ACCECN_ACE_FAIL_RECV in accecn_fail_mode. Refer > to Table 4 of RFC 9768 for more details. > > Initialize saw_accecn_opt, accecn_fail_mode, and syn_ect_rcv in > cookie_tcp_reqsk_init() to match tcp_openreq_init(), and set syn_ect_snt > from the listener's TOS/tclass in cookie_{v4,v6}_check() to match > tcp_{v4,v6}_send_synack(). I missed the v3: Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Cheers, Matt -- Sponsored by the NGI0 Core fund. ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <sashiko-outbox-220941@kernel.org>]
* Re: [PATCH net v3 2/2] tcp: accecn: initialize AccECN fields in syncookie path [not found] ` <sashiko-outbox-220941@kernel.org> @ 2026-11-18 20:16 ` Thaison Phan 0 siblings, 0 replies; 6+ messages in thread From: Thaison Phan @ 2026-11-18 20:16 UTC (permalink / raw) To: sashiko-reviews Cc: Thaison Phan, sashiko-bot, Eric Dumazet, Matthieu Baerts, Neal Cardwell, Kuniyuki Iwashima, David S. Miller, David Ahern, Jakub Kicinski, Paolo Abeni, Simon Horman, Ilpo Järvinen, Olivier Tilmans, Chia-Yu Chang, Stan Iliev, netdev, bpf, linux-kernel On Wed, Nov 18, 2026 at 12:47:28PM +0000, sashiko-bot@kernel.org wrote: > [Severity: Medium] > Does the syncookie path leave tp->saw_accecn_opt stuck at > TCP_ACCECN_OPT_NOT_SEEN when the peer includes an AccECN option on the > third ACK? > > In the normal SYN-RECV path, tcp_check_req() calls tcp_accecn_option_init() > on the third ACK to update treq->saw_accecn_opt and treq->accecn_fail_mode > before tcp_ecn_openreq_child() copies them to the child socket. The > syncookie path bypasses tcp_check_req(), and when tcp_child_process() later > runs tcp_rcv_state_process() -> tcp_ack() on that third ACK, neither > FLAG_FORWARD_PROGRESS nor FLAG_TS_PROGRESS is set, so > __tcp_accecn_process() returns before calling tcp_accecn_process_option(). Agreed, this is a valid observation, though it is pre-existing missing functionality in syncookie AccECN option handling rather than something introduced by this patch. Per Eric's guidance on v2 [1], we will leave 3rd ACK AccECN option initialization for a separate follow-up patch rather than growing this fix series. Marking v3 as changes-requested as I am sending v4 to guard the syn_ect_snt update with !req->syncookie for the BPF custom syncookie path. [1] https://lore.kernel.org/netdev/CAL4Wiir50_Z+m00GyU9BpRdAqgXs8V-L0S8kmmES=JiYyt==gg@mail.gmail.com/ pw-bot: cr ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net v3 2/2] tcp: accecn: initialize AccECN fields in syncookie path 2026-11-17 12:47 ` [PATCH net v3 2/2] tcp: accecn: initialize AccECN fields in syncookie path Thaison Phan 2026-11-17 18:06 ` Matthieu Baerts [not found] ` <sashiko-outbox-220941@kernel.org> @ 2026-11-19 12:47 ` netdev-bot+sashiko 2 siblings, 0 replies; 6+ messages in thread From: netdev-bot+sashiko @ 2026-11-19 12:47 UTC (permalink / raw) To: thaisonphan Cc: edumazet, ncardwell, kuniyu, davem, dsahern, kuba, pabeni, horms, ij, olivier.tilmans, chia-yu.chang, stani, netdev, bpf, linux-kernel Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 2 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] On the BPF custom-syncookie path (bpf_sk_assign_tcp_reqsk() -> cookie_bpf_check()), the patch sets syn_ect_snt from a SYN-ACK the… - [Medium] tcp: accecn: missing 3rd ACK option init in cookie_tcp_reqsk_init() -- tcp: accecn: initialize AccECN fields in syncookie path This patch initializes saw_accecn_opt, accecn_fail_mode and syn_ect_rcv in cookie_tcp_reqsk_init(). That function is shared by the regular syncookie path and the bpf_sk_assign_tcp_reqsk() path. The patch also sets syn_ect_snt from the listener's TOS/tclass in cookie_{v4,v6}_check(), to match what tcp_{v4,v6}_send_synack() would have sent on the wire. > diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c > index 4e0ff3b820627..1a837ed6efa00 100644 > --- a/net/ipv4/syncookies.c > +++ b/net/ipv4/syncookies.c > @@ -290,6 +290,9 @@ static int cookie_tcp_reqsk_init(struct sock *sk, struct sk_buff *skb, > */ > treq->txhash = treq->snt_isn; > treq->syn_tos = TCP_SKB_CB(skb)->ip_dsfield; > + treq->saw_accecn_opt = TCP_ACCECN_OPT_NOT_SEEN; > + treq->accecn_fail_mode = 0; > + treq->syn_ect_rcv = 0; > > #if IS_ENABLED(CONFIG_MPTCP) > treq->is_mptcp = sk_is_mptcp(sk); > @@ -502,6 +505,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) > ireq->rcv_wscale = rcv_wscale; > ireq->ecn_ok &= cookie_ecn_ok(net, &rt->dst); > treq->accecn_ok = ireq->ecn_ok && cookie_accecn_ok(th); > + treq->syn_ect_snt = READ_ONCE(inet_sk(sk)->tos) & INET_ECN_MASK; [Severity: Medium] Does the syncookie path ever look at the AccECN option carried on the third ACK? On the normal SYN-RECV path, tcp_openreq_init() also sets saw_accecn_opt to TCP_ACCECN_OPT_NOT_SEEN. tcp_check_req() then checks tmp_opt.accecn on the third ACK and calls tcp_accecn_option_init() before syn_recv_sock() runs. That updates tcp_rsk(req)->saw_accecn_opt and, when the option was zeroed, ORs TCP_ACCECN_OPT_FAIL_RECV into accecn_fail_mode. tcp_ecn_openreq_child() then copies both fields into the child. cookie_v4_check() and cookie_v6_check() process the third ACK directly and never go through tcp_check_req(). cookie_tcp_check() does call tcp_parse_options(), so tcp_opt.accecn is filled in. Nothing passes it to tcp_accecn_option_init(), though. With this patch, saw_accecn_opt is always TCP_ACCECN_OPT_NOT_SEEN when the child is created, even when the peer did send an AccECN option on the third ACK. The child also does not seem to catch up when it processes the same skb. In tcp_child_process() -> tcp_rcv_state_process() -> tcp_ack(): - snd_una already equals the ACK sequence and there are no packets in flight, so FLAG_FORWARD_PROGRESS is not set. - ts_recent was already copied from req->ts_recent, so FLAG_TS_PROGRESS is not set either. __tcp_accecn_process() therefore returns before it calls tcp_accecn_process_option(). As a result, tp->saw_accecn_opt stays at 0 on the child: - tcp_established_options() requires tp->saw_accecn_opt to be non-zero, so no AccECN options are sent even though accecn_opt_demand is set. - A zeroed option on the third ACK is never detected as TCP_ACCECN_OPT_FAIL_SEEN, and TCP_ACCECN_OPT_FAIL_RECV is never set. - tcpi_accecn_opt_seen in TCP_INFO reads 0 even when an option was received. It is no longer random, but it is still wrong. Should cookie_v4_check() and cookie_v6_check() repeat the tcp_accecn_option_init() step from tcp_check_req() once accecn_ok is known? That would mean passing tcp_opt.accecn out of cookie_tcp_check(), or parsing the options again. The cookie_bpf_check() path would presumably need the same handling. [Severity: Medium] Is this value correct on the BPF custom syncookie path? When cookie_bpf_ok(skb) is true, req comes from cookie_bpf_check(). In that case a tc ingress BPF program built and sent the SYN-ACK. tcp_v4_send_synack() and tcp_v6_send_synack() never run for that connection, so the listener's tos/tclass may not match the ECN codepoint that was actually sent. The same question applies to the new tcp_rsk(req)->syn_ect_snt assignment in cookie_v6_check(), and to syn_ect_rcv = 0 in cookie_tcp_reqsk_init(), which the BPF path also uses whatever the SYN's ECN field was. bpf_sk_assign_tcp_reqsk() fills the request sock only from struct bpf_tcp_req_attrs: net/core/filter.c:bpf_sk_assign_tcp_reqsk() { ... ireq->wscale_ok = !!attrs->wscale_ok; ireq->ecn_ok = !!attrs->ecn_ok; ... } and that struct has no field for the SYN-ACK or SYN ECN codepoint: include/net/tcp.h: struct bpf_tcp_req_attrs { ... u8 ecn_ok; ... u8 usec_ts_ok; u8 reserved[3]; }; The in-tree example already chooses its SYN-ACK TOS without looking at the listener: tools/testing/selftests/bpf/progs/test_tcp_custom_syncookie.c: ctx->ipv4->tos = 0; Here is one example: - The listener has ECT bits in IP_TOS or IPV6_TCLASS (for example a DCTCP listener, which gets ECT(0)), and tcp_ecn >= 3. - The BPF program sends a Not-ECT SYN-ACK that negotiates AccECN and passes ecn_ok=1. - The peer's third ACK reflects Not-ECT (ACE=0b010), so cookie_accecn_ok() is true and accecn_ok=1. The child socket setup then goes: tcp_ecn_openreq_child() tcp_accecn_third_ack() tcp_accecn_validate_syn_feedback() tcp_ect_transition_valid(ECT_0, NOT_ECT) returns false tcp_accecn_fail_mode_set(tp, TCP_ACCECN_ACE_FAIL_RECV) With the default tcp_ecn_fallback=1, this sets TCP_ACCECN_ACE_FAIL_RECV. After that, tcp_ecn_send() uses INET_ECN_dontxmit() for the rest of the connection. This looks like the same false ACE_FAIL_RECV that the commit message says it fixes, and it can still happen through bpf_sk_assign_tcp_reqsk(). Does the BPF path need a way to pass the SYN-ACK (and SYN) ECN codepoint in through bpf_tcp_req_attrs, instead of using the listener's tos/tclass? > > ret = tcp_get_cookie_sock(sk, skb, req, &rt->dst); > /* ip_queue_xmit() depends on our flow being setup [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117124710.1338951-1-thaisonphan%40google.com ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-19 12:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 12:47 [PATCH net v3 0/2] tcp: initialize missing request_sock fields in syncookie path Thaison Phan
2026-11-17 12:47 ` [PATCH net v3 1/2] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check() Thaison Phan
2026-11-17 12:47 ` [PATCH net v3 2/2] tcp: accecn: initialize AccECN fields in syncookie path Thaison Phan
2026-11-17 18:06 ` Matthieu Baerts
[not found] ` <sashiko-outbox-220941@kernel.org>
2026-11-18 20:16 ` Thaison Phan
2026-11-19 12:47 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).