Re: [PATCH bpf-next v7 1/9] bpf: Allow instructions with arena source and non-arena dest registers

Alexei Starovoitov
2026-04-12T19:54:21Z

On Sun, Apr 12, 2026 at 10:45 AM Emil Tsalapatis <emil@etsalapatis.com> wrote:
>
> The compiler sometimes stores the result of a PTR_TO_ARENA and SCALAR
> operation into the scalar register rather than the pointer register.
> Relax the verifier to allow operations between a source arena register
> and a destination non-arena register, marking the destination's value
> as a PTR_TO_ARENA.
>
> Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>
> Acked-by: Song Liu <song@kernel.org>
> Fixes: 6082b6c328b5 ("bpf: Recognize addr_space_cast instruction in the verifier.")
> ---
> kernel/bpf/verifier.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 9c1135d373e2..9280b3aaae46 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -16655,11 +16655,21 @@ static int adjust_reg_min_max_vals(struct bpf_verifier_env *env,
> int err;
>
> dst_reg = &regs[insn->dst_reg];
> - src_reg = NULL;
> + if (BPF_SRC(insn->code) == BPF_X)
> + src_reg = &regs[insn->src_reg];

removal of that re-assignment few lines below got lost.
I removed it manually and applied the first 2 patches.