Re: [PATCH bpf-next v5 4/5] bpf, x86: Emit ENDBR for indirect jump targets

From: Eduard Zingerman

Date: Wed Mar 04 2026 - 01:23:19 EST


On Mon, 2026-03-02 at 18:27 +0800, Xu Kuohai wrote:

[...]

> @@ -2449,7 +2452,7 @@ st: if (is_imm8(insn->off))
>
> /* call */
> case BPF_JMP | BPF_CALL: {
> - u8 *ip = image + addrs[i - 1];
> + u8 *ip = image + addrs[i - 1] + (prog - temp);
^^^^^^^^^^^^^
Could you please comment a bit why this addend is needed?
>
> func = (u8 *) __bpf_call_base + imm32;
> if (src_reg == BPF_PSEUDO_CALL && tail_call_reachable) {

[...]