selftests: netfilter: add regression test for nft_ct timeout UAF
Subsystems (3)
cover selftests: netfilter: add regression test for nft_ct timeout UAF
From: Vastargazing <[email protected]>
Commit f8dca15a1b19 ("netfilter: nft_ct: fix use-after-free in timeout object destroy") fixed a slab-use-after-free but no regression test was added. This patch adds one to tools/testing/selftests/net/netfilter/.
Vastargazing (1):
selftests: netfilter: add nft_ct timeout destroy race test
.../testing/selftests/net/netfilter/Makefile | 1 + .../netfilter/nft_ct_timeout_concurrency.sh | 116 ++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 tools/testing/selftests/net/netfilter/nft_ct_timeout_concurrency.sh
Signature · 1 line
2.51.0
PATCH 1/1 selftests: netfilter: add nft_ct timeout destroy race test
Add a netfilter kselftest for the nft_ct timeout object destroy race fixed by commit f8dca15a1b19 ("netfilter: nft_ct: fix use-after-free in timeout object destroy").
Keep creating new TCP connections from one namespace while repeatedly flushing and recreating the table that owns a ct timeout object. This exercises concurrent packet processing against the timeout object teardown path without requiring external traffic tools beyond bash, nft and ip.
On a KASAN kernel, a regression in the RCU lifetime handling should show up as a slab-use-after-free report in nf_conntrack_tcp_packet().
--- .../testing/selftests/net/netfilter/Makefile | 1 + .../netfilter/nft_ct_timeout_concurrency.sh | 116 ++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 tools/testing/selftests/net/netfilter/nft_ct_timeout_concurrency.sh
tools/testing/selftests/net/netfilter/Makefile +1 -0
@@ -25,6 +25,7 @@ TEST_PROGS := \ nft_audit.sh \ nft_concat_range.sh \ nft_conntrack_helper.sh \ + nft_ct_timeout_concurrency.sh \ nft_fib.sh \ nft_flowtable.sh \ nft_interface_stress.sh \
tools/testing/selftests/net/netfilter/nft_ct_timeout_concurrency.sh new file +116 -0
116 lines not on this page · raw message
Signature · 1 line
2.51.0
Florian Westphal
maintainerRe: [PATCH 1/1] selftests: netfilter: add nft_ct timeout destroy race test
Quoted 1 line · Vastargazing
new file mode 100644
This should say '755', else you get
# Warning: file nft_ct_timeout_concurrency.sh is not executable
I'm not sure we should add regression tests for regression tests sake. Else we'll quickly accumulate thousands of such scripts and test run time will explode.
A functional test for timeout policies would be much more useful. We have a few of those in nftables.git but they ony check that userspace and kernel parsing sides work.