<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/lib/rhashtable.c, branch v4.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.3</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2015-09-23T00:36:07Z</updated>
<entry>
<title>lib: fix data race in rhashtable_rehash_one</title>
<updated>2015-09-23T00:36:07Z</updated>
<author>
<name>Dmitriy Vyukov</name>
<email>dvyukov@google.com</email>
</author>
<published>2015-09-22T08:51:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7def0f952eccdd0edb3c504f4dab35ee0d3aba1f'/>
<id>urn:sha1:7def0f952eccdd0edb3c504f4dab35ee0d3aba1f</id>
<content type='text'>
rhashtable_rehash_one() uses complex logic to update entry-&gt;next field,
after INIT_RHT_NULLS_HEAD and NULLS_MARKER expansion:

entry-&gt;next = 1 | ((base + off) &lt;&lt; 1)

This can be compiled along the lines of:

entry-&gt;next = base + off
entry-&gt;next &lt;&lt;= 1
entry-&gt;next |= 1

Which will break concurrent readers.

NULLS value recomputation is not needed here, so just remove
the complex logic.

The data race was found with KernelThreadSanitizer (KTSAN).

Signed-off-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Acked-by: Thomas Graf &lt;tgraf@suug.ch&gt;
Acked-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: fix for resize events during table walk</title>
<updated>2015-07-08T21:53:49Z</updated>
<author>
<name>Phil Sutter</name>
<email>phil@nwl.cc</email>
</author>
<published>2015-07-06T13:51:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=142b942a75cb10ede1b42bf85368d41449ab4e3b'/>
<id>urn:sha1:142b942a75cb10ede1b42bf85368d41449ab4e3b</id>
<content type='text'>
If rhashtable_walk_next detects a resize operation in progress, it jumps
to the new table and continues walking that one. But it misses to drop
the reference to it's current item, leading it to continue traversing
the new table's bucket in which the current item is sorted into, and
after reaching that bucket's end continues traversing the new table's
second bucket instead of the first one, thereby potentially missing
items.

This fixes the rhashtable runtime test for me. Bug probably introduced
by Herbert Xu's patch eddee5ba ("rhashtable: Fix walker behaviour during
rehash") although not explicitly tested.

Fixes: eddee5ba ("rhashtable: Fix walker behaviour during rehash")
Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
Acked-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2015-06-09T03:06:56Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-06-09T03:06:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=941742f49762ba4c908510f036b09a46c1b14513'/>
<id>urn:sha1:941742f49762ba4c908510f036b09a46c1b14513</id>
<content type='text'>
</content>
</entry>
<entry>
<title>rhashtable: add missing import &lt;linux/export.h&gt;</title>
<updated>2015-06-07T07:10:15Z</updated>
<author>
<name>Hauke Mehrtens</name>
<email>hauke@hauke-m.de</email>
</author>
<published>2015-06-06T20:07:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6d7954130c8d7100b7aba3c986fc4eefedf1a1ad'/>
<id>urn:sha1:6d7954130c8d7100b7aba3c986fc4eefedf1a1ad</id>
<content type='text'>
rhashtable uses EXPORT_SYMBOL_GPL() without importing linux/export.h
directly it is only imported indirectly through some other includes.

Signed-off-by: Hauke Mehrtens &lt;hauke@hauke-m.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2015-05-23T05:22:35Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-05-23T05:22:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=36583eb54d46c36a447afd6c379839f292397429'/>
<id>urn:sha1:36583eb54d46c36a447afd6c379839f292397429</id>
<content type='text'>
Conflicts:
	drivers/net/ethernet/cadence/macb.c
	drivers/net/phy/phy.c
	include/linux/skbuff.h
	net/ipv4/tcp.c
	net/switchdev/switchdev.c

Switchdev was a case of RTNH_H_{EXTERNAL --&gt; OFFLOAD}
renaming overlapping with net-next changes of various
sorts.

phy.c was a case of two changes, one adding a local
variable to a function whilst the second was removing
one.

tcp.c overlapped a deadlock fix with the addition of new tcp_info
statistic values.

macb.c involved the addition of two zyncq device entries.

skbuff.h involved adding back ipv4_daddr to nf_bridge_info
whilst net-next changes put two other existing members of
that struct into a union.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: Add cap on number of elements in hash table</title>
<updated>2015-05-16T22:08:26Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2015-05-15T03:30:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=07ee0722bf941960fb3888f9c9b5839473372fd1'/>
<id>urn:sha1:07ee0722bf941960fb3888f9c9b5839473372fd1</id>
<content type='text'>
We currently have no limit on the number of elements in a hash table.
This is a problem because some users (tipc) set a ceiling on the
maximum table size and when that is reached the hash table may
degenerate.  Others may encounter OOM when growing and if we allow
insertions when that happens the hash table perofrmance may also
suffer.

This patch adds a new paramater insecure_max_entries which becomes
the cap on the table.  If unset it defaults to max_size * 2.  If
it is also zero it means that there is no cap on the number of
elements in the table.  However, the table will grow whenever the
utilisation hits 100% and if that growth fails, you will get ENOMEM
on insertion.

As allowing oversubscription is potentially dangerous, the name
contains the word insecure.

Note that the cap is not a hard limit.  This is done for performance
reasons as enforcing a hard limit will result in use of atomic ops
that are heavier than the ones we currently use.

The reasoning is that we're only guarding against a gross over-
subscription of the table, rather than a small breach of the limit.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: Simplify iterator code</title>
<updated>2015-05-05T23:30:47Z</updated>
<author>
<name>Thomas Graf</name>
<email>tgraf@suug.ch</email>
</author>
<published>2015-05-05T00:22:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c936a79fc01ef1115a46f940944ebe7385845673'/>
<id>urn:sha1:c936a79fc01ef1115a46f940944ebe7385845673</id>
<content type='text'>
Remove useless obj variable and goto logic.

Signed-off-by: Thomas Graf &lt;tgraf@suug.ch&gt;
Acked-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: Do not schedule more than one rehash if we can't grow further</title>
<updated>2015-04-22T18:17:22Z</updated>
<author>
<name>Thomas Graf</name>
<email>tgraf@suug.ch</email>
</author>
<published>2015-04-22T07:41:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a87b9ebf1709687ff213091d0fdb4254b1564803'/>
<id>urn:sha1:a87b9ebf1709687ff213091d0fdb4254b1564803</id>
<content type='text'>
The current code currently only stops inserting rehashes into the
chain when no resizes are currently scheduled. As long as resizes
are scheduled and while inserting above the utilization watermark,
more and more rehashes will be scheduled.

This lead to a perfect DoS storm with thousands of rehashes
scheduled which lead to thousands of spinlocks to be taken
sequentially.

Instead, only allow either a series of resizes or a single rehash.
Drop any further rehashes and return -EBUSY.

Fixes: ccd57b1bd324 ("rhashtable: Add immediate rehash during insertion")
Signed-off-by: Thomas Graf &lt;tgraf@suug.ch&gt;
Acked-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: Schedule async resize when sync realloc fails</title>
<updated>2015-04-22T18:17:22Z</updated>
<author>
<name>Thomas Graf</name>
<email>tgraf@suug.ch</email>
</author>
<published>2015-04-22T07:41:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e2307ed6cbe71c74e291681aaa7e92ab98bc3177'/>
<id>urn:sha1:e2307ed6cbe71c74e291681aaa7e92ab98bc3177</id>
<content type='text'>
When rhashtable_insert_rehash() fails with ENOMEM, this indicates that
we can't allocate the necessary memory in the current context but the
limits as set by the user would still allow to grow.

Thus attempt an async resize in the background where we can allocate
using GFP_KERNEL which is more likely to succeed. The insertion itself
will still fail to indicate pressure.

This fixes a bug where the table would never continue growing once the
utilization is above 100%.

Fixes: ccd57b1bd324 ("rhashtable: Add immediate rehash during insertion")
Signed-off-by: Thomas Graf &lt;tgraf@suug.ch&gt;
Acked-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: provide len to obj_hashfn</title>
<updated>2015-03-25T16:18:33Z</updated>
<author>
<name>Patrick McHardy</name>
<email>kaber@trash.net</email>
</author>
<published>2015-03-25T13:07:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=49f7b33e63fec9d16e7ee62ba8f8ab4159cbdc26'/>
<id>urn:sha1:49f7b33e63fec9d16e7ee62ba8f8ab4159cbdc26</id>
<content type='text'>
nftables sets will be converted to use so called setextensions, moving
the key to a non-fixed position. To hash it, the obj_hashfn must be used,
however it so far doesn't receive the length parameter.

Pass the key length to obj_hashfn() and convert existing users.

Signed-off-by: Patrick McHardy &lt;kaber@trash.net&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
</feed>
