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]
Message-ID: <1519924140.11375.1.camel@gmail.com>
Date:   Thu, 01 Mar 2018 09:09:00 -0800
From:   Eric Dumazet <eric.dumazet@...il.com>
To:     Stephen Hemminger <stephen@...workplumber.org>
Cc:     David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
        sthemmin@...rosoft.com
Subject: Re: [PATCH] inet: add bound ports statistic

On Thu, 2018-03-01 at 08:16 -0800, Stephen Hemminger wrote:
> 
> I went through a several possible alternatives.
>    1. Add a counter in the hash bucket head (like listen already has).
>       But not namespace aware
>    2. Add a percpu counter in network namespace (new struct tcp_netns)
>       Logical and adds place to move tcp open sockets as well.
>       But more expensive and several places in code don't have easy
>       access to namespace.

__this_cpu_inc() should not be very expensive.

We always have access to socket namespace when inserting/deleting a
bind entry.

Since we take the spinlock at that times, inserting
__this_cpu_inc(sock_net(sk)->ipv4.bind_counter) would add few
instructions.

>    3. Counting entries in userspace; defeats the purpose of -s flag.
> 
> Agree it is not an urgent statistic, it is just it got broken; willing to
> just drop it.

Not counting the fact that it has really no purpose.

> 
> What about adding cond_resched between buckets like other places do?

This still is dirtying at least 1MB of memory and performs ~64K atomic
operations.
Waste of cpu caches and memory bus.

If we consider converting the whole /proc/net/socketstat to provide a
netns view only, we might use a percpu structure holding all TCP socket
counters, to make sure no more than one cache line per cpu is used
while folding all the cpus counters.




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ