bpf: Enable private stack for eligible subprogs
authorYonghong Song <yonghong.song@linux.dev>
Tue, 12 Nov 2024 16:39:12 +0000 (08:39 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 13 Nov 2024 00:26:24 +0000 (16:26 -0800)
commite00931c02568dc6ac76f94b1ab471de05e6fdfe8
treee9188ef5d443331afcabf783b80ba238aff0f748
parenta76ab5731e32d50ff5b1ae97e9dc4b23f41c23f5
bpf: Enable private stack for eligible subprogs

If private stack is used by any subprog, set that subprog
prog->aux->jits_use_priv_stack to be true so later jit can allocate
private stack for that subprog properly.

Also set env->prog->aux->jits_use_priv_stack to be true if
any subprog uses private stack. This is a use case for a
single main prog (no subprogs) to use private stack, and
also a use case for later struct-ops progs where
env->prog->aux->jits_use_priv_stack will enable recursion
check if any subprog uses private stack.

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20241112163912.2224007-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
kernel/bpf/verifier.c