On Wed, Nov 06, 2024 at 06:42:09PM -0800, Yonghong Song wrote: > For struct_ops progs, whether a particular prog uses private stack > depends on prog->aux->priv_stack_requested setting before actual > insn-level verification for that prog. One particular implementation > is to piggyback on struct_ops->check_member(). The next patch has > an example for this. The struct_ops->check_member() sets > prog->aux->priv_stack_requested to be true which enables private stack > usage. > > The struct_ops prog follows the same rule as kprobe/tracing progs after > function bpf_enable_priv_stack(). For example, even a struct_ops prog > requests private stack, it could still use normal kernel stack if > the stack size is small (< 64 bytes). > > The prog->aux->priv_stack_requested is also used for recursion checking > for struct_ops progs. Similar to tracing progs, nested same cpu same > prog run will be skipped. A field (recursion_detected()) is added to > bpf_prog_aux structure. If bpf_prog->aux->recursion_detected > is implemented by the struct_ops subsystem and nested same cpu/prog > happens, the function will be triggered to report an error, collect > related info, etc. > > Signed-off-by: Yonghong Song <yonghong.song@xxxxxxxxx>