On Tue, Aug 27, 2024 at 5:48 AM Leon Hwang <leon.hwang@xxxxxxxxx> wrote: > > > I wonder if disallowing to freplace programs when > > replacement.tail_call_reachable != replaced.tail_call_reachable > > would be a better option? > > > > This idea is wonderful. > > We can disallow attaching tail_call_reachable freplace prog to > not-tail_call_reachable bpf prog. So, the following 3 cases are allowed. > > 1. attach tail_call_reachable freplace prog to tail_call_reachable bpf prog. > 2. attach not-tail_call_reachable freplace prog to tail_call_reachable > bpf prog. > 3. attach not-tail_call_reachable freplace prog to > not-tail_call_reachable bpf prog. I think it's fine to disable freplace and tail_call combination altogether. And speaking of the patch. The following: - if (tail_call_reachable) { - LOAD_TAIL_CALL_CNT_PTR(bpf_prog->aux->stack_depth); - ip += 7; - } + LOAD_TAIL_CALL_CNT_PTR(bpf_prog->aux->stack_depth); + ip += 7; Is too high of a penalty for every call for freplace+tail_call combo. So disable it in the verifier. pw-bot: cr