You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
netfilter: nf_tables: work around newrule after chain binding
JIRA: https://issues.redhat.com/browse/RHEL-1720
JIRA: https://issues.redhat.com/browse/RHEL-1721
Upstream Status: RHEL only
RHEL only. Proposed upstream but was rejected.
I don't think we can force a rebase of nftables userland
in RHEL <= 9.4. Even if we can do this, we would still need
this change for z-stream.
This change SHOULD NOT be forwarded into versions later than
RHEL 9.4. For those releases nftables userspace should be updated
to release 1.0.7 or later instead.
nftables versions prior to
commit 3975430b12d9 ("src: expand table command before evaluation"), i.e.
1.0.6 and earlier, will handle the following snippet in the wrong order:
table ip t {
chain c {
jump { counter; }
}
}
1. create the table, chain,c and an anon chain.
2. append a rule to chain c to jump to the anon chain.
3. append the rule(s) (here: "counter") to the anon chain.
(step 3 should be before 2).
With below commit, this is now rejected by the kernel.
Reason is that the 'jump {' rule added to chain c adds an explicit binding
(dependency), i.e. the kernel will automatically remove the anon chain when
userspace later asks to delete the 'jump {' rule from chain c.
This caused crashes in the kernel in case of a errors further down
in the same transaction.
The abort part has to unroll all pending changes, including the request to
add the rule 'jump {'. As its already bound, all the rules added to it
get deleted as well.
Because we tolerated late-add-after-bind, the transaction log also contains
the NEWRULE requests (here "counter"), so those were deleted again.
Instead of rejecting newrule-to-bound-chain, allow it iff the anon chain
is new in this transaction and we are appending.
Mark the newrule transaction as already_bound so abort path skips them.
Fixes: 0ebc106 ("netfilter: nf_tables: disallow rule addition to bound chain via NFTA_RULE_CHAIN_ID")
Reported-by: Timo Sigurdsson <[email protected]>
Closes: https://lore.kernel.org/netfilter-devel/[email protected]/
Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: Florian Westphal <[email protected]>
0 commit comments