|
| 1 | +netfilter: nf_tables: discard table flag update with pending basechain deletion |
| 2 | + |
| 3 | +jira LE-1907 |
| 4 | +cve CVE-2024-35897 |
| 5 | +Rebuild_History Non-Buildable kernel-4.18.0-553.16.1.el8_10 |
| 6 | +commit-author Pablo Neira Ayuso < [email protected]> |
| 7 | +commit 1bc83a019bbe268be3526406245ec28c2458a518 |
| 8 | +Empty-Commit: Cherry-Pick Conflicts during history rebuild. |
| 9 | +Will be included in final tarball splat. Ref for failed cherry-pick at: |
| 10 | +ciq/ciq_backports/kernel-4.18.0-553.16.1.el8_10/1bc83a01.failed |
| 11 | + |
| 12 | +Hook unregistration is deferred to the commit phase, same occurs with |
| 13 | +hook updates triggered by the table dormant flag. When both commands are |
| 14 | +combined, this results in deleting a basechain while leaving its hook |
| 15 | +still registered in the core. |
| 16 | + |
| 17 | +Fixes: 179d9ba5559a ("netfilter: nf_tables: fix table flag updates") |
| 18 | + Signed-off-by: Pablo Neira Ayuso < [email protected]> |
| 19 | +(cherry picked from commit 1bc83a019bbe268be3526406245ec28c2458a518) |
| 20 | + Signed-off-by: Jonathan Maple < [email protected]> |
| 21 | + |
| 22 | +# Conflicts: |
| 23 | +# net/netfilter/nf_tables_api.c |
| 24 | +diff --cc net/netfilter/nf_tables_api.c |
| 25 | +index 6dfe5eb2c32e,d89d77946719..000000000000 |
| 26 | +--- a/net/netfilter/nf_tables_api.c |
| 27 | ++++ b/net/netfilter/nf_tables_api.c |
| 28 | +@@@ -952,8 -1195,30 +952,33 @@@ static void nf_tables_table_disable(str |
| 29 | + #define __NFT_TABLE_F_INTERNAL (NFT_TABLE_F_MASK + 1) |
| 30 | + #define __NFT_TABLE_F_WAS_DORMANT (__NFT_TABLE_F_INTERNAL << 0) |
| 31 | + #define __NFT_TABLE_F_WAS_AWAKEN (__NFT_TABLE_F_INTERNAL << 1) |
| 32 | + -#define __NFT_TABLE_F_WAS_ORPHAN (__NFT_TABLE_F_INTERNAL << 2) |
| 33 | + #define __NFT_TABLE_F_UPDATE (__NFT_TABLE_F_WAS_DORMANT | \ |
| 34 | +++<<<<<<< HEAD |
| 35 | + + __NFT_TABLE_F_WAS_AWAKEN) |
| 36 | +++======= |
| 37 | ++ __NFT_TABLE_F_WAS_AWAKEN | \ |
| 38 | ++ __NFT_TABLE_F_WAS_ORPHAN) |
| 39 | ++ |
| 40 | ++ static bool nft_table_pending_update(const struct nft_ctx *ctx) |
| 41 | ++ { |
| 42 | ++ struct nftables_pernet *nft_net = nft_pernet(ctx->net); |
| 43 | ++ struct nft_trans *trans; |
| 44 | ++ |
| 45 | ++ if (ctx->table->flags & __NFT_TABLE_F_UPDATE) |
| 46 | ++ return true; |
| 47 | ++ |
| 48 | ++ list_for_each_entry(trans, &nft_net->commit_list, list) { |
| 49 | ++ if (trans->ctx.table == ctx->table && |
| 50 | ++ ((trans->msg_type == NFT_MSG_NEWCHAIN && |
| 51 | ++ nft_trans_chain_update(trans)) || |
| 52 | ++ (trans->msg_type == NFT_MSG_DELCHAIN && |
| 53 | ++ nft_is_base_chain(trans->ctx.chain)))) |
| 54 | ++ return true; |
| 55 | ++ } |
| 56 | ++ |
| 57 | ++ return false; |
| 58 | ++ } |
| 59 | +++>>>>>>> 1bc83a019bbe (netfilter: nf_tables: discard table flag update with pending basechain deletion) |
| 60 | + |
| 61 | + static int nf_tables_updtable(struct nft_ctx *ctx) |
| 62 | + { |
| 63 | +* Unmerged path net/netfilter/nf_tables_api.c |
0 commit comments