]> git.hungrycats.org Git - linux/commit
bpf: Move insn_buf[16] to bpf_verifier_env
authorMartin KaFai Lau <martin.lau@kernel.org>
Thu, 29 Aug 2024 21:08:23 +0000 (14:08 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 30 Aug 2024 01:15:44 +0000 (18:15 -0700)
commit6f606ffd6dd7583d8194ee3d858ba4da2eff26a3
tree15ee846fad685ad7723b7889332bf003973c2b37
parentc6d9dafb595564ae44ef2e25e3ace2973aa867f3
bpf: Move insn_buf[16] to bpf_verifier_env

This patch moves the 'struct bpf_insn insn_buf[16]' stack usage
to the bpf_verifier_env. A '#define INSN_BUF_SIZE 16' is also added
to replace the ARRAY_SIZE(insn_buf) usages.

Both convert_ctx_accesses() and do_misc_fixup() are changed
to use the env->insn_buf.

It is a refactoring work for adding the epilogue_buf[16] in a later patch.

With this patch, the stack size usage decreased.

Before:
./kernel/bpf/verifier.c:22133:5: warning: stack frame size (2584)

After:
./kernel/bpf/verifier.c:22184:5: warning: stack frame size (2264)

Reviewed-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20240829210833.388152-2-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf_verifier.h
kernel/bpf/verifier.c