Thread (79 messages) 79 messages, 6 authors, 2015-02-03

Re: [PATCH 3/3] netlink: Lock out table resizes while dumping Netlink sockets

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2015-01-21 09:15:23
Also in: netfilter-devel

On Wed, Jan 21, 2015 at 04:15:55PM +1100, Herbert Xu wrote:
On Wed, Jan 21, 2015 at 04:08:19PM +1100, Herbert Xu wrote:
quoted
OK I think I have a solution for you guys.  But first you'll need to
wait for me to undo the nulls stuff so I can steal that bit which
is central to my solution.

Essentially I need a bit to indicate an entry in the bucket chain
should be skipped, either because it has just been removed or that
it is a walker entry (see xfrm_state_walk).

The way it'll work then is exactly the same as xfrm_state_walk,
except that the linked list is broken up into individual buckets.

Of course we'll still need to postpone resizes (and rehashes which
is what my work is about) during a walk but I think that's a fair
price to pay.
I failed to address the security aspect of this approach.  Obviously
this can only work if the only entites doing the walk are trusted.
Which means that the vast majority (if not all) hash table users
would be excluded, in particular, netlink.
OK maybe we can get around this.  So we will postpone the resize
or rehash when a walk is in place, however, when we hit a hard
limit, i.e., when insert would otherwise fail, then we do the
rehash regardless of any outstanding walks.  The walks will just
behave erratically or we could force them to start from scratch
again.

Cheers,
-- 
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help