-
Notifications
You must be signed in to change notification settings - Fork 146
bpf: Reduce verifier stack frame size #9246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Upstream branch: 564606f |
6fbb3d3
to
08dbf36
Compare
Upstream branch: 38d95be |
f9cf02f
to
ad47714
Compare
Upstream branch: 38d95be |
ad47714
to
6e34678
Compare
Upstream branch: 38d95be |
6e34678
to
eff30a1
Compare
Upstream branch: 38d95be |
eff30a1
to
6d49e2e
Compare
08dbf36
to
cc01c15
Compare
Upstream branch: 38d95be |
6d49e2e
to
279f98e
Compare
Upstream branch: 38d95be |
279f98e
to
a5beedc
Compare
cc01c15
to
901b4c5
Compare
Upstream branch: 1f24c0d |
In verifier.c, the following code patterns (in two places) struct bpf_insn *patch = &insn_buf[0]; can be simplified to struct bpf_insn *patch = insn_buf; which is easier to understand. Acked-by: Eduard Zingerman <[email protected]> Signed-off-by: Yonghong Song <[email protected]>
Arnd Bergmann reported an issue ([1]) where clang compiler (less than llvm18) may trigger an error where the stack frame size exceeds the limit. I can reproduce the error like below: kernel/bpf/verifier.c:24491:5: error: stack frame size (2552) exceeds limit (1280) in 'bpf_check' [-Werror,-Wframe-larger-than] kernel/bpf/verifier.c:19921:12: error: stack frame size (1368) exceeds limit (1280) in 'do_check' [-Werror,-Wframe-larger-than] Use env->insn_buf for bpf insns instead of putting these insns on the stack. This can resolve the above 'bpf_check' error. The 'do_check' error will be resolved in the next patch. [1] https://lore.kernel.org/bpf/[email protected]/ Reported-by: Arnd Bergmann <[email protected]> Tested-by: Arnd Bergmann <[email protected]> Acked-by: Jiri Olsa <[email protected]> Acked-by: Eduard Zingerman <[email protected]> Signed-off-by: Yonghong Song <[email protected]>
Add a 'struct bpf_scc_callchain callchain_buf' field in bpf_verifier_env. This way, the previous bpf_scc_callchain local variables can be replaced by taking address of env->callchain_buf. This can reduce stack usage and fix the following error: kernel/bpf/verifier.c:19921:12: error: stack frame size (1368) exceeds limit (1280) in 'do_check' [-Werror,-Wframe-larger-than] Reported-by: Arnd Bergmann <[email protected]> Acked-by: Jiri Olsa <[email protected]> Acked-by: Eduard Zingerman <[email protected]> Signed-off-by: Yonghong Song <[email protected]>
a5beedc
to
dbc3d1d
Compare
901b4c5
to
fa8c3a1
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=978662 irrelevant now. Closing PR. |
Pull request for series with
subject: bpf: Reduce verifier stack frame size
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=978313