Loading
netfilter: nf_set_pipapo: fix initial map fill
mainline inclusion from mainline-v6.11-rc1 commit 791a615b7ad2258c560f91852be54b0480837c93 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBJKDJ CVE: CVE-2024-57947 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=791a615b7ad2258c560f91852be54b0480837c93 -------------------------------- The initial buffer has to be inited to all-ones, but it must restrict it to the size of the first field, not the total field size. After each round in the map search step, the result and the fill map are swapped, so if we have a set where f->bsize of the first element is smaller than m->bsize_max, those one-bits are leaked into future rounds result map. This makes pipapo find an incorrect matching results for sets where first field size is not the largest. Followup patch adds a test case to nft_concat_range.sh selftest script. Thanks to Stefano Brivio for pointing out that we need to zero out the remainder explicitly, only correcting memset() argument isn't enough. Fixes: 3c4287f6 ("nf_tables: Add set type for arbitrary concatenation of ranges") Reported-by:Yi Chen <yiche@redhat.com> Cc: Stefano Brivio <sbrivio@redhat.com> Signed-off-by:
Florian Westphal <fw@strlen.de> Reviewed-by:
Stefano Brivio <sbrivio@redhat.com> Signed-off-by:
Pablo Neira Ayuso <pablo@netfilter.org> Conflicts: net/netfilter/nft_set_pipapo_avx2.c [commit f04df573faf9 ("netfilter: nft_set_pipapo: constify lookup fn args where possible") not merged] Signed-off-by:
Zhang Changzhong <zhangchangzhong@huawei.com>