BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Yazhou Tang <tangyazhou@zju.edu.cn>, bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com,
	 andrii@kernel.org, martin.lau@linux.dev, song@kernel.org,
	yonghong.song@linux.dev, 	kpsingh@kernel.org, sdf@fomichev.me,
	haoluo@google.com, jolsa@kernel.org, 	tangyazhou518@outlook.com,
	shenghaoyuan0928@163.com, ziye@zju.edu.cn,
		syzbot@syzkaller.appspotmail.com
Subject: Re: [PATCH bpf-next v5 1/2] bpf: Add range tracking for BPF_DIV and BPF_MOD
Date: Tue, 20 Jan 2026 10:51:36 -0800	[thread overview]
Message-ID: <57dbe0b62e2cf0370f90825f9508c466cd673704.camel@gmail.com> (raw)
In-Reply-To: <20260119085458.182221-2-tangyazhou@zju.edu.cn>

On Mon, 2026-01-19 at 16:54 +0800, Yazhou Tang wrote:

[...]

Hi Yazhou, Alexei,

Sorry for chiming in late in the series.

> diff --git a/tools/testing/selftests/bpf/progs/verifier_value_illegal_alu.c b/tools/testing/selftests/bpf/progs/verifier_value_illegal_alu.c
> index 2129e4353fd9..4d8273c258d5 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_value_illegal_alu.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_value_illegal_alu.c
> @@ -173,14 +173,15 @@ __naked void flow_keys_illegal_variable_offset_alu(void)
>  	asm volatile("					\
>  	r6 = r1;					\
>  	r7 = *(u64*)(r6 + %[flow_keys_off]);		\
> -	r8 = 8;						\
> -	r8 /= 1;					\
> +	call %[bpf_get_prandom_u32];			\
> +	r8 = r0;					\

I suggest we special case `rX /= 1`.
Maybe in the is_safe_to_compute_dst_reg_range().
This is an old trick that might be used in the wild.
And optimizer should remove any such instructions when compiling from C.
So I don't think adding special case here would hinder verifier versatility.

>  	r8 &= 8;					\
>  	r7 += r8;					\
>  	r0 = *(u64*)(r7 + 0);				\
>  	exit;						\
>  "	:
> -	: __imm_const(flow_keys_off, offsetof(struct __sk_buff, flow_keys))
> +	: __imm_const(flow_keys_off, offsetof(struct __sk_buff, flow_keys)),
> +	  __imm(bpf_get_prandom_u32)
>  	: __clobber_all);
>  }

  reply	other threads:[~2026-01-20 18:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19  8:54 [PATCH bpf-next v5 0/2] bpf: Add range tracking for BPF_DIV and BPF_MOD Yazhou Tang
2026-01-19  8:54 ` [PATCH bpf-next v5 1/2] " Yazhou Tang
2026-01-20 18:51   ` Eduard Zingerman [this message]
2026-01-20 21:03     ` Alexei Starovoitov
2026-01-20 21:54       ` Eduard Zingerman
2026-01-20 22:02         ` Alexei Starovoitov
2026-01-21  0:32   ` Eduard Zingerman
2026-01-19  8:54 ` [PATCH bpf-next v5 2/2] selftests/bpf: Add tests for BPF_DIV and BPF_MOD range tracking Yazhou Tang
2026-01-21  0:50 ` [PATCH bpf-next v5 0/2] bpf: Add range tracking for BPF_DIV and BPF_MOD patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57dbe0b62e2cf0370f90825f9508c466cd673704.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=shenghaoyuan0928@163.com \
    --cc=song@kernel.org \
    --cc=syzbot@syzkaller.appspotmail.com \
    --cc=tangyazhou518@outlook.com \
    --cc=tangyazhou@zju.edu.cn \
    --cc=yonghong.song@linux.dev \
    --cc=ziye@zju.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox