Thread (11 messages) 11 messages, 5 authors, 2023-09-29

Re: Regression: Commit "netfilter: nf_tables: disallow rule addition to bound chain via NFTA_RULE_CHAIN_ID" breaks ruleset loading in linux-stable

From: Linux regression tracking (Thorsten Leemhuis) <hidden>
Date: 2023-09-12 08:33:06
Also in: lkml, netfilter-devel, regressions, stable

On 12.09.23 00:57, Pablo Neira Ayuso wrote:
On Mon, Sep 11, 2023 at 11:37:50PM +0200, Timo Sigurdsson wrote:
quoted
recently, Debian updated their stable kernel from 6.1.38 to 6.1.52
which broke nftables ruleset loading on one of my machines with lots
of "Operation not supported" errors. I've reported this to the
Debian project (see link below) and Salvatore Bonaccorso and I
identified "netfilter: nf_tables: disallow rule addition to bound
chain via NFTA_RULE_CHAIN_ID" (0ebc1064e487) as the offending commit
that introduced the regression. Salvatore also found that this issue
affects the 5.10 stable tree as well (observed in 5.10.191), but he
cannot reproduce it on 6.4.13 and 6.5.2.

The issue only occurs with some rulesets. While I can't trigger it
with simple/minimal rulesets that I use on some machines, it does
occur with a more complex ruleset that has been in use for months
(if not years, for large parts of it). I'm attaching a somewhat
stripped down version of the ruleset from the machine I originally
observed this issue on. It's still not a small or simple ruleset,
but I'll try to reduce it further when I have more time.

The error messages shown when trying to load the ruleset don't seem
to be helpful. Just two simple examples: Just to give two simple
examples from the log when nftables fails to start:
/etc/nftables.conf:99:4-44: Error: Could not process rule: Operation not supported
                        tcp option maxseg size 1-500 counter drop
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/etc/nftables.conf:308:4-27: Error: Could not process rule: Operation not supported
                        tcp dport sip-tls accept
                        ^^^^^^^^^^^^^^^^^^^^^^^^
I can reproduce this issue with 5.10.191 and 6.1.52 and nftables v1.0.6,
this is not reproducible with v1.0.7 and v1.0.8.
quoted
Since the issue only affects some stable trees, Salvatore thought it
might be an incomplete backport that causes this.

If you need further information, please let me know.
Userspace nftables v1.0.6 generates incorrect bytecode that hits a new
kernel check that rejects adding rules to bound chains. The incorrect
bytecode adds the chain binding, attach it to the rule and it adds the
rules to the chain binding. I have cherry-picked these three patches
for nftables v1.0.6 userspace and your ruleset restores fine.
[...]
Hmmmm. Well, this sounds like a kernel regression to me that normally
should be dealt with on the kernel level, as users after updating the
kernel should never have to update any userspace stuff to continue what
they have been doing before the kernel update.

Can't the kernel somehow detect the incorrect bytecode and do the right
thing(tm) somehow?

But yes, don't worry, I know that reality is not black and white and
that it's crucial that things like package filtering do exactly what the
user expect it to do; that's why this might be one of those rare
situations where "user has to update userspace components to support
newer kernels" might be the better of two bad choices. But I had to ask
to ensure it's something like that.

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)
--
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help