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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 27 Jun 2022 11:30:09 -0700
From:   Kuniyuki Iwashima <kuniyu@...zon.com>
To:     <kuba@...nel.org>
CC:     <davem@...emloft.net>, <ebiederm@...ssion.com>,
        <edumazet@...gle.com>, <herbert@...dor.apana.org.au>,
        <kuni1840@...il.com>, <kuniyu@...zon.com>,
        <netdev@...r.kernel.org>, <pabeni@...hat.com>, <xemul@...nvz.org>
Subject: Re: [PATCH v2 net] af_unix: Do not call kmemdup() for init_net's sysctl table.

From:   Jakub Kicinski <kuba@...nel.org>
Date:   Mon, 27 Jun 2022 10:58:59 -0700
> On Sun, 26 Jun 2022 11:43:27 -0500 Eric W. Biederman wrote:
> > Kuniyuki Iwashima <kuniyu@...zon.com> writes:
> > 
> > > While setting up init_net's sysctl table, we need not duplicate the global
> > > table and can use it directly.  
> > 
> > Acked-by: "Eric W. Biederman" <ebiederm@...ssion.com>
> > 
> > I am not quite certain the savings of a single entry table justivies
> > the complexity.  But the looks correct.
> 
> Yeah, the commit message is a little sparse. The "why" is not addressed.
> Could you add more details to explain the motivation?

I was working on a series which converts UDP/TCP hash tables into per-netns
ones like AF_UNIX to speed up looking up sockets.  It will consume much
memory on a host with thousands of netns, but it can be waste if we do not
have its protocol family's sockets.

So, I'm now working on a follow-up series for AF_UNIX per-netns hash table
so that we can change the size for a child netns by a sysctl knob:

  # sysctl -w net.unix.child_hash_entries=128
  # ip net add test  # created with the hash table size 128
  # ip net exec test sh
  # sysctl net.unix.hash_entries  # read-only
  128

  (The size for init_net can be changed via a new boot parameter
   xhash_entries like uhash_entries/thash_entries.)

While implementing that, I found that kmemdup() is called for init_net but
TCP/UDP does not (See: ipv4_sysctl_init_net()).  Unlike IPv4, AF_UNIX does
not have a huge sysctl table, so it cannot be a problem though, this patch
is for consuming less memory and kind of consistency.  The reason I submit
this seperately is that it might be better to have a Fixes tag.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ