Commit f66b4aa
bpf: Remove redundant free_verifier_state()/pop_stack()
This patch removes duplicated code.
Eduard points out [1]:
Same cleanup cycles are done in push_stack() and push_async_cb(),
both functions are only reachable from do_check_common() via
do_check() -> do_check_insn().
Hence, I think that cur state should not be freed in push_*()
functions and pop_stack() loop there is not needed.
This would also fix the 'symptom' for [2], but the issue also has a
simpler fix which was sent separately. This fix also makes sure the
push_*() callers always return an error for which
error_recoverable_with_nospec(err) is false. This is required because
otherwise we try to recover and access the stale `state`.
Moving free_verifier_state() and pop_stack(..., pop_log=false) to happen
after the bpf_vlog_reset() call in do_check_common() is fine because the
pop_stack() call that is moved does not call bpf_vlog_reset() with the
pop_log=false parameter.
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
Reported-by: Eduard Zingerman <[email protected]>
Link: https://lore.kernel.org/all/[email protected]/
Acked-by: Eduard Zingerman <[email protected]>
Signed-off-by: Luis Gerhorst <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>1 parent 4a4b84b commit f66b4aa
1 file changed
+10
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2097 | 2097 | | |
2098 | 2098 | | |
2099 | 2099 | | |
2100 | | - | |
| 2100 | + | |
2101 | 2101 | | |
2102 | 2102 | | |
2103 | 2103 | | |
| |||
2107 | 2107 | | |
2108 | 2108 | | |
2109 | 2109 | | |
2110 | | - | |
| 2110 | + | |
2111 | 2111 | | |
2112 | 2112 | | |
2113 | 2113 | | |
2114 | 2114 | | |
2115 | | - | |
| 2115 | + | |
2116 | 2116 | | |
2117 | 2117 | | |
2118 | 2118 | | |
| |||
2127 | 2127 | | |
2128 | 2128 | | |
2129 | 2129 | | |
2130 | | - | |
2131 | | - | |
2132 | | - | |
2133 | | - | |
2134 | | - | |
2135 | | - | |
2136 | 2130 | | |
2137 | 2131 | | |
2138 | 2132 | | |
| |||
2864 | 2858 | | |
2865 | 2859 | | |
2866 | 2860 | | |
2867 | | - | |
| 2861 | + | |
2868 | 2862 | | |
2869 | 2863 | | |
2870 | 2864 | | |
| |||
2876 | 2870 | | |
2877 | 2871 | | |
2878 | 2872 | | |
2879 | | - | |
| 2873 | + | |
2880 | 2874 | | |
2881 | 2875 | | |
2882 | 2876 | | |
| |||
2887 | 2881 | | |
2888 | 2882 | | |
2889 | 2883 | | |
2890 | | - | |
| 2884 | + | |
2891 | 2885 | | |
2892 | 2886 | | |
2893 | 2887 | | |
2894 | 2888 | | |
2895 | 2889 | | |
2896 | 2890 | | |
2897 | | - | |
2898 | | - | |
2899 | | - | |
2900 | | - | |
2901 | | - | |
2902 | | - | |
2903 | 2891 | | |
2904 | 2892 | | |
2905 | 2893 | | |
| |||
22935 | 22923 | | |
22936 | 22924 | | |
22937 | 22925 | | |
| 22926 | + | |
| 22927 | + | |
| 22928 | + | |
| 22929 | + | |
22938 | 22930 | | |
22939 | 22931 | | |
22940 | 22932 | | |
| |||
23086 | 23078 | | |
23087 | 23079 | | |
23088 | 23080 | | |
23089 | | - | |
23090 | | - | |
23091 | | - | |
23092 | | - | |
23093 | | - | |
23094 | | - | |
23095 | | - | |
23096 | | - | |
23097 | 23081 | | |
23098 | 23082 | | |
23099 | 23083 | | |
| |||
0 commit comments