Skip to content

Conversation

@pvts-mat
Copy link
Contributor

@pvts-mat pvts-mat commented Jan 8, 2026

[LTS 9.2]
CVE-2024-27397 VULN-7048
CVE-2024-57947 VULN-42212
CVE-2025-38120 VULN-71797

Commits

CVE-2024-27397

The fix for CVE-2024-27397 got "unlocked" after merging #668 where most of the prerequisites fell into place. A small prereq netfilter: nft_set_rbtree: .deactivate fails if element has expired was pulled in to further reduce conflicts. The remaining modifications required are explained in the upstream-diff below.

netfilter: nft_set_rbtree: .deactivate fails if element has expired

jira VULN-7048
cve-pre CVE-2024-27397
commit-author Pablo Neira Ayuso <pablo@netfilter.org>
commit d111692a59c1470ae530cbb39bcf0346c950ecc7
netfilter: nf_tables: use timestamp to check for set element timeout

jira VULN-7048
cve CVE-2024-27397
commit-author Pablo Neira Ayuso <pablo@netfilter.org>
commit 7395dfacfff65e9938ac0889dafa1ab01e987d15
upstream-diff Omitted changes in `nft_rbtree_gc()' in
  net/netfilter/nft_set_rbtree.c. Function `nft_rbtree_gc()' was changed
  from async to sync in 7d259f021aaa78904b6c836d975e8e00d83a182a
  ("nft_set_rbtree: prefer sync gc to async worker"), which was not
  backported to ciqlts9_2 and `nft_rbtree_gc()' remains asynchronous in
  this version. The upstream fix 7395dfacfff65e9938ac0889dafa1ab01e987d15
  left checking current time as it was in the async garbage collectors:
  "Then, there is async gc which also needs to check the current time
  since it runs asynchronously from a workqueue." Similar situation
  occurred in linux-5.15.y and the fix backported as
  0d40e8cb1d1f56a994cdd2e015af622fdca9ed4d omits changes in
  `nft_rbtree_gc()' as well.

CVE-2024-57947 (+ CVE-2025-38120)

The prerequisite f04df57 netfilter: nft_set_pipapo: constify lookup fn args where possible wasn't strictly necessary, but it's functionally neutral and it helped avoid petty conflicts when backporting the main fix 791a615 netfilter: nf_set_pipapo: fix initial map fill. The follow-up ea77c39 netfilter: nf_set_pipapo_avx2: fix initial map fill is actually a bugfix for CVE-2024-57947, but it has its own CVE-2025-38120 assigned so it was used in place of cve-bf tag.

netfilter: nft_set_pipapo: constify lookup fn args where possible

jira VULN-42212
cve-pre CVE-2024-57947
commit-author Florian Westphal <fw@strlen.de>
commit f04df573faf90bb828a2241b650598c02c074323
upstream-diff Context conflicts resolution in `nft_pipapo_avx2_lookup()'.
  No actual diff.
netfilter: nf_set_pipapo: fix initial map fill

jira VULN-42212
cve CVE-2024-57947
commit-author Florian Westphal <fw@strlen.de>
commit 791a615b7ad2258c560f91852be54b0480837c93
netfilter: nf_set_pipapo_avx2: fix initial map fill

jira VULN-71797
cve CVE-2025-38120
commit-author Florian Westphal <fw@strlen.de>
commit ea77c397bff8b6d59f6d83dae1425b08f465e8b5

kABI check: passed

[1/2] kabi_check_kernel	Check ABI of kernel [ciqlts9_2-CVE-batch-16]	_kabi_check_kernel__x86_64--test--ciqlts9_2-CVE-batch-16
++ uname -m
+ python3 /data/src/ctrliq-github-haskell/kernel-dist-git-el-9.2/SOURCES/check-kabi -k /data/src/ctrliq-github-haskell/kernel-dist-git-el-9.2/SOURCES/Module.kabi_x86_64 -s vms/x86_64--build--ciqlts9_2/build_files/kernel-src-tree-ciqlts9_2-CVE-batch-16/Module.symvers
kABI check passed
+ touch state/kernels/ciqlts9_2-CVE-batch-16/x86_64/kabi_checked

Boot test: passed

boot-test.log

Kselftests: passed

Reference

kselftests–ciqlts9_2–run1.log
kselftests–ciqlts9_2–run2.log

Patch

kselftests–ciqlts9_2-CVE-batch-16–run1.log
kselftests–ciqlts9_2-CVE-batch-16–run2.log
kselftests–ciqlts9_2-CVE-batch-16–run3.log
kselftests–ciqlts9_2-CVE-batch-16–run4.log
kselftests–ciqlts9_2-CVE-batch-16–run5.log

Comparison

The tests results for the reference and the patch are the same.

$ ktests.xsh diff  kselftests*.log

Column    File
--------  --------------------------------------------
Status0   kselftests--ciqlts9_2--run1.log
Status1   kselftests--ciqlts9_2--run2.log
Status2   kselftests--ciqlts9_2-CVE-batch-16--run1.log
Status3   kselftests--ciqlts9_2-CVE-batch-16--run2.log
Status4   kselftests--ciqlts9_2-CVE-batch-16--run3.log
Status5   kselftests--ciqlts9_2-CVE-batch-16--run4.log
Status6   kselftests--ciqlts9_2-CVE-batch-16--run5.log

TestCase                              Status0  Status1  Status2  Status3  Status4  Status5  Status6  Summary
netfilter:conntrack_icmp_related.sh   pass     pass     pass     pass     pass     pass     pass     same
netfilter:conntrack_tcp_unreplied.sh  pass     pass     pass     pass     pass     pass     pass     same
netfilter:conntrack_vrf.sh            pass     pass     pass     pass     pass     pass     pass     same
netfilter:ipip-conntrack-mtu.sh       pass     pass     pass     pass     pass     pass     pass     same
netfilter:ipvs.sh                     pass     pass     pass     pass     pass     pass     pass     same
netfilter:nf_nat_edemux.sh            pass     pass     pass     pass     pass     pass     pass     same
netfilter:nft_conntrack_helper.sh     pass     pass     pass     pass     pass     pass     pass     same
netfilter:nft_fib.sh                  pass     pass     pass     pass     pass     pass     pass     same
netfilter:nft_meta.sh                 pass     pass     pass     pass     pass     pass     pass     same
netfilter:nft_nat.sh                  pass     pass     pass     pass     pass     pass     pass     same
netfilter:nft_queue.sh                pass     pass     pass     pass     pass     pass     pass     same
netfilter:rpath.sh                    pass     pass     pass     pass     pass     pass     pass     same

jira VULN-7048
cve-pre CVE-2024-27397
commit-author Pablo Neira Ayuso <pablo@netfilter.org>
commit d111692

This allows to remove an expired element which is not possible in other
existing set backends, this is more noticeable if gc-interval is high so
expired elements remain in the tree. On-demand gc also does not help in
this case, because this is delete element path. Return NULL if element
has expired.

Fixes: 8d8540c ("netfilter: nft_set_rbtree: add timeout support")
	Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
	Signed-off-by: Florian Westphal <fw@strlen.de>
(cherry picked from commit d111692)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
jira VULN-7048
cve CVE-2024-27397
commit-author Pablo Neira Ayuso <pablo@netfilter.org>
commit 7395dfa
upstream-diff Omitted changes in `nft_rbtree_gc()' in
  net/netfilter/nft_set_rbtree.c. Function `nft_rbtree_gc()' was changed
  from async to sync in 7d259f0
  ("nft_set_rbtree: prefer sync gc to async worker"), which was not
  backported to ciqlts9_2 and `nft_rbtree_gc()' remains asynchronous in
  this version. The upstream fix 7395dfa
  left checking current time as it was in the async garbage collectors:
  "Then, there is async gc which also needs to check the current time
  since it runs asynchronously from a workqueue." Similar situation
  occurred in linux-5.15.y and the fix backported as
  0d40e8c omits changes in
  `nft_rbtree_gc()' as well.

Add a timestamp field at the beginning of the transaction, store it
in the nftables per-netns area.

Update set backend .insert, .deactivate and sync gc path to use the
timestamp, this avoids that an element expires while control plane
transaction is still unfinished.

.lookup and .update, which are used from packet path, still use the
current time to check if the element has expired. And .get path and dump
also since this runs lockless under rcu read size lock. Then, there is
async gc which also needs to check the current time since it runs
asynchronously from a workqueue.

Fixes: c3e1b00 ("netfilter: nf_tables: add set element timeout support")
	Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
(cherry picked from commit 7395dfa)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
jira VULN-42212
cve-pre CVE-2024-57947
commit-author Florian Westphal <fw@strlen.de>
commit f04df57
upstream-diff Context conflicts resolution in `nft_pipapo_avx2_lookup()'.
  No actual diff.

Those get called from packet path, content must not be modified.
No functional changes intended.

	Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
	Signed-off-by: Florian Westphal <fw@strlen.de>
(cherry picked from commit f04df57)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
jira VULN-42212
cve CVE-2024-57947
commit-author Florian Westphal <fw@strlen.de>
commit 791a615

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: 3c4287f ("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>
(cherry picked from commit 791a615)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
jira VULN-71797
cve CVE-2025-38120
commit-author Florian Westphal <fw@strlen.de>
commit ea77c39

If the first field doesn't cover the entire start map, then we must zero
out the remainder, else we leak those bits into the next match round map.

The early fix was incomplete and did only fix up the generic C
implementation.

A followup patch adds a test case to nft_concat_range.sh.

Fixes: 791a615 ("netfilter: nf_set_pipapo: fix initial map fill")
	Signed-off-by: Florian Westphal <fw@strlen.de>
	Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
	Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
(cherry picked from commit ea77c39)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
@pvts-mat pvts-mat marked this pull request as ready for review January 8, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant