OSDN Git Service

bpf: use per htab salt for bucket hash
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 22 Aug 2018 21:49:37 +0000 (23:49 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 23 Aug 2018 16:45:47 +0000 (18:45 +0200)
commitc0203475765f827e7b2eaf0a87222d0766e2cc4b
tree0d71d10f5a83b6bd9a2c4d309edd81d7671c095d
parent9b2e0388bec8ec5427403e23faff3b58dd1c3200
bpf: use per htab salt for bucket hash

All BPF hash and LRU maps currently have a known and global seed
we feed into jhash() which is 0. This is suboptimal, thus fix it
by generating a random seed upon hashtab setup time which we can
later on feed into jhash() on lookup, update and deletions.

Fixes: 0f8e4bd8a1fc8 ("bpf: add hashtable type of eBPF maps")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Reviewed-by: Eduardo Valentin <eduval@amazon.com>
kernel/bpf/hashtab.c