mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
Merge branch 'tcp-exclude-old-acks-from-fast-path'
Inbal Schussheim says: ==================== tcp: exclude old ACKs from fast path Exclude ACKs outside [SND.UNA, SND.NXT] from TCP header prediction so that they fall through to the slow path, where ACK validation is applied. Add a packetdrill test for a data segment carrying an excessively old ACK. The test fails on the unpatched kernel and passes with the fix. v2: https://lore.kernel.org/netdev/20260909075644.1408171-1-inbal.lipshtat@mail.huji.ac.il/ v1: https://lore.kernel.org/netdev/20260906123151.1391349-1-inbal.lipshtat@mail.huji.ac.il/T/#u ==================== Link: https://patch.msgid.link/20260914090408.1435080-1-inbal.lipshtat@mail.huji.ac.il Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
commit
ad9c65b8f9
|
|
@ -6490,6 +6490,7 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
|
|||
* or pure receivers (this means either the sequence number or the ack
|
||||
* value must stay constant)
|
||||
* - Unexpected TCP option.
|
||||
* - ACK sequence number is outside [SND.UNA, SND.NXT].
|
||||
*
|
||||
* When these conditions are not satisfied it drops into a standard
|
||||
* receive procedure patterned after RFC793 to handle all cases.
|
||||
|
|
@ -6539,7 +6540,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb)
|
|||
|
||||
if ((tcp_flag_word(th) & TCP_HP_BITS) == tp->pred_flags &&
|
||||
TCP_SKB_CB(skb)->seq == tp->rcv_nxt &&
|
||||
!after(TCP_SKB_CB(skb)->ack_seq, tp->snd_nxt)) {
|
||||
between(TCP_SKB_CB(skb)->ack_seq, tp->snd_una, tp->snd_nxt)) {
|
||||
int tcp_header_len = tp->tcp_header_len;
|
||||
s32 delta = 0;
|
||||
int flag = 0;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
`./defaults.sh
|
||||
sysctl -q net.ipv4.tcp_invalid_ratelimit=0
|
||||
`
|
||||
|
||||
// Test rejection of data segments carrying excessively old ACKs
|
||||
|
||||
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
|
||||
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
|
||||
+0 bind(3, ..., ...) = 0
|
||||
+0 listen(3, 1024) = 0
|
||||
|
||||
// ---------------- Handshake ------------------- //
|
||||
+0 < S 0:0(0) win 65535
|
||||
+0 > S. 0:0(0) ack 1 <...>
|
||||
+0 < . 1:1(0) ack 1 win 65535
|
||||
+0 accept(3, ..., ...) = 4
|
||||
|
||||
// Populate receive memory so the following segment can use
|
||||
// header prediction.
|
||||
+0 < P. 1:501(500) ack 1 win 65535
|
||||
+0 > . 1:1(0) ack 501
|
||||
|
||||
// Send an in-sequence data segment carrying an excessively old ACK.
|
||||
+0 < P. 501:1501(1000) ack 2794967397 win 65535
|
||||
|
||||
// Challenge ACK; RCV.NXT must remain 501.
|
||||
+0 > . 1:1(0) ack 501
|
||||
Loading…
Reference in New Issue
Block a user