Patchwork [2.6.34-rc1] CPU stalls when closing TCP sockets.

login
register
mail settings
Submitter Eric Dumazet
Date March 9, 2010, 3:55 p.m.
Message ID <1268150156.3113.12.camel@edumazet-laptop>
Download mbox | patch
Permalink /patch/47166/
State Accepted
Delegated to: David Miller
Headers show

Comments

Eric Dumazet - March 9, 2010, 3:55 p.m.
Le mardi 09 mars 2010 à 15:54 +0900, Tetsuo Handa a écrit :
> Eric Dumazet wrote:
> > Nothing comes to my mind, I'll try to reproduce this here.
> 
> When stopped at (8), Ctrl-C doesn't work.
> 
> > Is 2.6.33 OK ?
> 
> Yes. 2.6.33 and earlier are OK.

OK thanks !

I believe commit d218d11133d888f9745802146a50255a4781d37a
(tcp: Generalized TTL Security Mechanism) might be the bug origin.

I am testing following patch, based on latest net-2.6 tree (including
the LINUX_MIB_TCPMINTTLDROP bit)

[PATCH] tcp: Fix tcp_v4_rcv()

Commit d218d111 (tcp: Generalized TTL Security Mechanism) added a bug
for TIMEWAIT sockets. We should not test min_ttl for TW sockets.

Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Hemminger - March 9, 2010, 4:22 p.m.
On Tue, 09 Mar 2010 16:55:56 +0100
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Le mardi 09 mars 2010 à 15:54 +0900, Tetsuo Handa a écrit :
> > Eric Dumazet wrote:
> > > Nothing comes to my mind, I'll try to reproduce this here.
> > 
> > When stopped at (8), Ctrl-C doesn't work.
> > 
> > > Is 2.6.33 OK ?
> > 
> > Yes. 2.6.33 and earlier are OK.
> 
> OK thanks !
> 
> I believe commit d218d11133d888f9745802146a50255a4781d37a
> (tcp: Generalized TTL Security Mechanism) might be the bug origin.
> 
> I am testing following patch, based on latest net-2.6 tree (including
> the LINUX_MIB_TCPMINTTLDROP bit)
> 
> [PATCH] tcp: Fix tcp_v4_rcv()
> 
> Commit d218d111 (tcp: Generalized TTL Security Mechanism) added a bug
> for TIMEWAIT sockets. We should not test min_ttl for TW sockets.
> 
> Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index 8d51d39..70df409 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -1651,15 +1651,15 @@ int tcp_v4_rcv(struct sk_buff *skb)
>  	if (!sk)
>  		goto no_tcp_socket;
>  
> +process:
> +	if (sk->sk_state == TCP_TIME_WAIT)
> +		goto do_time_wait;
> +
>  	if (unlikely(iph->ttl < inet_sk(sk)->min_ttl)) {
>  		NET_INC_STATS_BH(net, LINUX_MIB_TCPMINTTLDROP);
>  		goto discard_and_relse;
>  	}
>  
> -process:
> -	if (sk->sk_state == TCP_TIME_WAIT)
> -		goto do_time_wait;
> -
>  	if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
>  		goto discard_and_relse;
>  	nf_reset(skb);
> 
> 

Agreed.
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
David Miller - March 10, 2010, 3:33 p.m.
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 09 Mar 2010 16:55:56 +0100

> Le mardi 09 mars 2010 à 15:54 +0900, Tetsuo Handa a écrit :
>> Eric Dumazet wrote:
>> > Nothing comes to my mind, I'll try to reproduce this here.
>> 
>> When stopped at (8), Ctrl-C doesn't work.
>> 
>> > Is 2.6.33 OK ?
>> 
>> Yes. 2.6.33 and earlier are OK.
> 
> OK thanks !
> 
> I believe commit d218d11133d888f9745802146a50255a4781d37a
> (tcp: Generalized TTL Security Mechanism) might be the bug origin.
> 
> I am testing following patch, based on latest net-2.6 tree (including
> the LINUX_MIB_TCPMINTTLDROP bit)
> 
> [PATCH] tcp: Fix tcp_v4_rcv()
> 
> Commit d218d111 (tcp: Generalized TTL Security Mechanism) added a bug
> for TIMEWAIT sockets. We should not test min_ttl for TW sockets.
> 
> Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 8d51d39..70df409 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1651,15 +1651,15 @@  int tcp_v4_rcv(struct sk_buff *skb)
 	if (!sk)
 		goto no_tcp_socket;
 
+process:
+	if (sk->sk_state == TCP_TIME_WAIT)
+		goto do_time_wait;
+
 	if (unlikely(iph->ttl < inet_sk(sk)->min_ttl)) {
 		NET_INC_STATS_BH(net, LINUX_MIB_TCPMINTTLDROP);
 		goto discard_and_relse;
 	}
 
-process:
-	if (sk->sk_state == TCP_TIME_WAIT)
-		goto do_time_wait;
-
 	if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
 		goto discard_and_relse;
 	nf_reset(skb);