netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: keltargw <keltar.gw@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: kadlec@netfilter.org, pablo@netfilter.org
Subject: Incorrect dependency handling with delayed ipset destroy ipset 7.21
Date: Sat, 13 Apr 2024 09:19:23 +0500	[thread overview]
Message-ID: <CALFUNymhWkcy2p9hqt7eO4H4Hm5t70Y02=XodnpH1zgAZ0cVSw@mail.gmail.com> (raw)

Hello.
I have a problem with recent kernels. Due to delayed ipset destroy I'm
unable to destroy ipset that was recently in use by another
(destroyed) ipset. It is demonstrated by this example:

#!/bin/bash
set -x

ipset create qwe1 list:set
ipset create asd1 hash:net
ipset add qwe1 asd1
ipset add asd1 1.1.1.1

ipset destroy qwe1
ipset list asd1 -t
ipset destroy asd1

Second ipset destroy reports an error "ipset v7.21: Set cannot be
destroyed: it is in use by a kernel component".
If this command is repeated after a short delay, it deletes ipset
without any problems.

It seems it could be fixed with that kernel module patch:

Index: linux-6.7.9/net/netfilter/ipset/ip_set_core.c
===================================================================
--- linux-6.7.9.orig/net/netfilter/ipset/ip_set_core.c
+++ linux-6.7.9/net/netfilter/ipset/ip_set_core.c
@@ -1241,6 +1241,9 @@ static int ip_set_destroy(struct sk_buff
  u32 flags = flag_exist(info->nlh);
  u16 features = 0;

+ /* Wait for flush to ensure references are cleared */
+ rcu_barrier();
+
  read_lock_bh(&ip_set_ref_lock);
  s = find_set_and_id(inst, nla_data(attr[IPSET_ATTR_SETNAME]),
     &i);

If you have any suggestions on how this problem should be approached
please let me know. Thanks.

             reply	other threads:[~2024-04-13  4:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-13  4:19 keltargw [this message]
2024-04-13 14:02 ` Incorrect dependency handling with delayed ipset destroy ipset 7.21 Jozsef Kadlecsik
2024-04-14  5:16   ` keltargw
2024-04-15  9:28     ` Jozsef Kadlecsik
2024-04-15 17:18       ` keltargw
2024-04-17 10:26         ` Jozsef Kadlecsik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALFUNymhWkcy2p9hqt7eO4H4Hm5t70Y02=XodnpH1zgAZ0cVSw@mail.gmail.com' \
    --to=keltar.gw@gmail.com \
    --cc=kadlec@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).