Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: davem@davemloft.net, shemminger@linux-foundation.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] tcp: restrict net.ipv4.tcp_adv_min_scale (#20312)
Date: Sun, 14 Nov 2010 20:49:43 +0100	[thread overview]
Message-ID: <1289764183.2743.94.camel@edumazet-laptop> (raw)
In-Reply-To: <20101114151825.GA25137@core2.telecom.by>

Le dimanche 14 novembre 2010 à 17:18 +0200, Alexey Dobriyan a écrit :
> tcp_win_from_space() does the following:
> 
> 	if (sysctl_tcp_adv_win_scale <= 0)
> 		return space >> (-sysctl_tcp_adv_win_scale);
> 	else
> 		return space - (space >> sysctl_tcp_adv_win_scale);
> 
> "space" is int.
> 
> As per C99 6.5.7 (3) shifting int for 32 or more bits is
> undefined behaviour.
> 
> Indeed, if sysctl_tcp_adv_win_scale is exactly 32, space >> 32 equals
> space and function returns 0;
> 
> Which means we busyloop in tcp_fixup_rcvbuf().
> 
> Restrict net.ipv4.tcp_adv_win_scale to [-31, 31].
> 
> Fix https://bugzilla.kernel.org/show_bug.cgi?id=20312
> 
> Steps to reproduce:
> 
> 	echo 32 >/proc/sys/net/ipv4/tcp_adv_win_scale
> 	wget www.kernel.org
> 	[softlockup]
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 

Please fix your patch title, you speak of adv_min_scale ...

> --- a/net/ipv4/sysctl_net_ipv4.c
> +++ b/net/ipv4/sysctl_net_ipv4.c
> @@ -26,6 +26,8 @@ static int zero;
>  static int tcp_retr1_max = 255;
>  static int ip_local_port_range_min[] = { 1, 1 };
>  static int ip_local_port_range_max[] = { 65535, 65535 };
> +static int _minus_31 = -31;
> +static int _31 = 31;

Please use normal symbols, not starting by underscore.

>  
>  /* Update system visible IP port range */
>  static void set_local_port_range(int range[2])
> @@ -426,7 +428,9 @@ static struct ctl_table ipv4_table[] = {
>  		.data		= &sysctl_tcp_adv_win_scale,
>  		.maxlen		= sizeof(int),
>  		.mode		= 0644,
> -		.proc_handler	= proc_dointvec
> +		.proc_handler	= proc_dointvec_minmax,
> +		.extra1		= &_minus_31,
> +		.extra2		= &_31,
>  	},
>  	{
>  		.procname	= "tcp_tw_reuse",

Please change Documentation/networking/ip-sysctl.txt to reflect possible
values of adv_win_scale

Thanks



  reply	other threads:[~2010-11-14 19:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-14 15:18 [PATCH] tcp: restrict net.ipv4.tcp_adv_min_scale (#20312) Alexey Dobriyan
2010-11-14 19:49 ` Eric Dumazet [this message]
2010-11-14 20:14   ` Alexey Dobriyan
2010-11-15 14:18     ` Ben Hutchings
2010-11-22 22:54       ` [PATCH v2] tcp: restrict net.ipv4.tcp_adv_win_scale (#20312) Alexey Dobriyan
2010-11-28 18:39         ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289764183.2743.94.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=adobriyan@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox