[PATCH ipset 4/5] tests: hash:net,iface.t: add reproducer for UaF

Florian Westphal <[email protected]> Thu, 23 Jul 2026 12:35:03 +0200
Newsgroups gmane.comp.security.firewalls.netfilter.devel
Message-ID <[email protected]>
A faulty (never merged) kernel patch for ipset had a use-after-free
where an element was free'd without unlinking it from the table, yet
the faulty kernel passed all tests.  Check that we don't free
non-matching elements, the request to delete is for non-existing
element, no free must happen and the command must fail.

Signed-off-by: Florian Westphal <[email protected]>
---
 tests/hash:net,iface.t | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/hash:net,iface.t b/tests/hash:net,iface.t
index bcd0ba451c62..556d56df5c4b 100644
--- a/tests/hash:net,iface.t
+++ b/tests/hash:net,iface.t
@@ -228,6 +228,11 @@
 0 ipset -! a test 2.0.0.20/25,wlan0 timeout 700
 # Counters and timeout: check counters
 0 ./check_extensions test 2.0.0.0/25,wlan0 700 13 12479
+0 ipset flush test
+0 ipset add test 10.0.1.0/24,eth0
+1 ( for i in $(seq 1 10000); do ipset del test 10.0.1.0/24,eth1 ; done )
+0 ipset t test 10.0.1.0/24,eth0
+0 ipset list
 # Counters and timeout: destroy set
 0 ipset x test
 # eof
-- 
2.54.0