Patch "ipv4: avoid using shared IP generator for connected sockets" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ipv4: avoid using shared IP generator for connected sockets

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ipv4-avoid-using-shared-ip-generator-for-connected-s.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f97681895a754f2e044bd5bd0f4b5c6a095100e7
Author: Eric Dumazet <edumazet@xxxxxxxxxx>
Date:   Wed Jan 26 17:10:22 2022 -0800

    ipv4: avoid using shared IP generator for connected sockets
    
    [ Upstream commit 23f57406b82de51809d5812afd96f210f8b627f3 ]
    
    ip_select_ident_segs() has been very conservative about using
    the connected socket private generator only for packets with IP_DF
    set, claiming it was needed for some VJ compression implementations.
    
    As mentioned in this referenced document, this can be abused.
    (Ref: Off-Path TCP Exploits of the Mixed IPID Assignment)
    
    Before switching to pure random IPID generation and possibly hurt
    some workloads, lets use the private inet socket generator.
    
    Not only this will remove one vulnerability, this will also
    improve performance of TCP flows using pmtudisc==IP_PMTUDISC_DONT
    
    Fixes: 73f156a6e8c1 ("inetpeer: get rid of ip_id_count")
    Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Reviewed-by: David Ahern <dsahern@xxxxxxxxxx>
    Reported-by: Ray Che <xijiache@xxxxxxxxx>
    Cc: Willy Tarreau <w@xxxxxx>
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/net/ip.h b/include/net/ip.h
index 9192444f2964e..0106c6590ee7b 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -520,19 +520,18 @@ static inline void ip_select_ident_segs(struct net *net, struct sk_buff *skb,
 {
 	struct iphdr *iph = ip_hdr(skb);
 
+	/* We had many attacks based on IPID, use the private
+	 * generator as much as we can.
+	 */
+	if (sk && inet_sk(sk)->inet_daddr) {
+		iph->id = htons(inet_sk(sk)->inet_id);
+		inet_sk(sk)->inet_id += segs;
+		return;
+	}
 	if ((iph->frag_off & htons(IP_DF)) && !skb->ignore_df) {
-		/* This is only to work around buggy Windows95/2000
-		 * VJ compression implementations.  If the ID field
-		 * does not change, they drop every other packet in
-		 * a TCP stream using header compression.
-		 */
-		if (sk && inet_sk(sk)->inet_daddr) {
-			iph->id = htons(inet_sk(sk)->inet_id);
-			inet_sk(sk)->inet_id += segs;
-		} else {
-			iph->id = 0;
-		}
+		iph->id = 0;
 	} else {
+		/* Unfortunately we need the big hammer to get a suitable IPID */
 		__ip_select_ident(net, iph, segs);
 	}
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux