On 2026/6/30 22:29, KaFai Wan wrote:
> On Fri, 2026-06-26 at 23:43 +0800, Leon Hwang wrote:
[...]
>>  /* Fix up helper call offsets on JIT fallback path. */
>> -static void bpf_fixup_fallback_helpers(struct bpf_verifier_env *env, struct 
>> bpf_prog *fp)
>> +static int bpf_fixup_fallback_helpers(struct bpf_verifier_env *env, struct 
>> bpf_prog *fp)
>>  {
>>      struct bpf_insn *insn = fp->insnsi;
>>      const struct bpf_func_proto *fn;
>>      int i;
>>  
>> -    if (!env || !env->ops->get_func_proto)
>> -            return;
>> +    if (!env)
>> +            return 0;
>>  
>>      for (i = 0; i < fp->len; i++, insn++) {
>> -            if (bpf_helper_call(insn) && 
>> bpf_jit_inlines_helper_call(insn->imm)) {
>> +            if (env->ops->get_func_proto && bpf_helper_call(insn) &&
>> +                bpf_jit_inlines_helper_call(insn->imm)) {
>>                      fn = env->ops->get_func_proto(insn->imm, env->prog);
>>                      if (fn && fn->func)
>>                              insn->imm = fn->func - __bpf_call_base;
> It might be better to use the BPF_CALL_IMM macro. insn->imm = 
> BPF_CALL_IMM(fn->func);


Makes sense.

This might be applied to Tiezhu's patch.

Thanks,
Leon

>>              }
>> +
>> +            if (bpf_insn_requires_jit(insn))
>> +                    return -EOPNOTSUPP;
>>      }
>> [...]


Reply via email to