lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 7 Aug 2018 09:40:42 +0800
From:   Yafang Shao <laoar.shao@...il.com>
To:     David Miller <davem@...emloft.net>
Cc:     Eric Dumazet <edumazet@...gle.com>,
        yanhaishuang@...s.chinamobile.com, netdev <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] tcp: fix the calculation of sysctl_max_tw_buckets
 in tcp_sk_init()

On Tue, Aug 7, 2018 at 4:41 AM, David Miller <davem@...emloft.net> wrote:
> From: Yafang Shao <laoar.shao@...il.com>
> Date: Mon,  6 Aug 2018 19:47:00 +0800
>
>> tcp_hashinfo.ehash_mask is always an odd number, which is set in function
>> alloc_large_system_hash(). See bellow,
>>       if (_hash_mask)
>>               *_hash_mask = (1 << log2qty) - 1; <<< always odd number
>>
>> Hence the local variable 'cnt' is a even number, as a result of that it is
>> no difference to do the incrementation here.
>>
>> Maybe the compiler could also optimize it, but this code is a little ugly.
>>
>> Fix: fee83d09 ("ipv4: Namespaceify tcp_max_syn_backlog knob")
>
> The correct tag is "Fixes: "

OK

>
>> @@ -2543,7 +2543,7 @@ static int __net_init tcp_sk_init(struct net *net)
>>       net->ipv4.sysctl_tcp_tw_reuse = 2;
>>
>>       cnt = tcp_hashinfo.ehash_mask + 1;
>> -     net->ipv4.tcp_death_row.sysctl_max_tw_buckets = (cnt + 1) / 2;
>> +     net->ipv4.tcp_death_row.sysctl_max_tw_buckets = cnt / 2;
>>       net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo;
>
> This is completely harmless, and does no harm.
>

It is harmless, meanwhile, it is useless and a little ugly.

By the way,  why do we init sysctl_max_tw_buckets to
(tcp_hashinfo.ehash_mask + 1) / 2 or (tcp_hashinfo.ehash_mask + 2) / 2
?
Per my pespective, this default value is a little huge, sometimes we
have to set this value to a lower value with sysctl, otherwise it may
easily cause tcp port exhaustion issue.
So why not just init it to a lower value ?

> You aren't "fixing" anything.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ