On Thu Jul 16, 2026 at 12:28 AM CEST, Ihor Solodrai wrote:
> On 7/9/26 3:01 AM, Alexis Lothoré (eBPF Foundation) wrote:

[...]

>> @@ -1984,6 +2000,10 @@ static int do_jit(struct bpf_verifier_env *env, 
>> struct bpf_prog *bpf_prog, int *
>>                      EMIT_ENDBR();
>>  
>>              ip = image + addrs[i - 1] + (prog - temp);
>> +            insn_idx = i - 1 + bpf_prog->aux->subprog_start;
>> +            accesses_stack_only =
>> +                    env ? !env->insn_aux_data[insn_idx].non_stack_access :
>> +                          false;
>
> I don't like how accesses_stack_only is a boolean argument to
> emit_kasan_check(), that is only used for early return.
> I can see not wanting to do
>
>     if (!accesses_stack_only)
>         err = emit_kasan_check(...);
>
> on every call site, but a bool arg is even worse IMO.

Yes, that was indeed the intent, but ok, I can get back to set the
stack access check out of the function.

[...]

>> @@ -2626,7 +2662,17 @@ static int do_jit(struct bpf_verifier_env *env, 
>> struct bpf_prog *bpf_prog, int *
>>                              if (dst_reg == BPF_REG_0)
>>                                      real_dst_reg = BPF_REG_AX;
>>  
>> +                            ip += 3;
>
> nit
>
> IIUC the 3 comes from emit_mov_reg() above it (:2659), right?  I was
> thinking to suggest a comment, but well I figured it out from the
> code, so others should too...

Yes, that's indeed where it comes from (and this cost me quite some
debugging time to spot that I was missing this offset !)
>
> Maybe instead of hardcoding 3 we could calculcate the diff
> before/after the mov is emitted?

ACK, I'll remove the hardcoded scalar and set it to (prog - *pprog)

Alexis



-- 
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Reply via email to