Commit 9df785a
netfilter: nf_tables: prefer nft_chain_validate
[ Upstream commit cff3bd0 ]
nft_chain_validate already performs loop detection because a cycle will
result in a call stack overflow (ctx->level >= NFT_JUMP_STACK_SIZE).
It also follows maps via ->validate callback in nft_lookup, so there
appears no reason to iterate the maps again.
nf_tables_check_loops() and all its helper functions can be removed.
This improves ruleset load time significantly, from 23s down to 12s.
This also fixes a crash bug. Old loop detection code can result in
unbounded recursion:
BUG: TASK stack guard page was hit at ....
Oops: stack guard page: 0000 [#1] PREEMPT SMP KASAN
CPU: 4 PID: 1539 Comm: nft Not tainted 6.10.0-rc5+ #1
[..]
with a suitable ruleset during validation of register stores.
I can't see any actual reason to attempt to check for this from
nft_validate_register_store(), at this point the transaction is still in
progress, so we don't have a full picture of the rule graph.
For nf-next it might make sense to either remove it or make this depend
on table->validate_state in case we could catch an error earlier
(for improved error reporting to userspace).
Fixes: 20a6934 ("netfilter: nf_tables: add netlink set API")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 86858da commit 9df785a
1 file changed
+13
-145
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3823 | 3823 | | |
3824 | 3824 | | |
3825 | 3825 | | |
| 3826 | + | |
| 3827 | + | |
| 3828 | + | |
| 3829 | + | |
| 3830 | + | |
| 3831 | + | |
| 3832 | + | |
| 3833 | + | |
| 3834 | + | |
3826 | 3835 | | |
3827 | 3836 | | |
3828 | 3837 | | |
| |||
3844 | 3853 | | |
3845 | 3854 | | |
3846 | 3855 | | |
| 3856 | + | |
| 3857 | + | |
| 3858 | + | |
3847 | 3859 | | |
3848 | 3860 | | |
3849 | 3861 | | |
| |||
10805 | 10817 | | |
10806 | 10818 | | |
10807 | 10819 | | |
10808 | | - | |
10809 | | - | |
10810 | | - | |
10811 | | - | |
10812 | | - | |
10813 | | - | |
10814 | | - | |
10815 | | - | |
10816 | | - | |
10817 | | - | |
10818 | | - | |
10819 | | - | |
10820 | | - | |
10821 | | - | |
10822 | | - | |
10823 | | - | |
10824 | | - | |
10825 | | - | |
10826 | | - | |
10827 | | - | |
10828 | | - | |
10829 | | - | |
10830 | | - | |
10831 | | - | |
10832 | | - | |
10833 | | - | |
10834 | | - | |
10835 | | - | |
10836 | | - | |
10837 | | - | |
10838 | | - | |
10839 | | - | |
10840 | | - | |
10841 | | - | |
10842 | | - | |
10843 | | - | |
10844 | | - | |
10845 | | - | |
10846 | | - | |
10847 | | - | |
10848 | | - | |
10849 | | - | |
10850 | | - | |
10851 | | - | |
10852 | | - | |
10853 | | - | |
10854 | | - | |
10855 | | - | |
10856 | | - | |
10857 | | - | |
10858 | | - | |
10859 | | - | |
10860 | | - | |
10861 | | - | |
10862 | | - | |
10863 | | - | |
10864 | | - | |
10865 | | - | |
10866 | | - | |
10867 | | - | |
10868 | | - | |
10869 | | - | |
10870 | | - | |
10871 | | - | |
10872 | | - | |
10873 | | - | |
10874 | | - | |
10875 | | - | |
10876 | | - | |
10877 | | - | |
10878 | | - | |
10879 | | - | |
10880 | | - | |
10881 | | - | |
10882 | | - | |
10883 | | - | |
10884 | | - | |
10885 | | - | |
10886 | | - | |
10887 | | - | |
10888 | | - | |
10889 | | - | |
10890 | | - | |
10891 | | - | |
10892 | | - | |
10893 | | - | |
10894 | | - | |
10895 | | - | |
10896 | | - | |
10897 | | - | |
10898 | | - | |
10899 | | - | |
10900 | | - | |
10901 | | - | |
10902 | | - | |
10903 | | - | |
10904 | | - | |
10905 | | - | |
10906 | | - | |
10907 | | - | |
10908 | | - | |
10909 | | - | |
10910 | | - | |
10911 | | - | |
10912 | | - | |
10913 | | - | |
10914 | | - | |
10915 | | - | |
10916 | | - | |
10917 | | - | |
10918 | | - | |
10919 | | - | |
10920 | | - | |
10921 | | - | |
10922 | | - | |
10923 | | - | |
10924 | | - | |
10925 | | - | |
10926 | | - | |
10927 | | - | |
10928 | | - | |
10929 | | - | |
10930 | | - | |
10931 | | - | |
10932 | | - | |
10933 | | - | |
10934 | | - | |
10935 | | - | |
10936 | | - | |
10937 | | - | |
10938 | | - | |
10939 | | - | |
10940 | | - | |
10941 | | - | |
10942 | | - | |
10943 | | - | |
10944 | | - | |
10945 | | - | |
10946 | | - | |
10947 | | - | |
10948 | | - | |
10949 | | - | |
10950 | | - | |
10951 | | - | |
10952 | 10820 | | |
10953 | 10821 | | |
10954 | 10822 | | |
| |||
11061 | 10929 | | |
11062 | 10930 | | |
11063 | 10931 | | |
11064 | | - | |
| 10932 | + | |
11065 | 10933 | | |
11066 | 10934 | | |
11067 | 10935 | | |
| |||
0 commit comments