[PATCH bpf-next 1/2] bpf, riscv: Add support for indirect jumps

bot+bpf-ci at kernel.org bot+bpf-ci at kernel.org
Wed Sep 23 06:56:02 PDT 2026


> diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
> index ed0a6f871dea..9de3749fb268 100644
> --- a/arch/riscv/net/bpf_jit_comp64.c
> +++ b/arch/riscv/net/bpf_jit_comp64.c

[ ... ]

> diff --git a/arch/riscv/net/bpf_jit_core.c b/arch/riscv/net/bpf_jit_core.c
> index 2fb0b4e198b9..15acf249fed4 100644
> --- a/arch/riscv/net/bpf_jit_core.c
> +++ b/arch/riscv/net/bpf_jit_core.c

[ ... ]

> @@ -176,6 +179,15 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr
>  		for (i = 0; i < prog->len; i++)
>  			ctx->offset[i] = ninsns_rvoff(ctx->offset[i]);
>  		bpf_prog_fill_jited_linfo(prog, ctx->offset);
> +
> +		/*
> +		 * bpf_prog_update_insn_ptrs() wants the start of each insn, so
> +		 * shift the linfo array by one and get insn 0 from the prologue.
> +		 */
> +		for (i = prog->len - 1; i > 0; i--)
> +			ctx->offset[i] = ctx->offset[i - 1];
> +		ctx->offset[0] = ninsns_rvoff(ctx->prologue_len);
> +		bpf_prog_update_insn_ptrs(prog, ctx->offset, jit_data->ro_image);
>  out_offset:
>  		kvfree(ctx->offset);
>  		kfree(jit_data);

This isn't a bug, but could the comment say "shift ctx->offset[] by one"
rather than "shift the linfo array by one"? The jited_linfo was already
filled in by the bpf_prog_fill_jited_linfo() call above, and it is the
JIT's own offset table that is being rewritten here.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/35866214591


More information about the linux-riscv mailing list