[dpdk-dev] Bug report: rte_table_hash_ext incorrectly compares signatures
solal.pirelli at epfl.ch
Sat Jan 21 23:15:46 CET 2017
I found a bug in the rte_table_hash_ext implementation, hopefully this
mailing list is the right place to report it.
It's pretty simple: in `rte_table_hash_ext.c` (using `add` as an example;
the bug is also elsewhere):
- line 53 declares the bucket signatures as arrays of `uint16_t`
- line 280 computes the key signature, an `uint64_t`
- line 283 shifts the signature by 16 bits to the right, resulting in a
- like 293 then compares the bucket signature (16 bits) to the shifted key
signature (48 bits).
Thus, rte_table_hash_ext only works if hashes have their upper 32 bits
I created a tiny repro:
It tries to insert then retrieve the same key/value pair, with specific
bits set in the hash; as can be seen from the output, the map works fine
when only one of the lower 32 bits is set, but stops working if one of the
upper 32 bits is.
The workaround is simple: the hash function should always clear the upper
32 bits of its output.
(I unfortunately don't have the time right now to provide a properly-tested
More information about the dev