From: Ryan Roberts <ryan.roberts@arm.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
pabeni@redhat.com, edumazet@google.com, fw@strlen.de,
horms@kernel.org,
Aishwarya Rambhadran <Aishwarya.Rambhadran@arm.com>
Subject: Re: [PATCH net-next 06/19] netfilter: Exclude LEGACY TABLES on PREEMPT_RT.
Date: Tue, 5 Aug 2025 16:43:06 +0100 [thread overview]
Message-ID: <81bdc56d-a3da-4fc4-b2d0-2561b4d96723@arm.com> (raw)
In-Reply-To: <20250725170340.21327-7-pablo@netfilter.org>
Hi Pablo,
On 25/07/2025 18:03, Pablo Neira Ayuso wrote:
> The seqcount xt_recseq is used to synchronize the replacement of
> xt_table::private in xt_replace_table() against all readers such as
> ipt_do_table()
>
> To ensure that there is only one writer, the writing side disables
> bottom halves. The sequence counter can be acquired recursively. Only the
> first invocation modifies the sequence counter (signaling that a writer
> is in progress) while the following (recursive) writer does not modify
> the counter.
> The lack of a proper locking mechanism for the sequence counter can lead
> to live lock on PREEMPT_RT if the high prior reader preempts the
> writer. Additionally if the per-CPU lock on PREEMPT_RT is removed from
> local_bh_disable() then there is no synchronisation for the per-CPU
> sequence counter.
>
> The affected code is "just" the legacy netfilter code which is replaced
> by "netfilter tables". That code can be disabled without sacrificing
> functionality because everything is provided by the newer
> implementation. This will only requires the usage of the "-nft" tools
> instead of the "-legacy" ones.
> The long term plan is to remove the legacy code so lets accelerate the
> progress.
>
> Relax dependencies on iptables legacy, replace select with depends on,
> this should cause no harm to existing kernel configs and users can still
> toggle IP{6}_NF_IPTABLES_LEGACY in any case.
> Make EBTABLES_LEGACY, IPTABLES_LEGACY and ARPTABLES depend on
> NETFILTER_XTABLES_LEGACY. Hide xt_recseq and its users,
> xt_register_table() and xt_percpu_counter_alloc() behind
> NETFILTER_XTABLES_LEGACY. Let NETFILTER_XTABLES_LEGACY depend on
> !PREEMPT_RT.
>
> This will break selftest expecing the legacy options enabled and will be
> addressed in a following patch.
>
> Co-developed-by: Florian Westphal <fw@strlen.de>
> Co-developed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> net/bridge/netfilter/Kconfig | 10 +++++-----
> net/ipv4/netfilter/Kconfig | 24 ++++++++++++------------
> net/ipv6/netfilter/Kconfig | 19 +++++++++----------
> net/netfilter/Kconfig | 10 ++++++++++
> net/netfilter/x_tables.c | 16 +++++++++++-----
> 5 files changed, 47 insertions(+), 32 deletions(-)
[...]
> +config NETFILTER_XTABLES_LEGACY
> + bool "Netfilter legacy tables support"
> + depends on !PREEMPT_RT
> + help
> + Say Y here if you still require support for legacy tables. This is
> + required by the legacy tools (iptables-legacy) and is not needed if
> + you use iptables over nftables (iptables-nft).
> + Legacy support is not limited to IP, it also includes EBTABLES and
> + ARPTABLES.
> +
This has caused some minor pain for me using Docker on Ubuntu 22.04, which I
guess is still using iptables-legacy. I've had to debug why Docker has stopped
working and eventually ended here. Explcitly enabling NETFILTER_XTABLES_LEGACY
solved the problem.
I thought I'd try my luck at convincing you to default this to enabled for
!PREEMPT_RT to save others from such issues?
Thanks,
Ryan
next prev parent reply other threads:[~2025-08-05 15:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 17:03 [PATCH net-next 00/19] Netfilter/IPVS updates for net-next Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 01/19] netfilter: conntrack: table full detailed log Pablo Neira Ayuso
2025-07-25 23:50 ` patchwork-bot+netdevbpf
2025-07-25 17:03 ` [PATCH net-next 02/19] netfilter: load nf_log_syslog on enabling nf_conntrack_log_invalid Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 03/19] netfilter: x_tables: Remove unused functions xt_{in|out}name() Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 04/19] netfilter: nf_tables: Remove unused nft_reduce_is_readonly() Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 05/19] netfilter: conntrack: Remove unused net in nf_conntrack_double_lock() Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 06/19] netfilter: Exclude LEGACY TABLES on PREEMPT_RT Pablo Neira Ayuso
2025-08-05 15:43 ` Ryan Roberts [this message]
2025-08-07 11:46 ` Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 07/19] selftests: net: Enable legacy netfilter legacy options Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 08/19] selftests: netfilter: Enable CONFIG_INET_SCTP_DIAG Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 09/19] ipvs: Rename del_timer in comment in ip_vs_conn_expire_now() Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 10/19] netfilter: nfnetlink: New NFNLA_HOOK_INFO_DESC helper Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 11/19] netfilter: nfnetlink_hook: Dump flowtable info Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 12/19] netfilter: nft_set_pipapo: remove unused arguments Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 13/19] netfilter: nft_set: remove one argument from lookup and update functions Pablo Neira Ayuso
2025-07-25 23:37 ` Jakub Kicinski
2025-07-25 23:45 ` Jakub Kicinski
2025-07-25 17:03 ` [PATCH net-next 14/19] netfilter: nft_set: remove indirection from update API call Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 15/19] netfilter: nft_set_pipapo: merge pipapo_get/lookup Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 16/19] netfilter: nft_set_pipapo: prefer kvmalloc for scratch maps Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 17/19] netfilter: xt_nfacct: don't assume acct name is null-terminated Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 18/19] selftests: netfilter: Ignore tainted kernels in interface stress test Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 19/19] selftests: netfilter: ipvs.sh: Explicity disable rp_filter on interface tunl0 Pablo Neira Ayuso
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=81bdc56d-a3da-4fc4-b2d0-2561b4d96723@arm.com \
--to=ryan.roberts@arm.com \
--cc=Aishwarya.Rambhadran@arm.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--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).