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:	Fri, 21 Jun 2013 08:22:01 +0800
From:	Asias He <asias@...hat.com>
To:	Andy King <acking@...are.com>
Cc:	netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
	Dmitry Torokhov <dtor@...are.com>,
	Reilly Grant <grantr@...are.com>
Subject: Re: [PATCH 4/4] VSOCK: Fix VSOCK_HASH and VSOCK_CONN_HASH

On Thu, Jun 20, 2013 at 08:12:13AM -0700, Andy King wrote:
> > If we mod with VSOCK_HASH_SIZE -1, we get 0, 1, .... 249.  Actually, we
> > have vsock_bind_table[0 ... 250] and vsock_connected_table[0 .. 250].
> > In this case the last entry will never be used.
> 
> If I remember correctly, we did this on purpose.  There's actually a
> comment about it:
> 
> >   * VSOCK_HASH_SIZE + 1 so that vsock_bind_table[0] through
> >   * vsock_bind_table[VSOCK_HASH_SIZE - 1] are for bound sockets and
> >   * vsock_bind_table[VSOCK_HASH_SIZE] is for unbound sockets.  The hash
> 
> [250] is for unbound sockets.  If you hash on that, you'll mistakenly
> get an unbound socket when looking for a bound one.

We have 

   #define VSOCK_HASH_SIZE         251
   static struct list_head vsock_bind_table[VSOCK_HASH_SIZE + 1];
   #define vsock_bound_sockets(addr) (&vsock_bind_table[VSOCK_HASH(addr)])
   #define vsock_unbound_sockets     (&vsock_bind_table[VSOCK_HASH_SIZE])

So

vsock_bind_table[251 + 1]

[0-250] is for bound sockets, [251] is for unbound sockets, no?

> It is confusing, so perhaps a better way is just to move unbound into
> its own table.

This isn't that confusing, but it would be clearer to have a own unbound table.

> Thanks!
> - Andy

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ