On 18/8/23 06:31, Alexei Starovoitov wrote: > On Mon, Aug 14, 2023 at 09:41:46PM +0800, Leon Hwang wrote: >> @@ -1147,6 +1152,7 @@ struct bpf_attach_target_info { >> struct module *tgt_mod; >> const char *tgt_name; >> const struct btf_type *tgt_type; >> + bool tail_call_ctx; > > Instead of extra flag here can you check tgt_prog->aux->tail_call_reachable in check_attach_btf_id() > and set tr->flags there? Should we check tgt_prog->aux->func[subprog]->is_func? Or, tgt_prog->aux->tail_call_reachable is enough? I think tgt_prog->aux->func[subprog]->is_func is required to check. It's because it's a bug about subprog instead of tgt_prog. In check_attach_btf_id(): bool tail_call_ctx; // ... ret = bpf_check_attach_target(&env->log, prog, tgt_prog, btf_id, &tgt_info, &tail_call_ctx); // ... tr->flags = (tail_call_ctx ? BPF_TRAMP_F_TAIL_CALL_CTX : 0); How about changing like this? However, it's bad to change bpf_check_attach_target() declaration. > Other than this the fix makes sense. > Please trim your cc list when you respin.> Just maintainers, Maciej (author of fixes tag) and bpf@vger is enough. I'll trim it. Thanks, Leon