Re: [PATCH 7/9] rhashtable: Per bucket locks & deferred expansion/shrinking

From
Herbert Xu <herbert@gondor.apana.org.au>
Date
2015-01-17 09:32:28
Also in
netfilter-devel
Reply to
Patrick McHardy, 2015-01-17
On Sat, Jan 17, 2015 at 08:06:21AM +0000, Patrick McHardy wrote:
Resizing might also fail because of memory allocation problems, but
I'd argue that its better to continue with a non-optimal sized table
and retry later than to completely fail, at least unless the API
user has explicitly requested this behaviour.

As for the element counter, yeah, it should prevent overflow. In that
case I agree that failing insertion is the easiest solution.
Well you have to consider the security aspect.  These days root-
only is no longer an acceptable excuse given things like namespaces.

If you don't fail the insertions while the expansion is ongoing,
and assuming a dump can postpone expansions, then you can essentially
insert entries into the hash table at will which is an easy DoS
attack.

Note that you don't have to fail the insertion right away.  I
think waiting until you reach max * 2 would be fine.

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
Thread (46 messages) 46 messages, 7 authors, last reply 2015-01-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help