netfilter: nf_tables: don't store chain address on jump
authorFlorian Westphal <fw@strlen.de>
Tue, 11 Apr 2023 14:29:47 +0000 (16:29 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 21 Apr 2023 23:39:40 +0000 (01:39 +0200)
commit63e9bbbcca60333490e13744ae736d8f988e4950
treeee6c0666b6c814f62b3482336e0cf2452017ce8e
parentd4d89e6546e0d1ac09cb9dd353f0cb31c8a8deb1
netfilter: nf_tables: don't store chain address on jump

Now that the rule trailer/end marker and the rcu head reside in the
same structure, we no longer need to save/restore the chain pointer
when performing/returning from a jump.

We can simply let the trace infra walk the evaluated rule until it
hits the end marker and then fetch the chain pointer from there.

When the rule is NULL (policy tracing), then chain and basechain
pointers were already identical, so just use the basechain.

This cuts size of jumpstack in half, from 256 to 128 bytes in 64bit,
scripts/stackusage says:

nf_tables_core.c:251 nft_do_chain    328     static

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c
net/netfilter/nf_tables_core.c
net/netfilter/nf_tables_trace.c