mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Zeng Jingxiang <zengjx95@gmail.com>,
	ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com,
	andrii@kernel.org, martin.lau@linux.dev, song@kernel.org,
	kpsingh@kernel.org, sdf@google.com, haoluo@google.com,
	jolsa@kernel.org
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zeng Jingxiang <linuszeng@tencent.com>
Subject: Re: [PATCH] bpf/verifier: fix control flow issues in __reg64_bound_u32()
Date: Fri, 29 Jul 2022 10:15:21 -0700	[thread overview]
Message-ID: <e186cbd5-4c22-8069-717d-35bb8f8e4fff@fb.com> (raw)
In-Reply-To: <20220729054958.2151520-1-zengjx95@gmail.com>



On 7/28/22 10:49 PM, Zeng Jingxiang wrote:
> From: Zeng Jingxiang <linuszeng@tencent.com>
> 
> This greater-than-or-equal-to-zero comparison of an unsigned value
> is always true. "a >= U32_MIN".
> 1632	return a >= U32_MIN && a <= U32_MAX;
> 
> Fixes: b9979db83401 ("bpf: Fix propagation of bounds from 64-bit min/max into 32-bit and var_off.")
> Signed-off-by: Zeng Jingxiang <linuszeng@tencent.com>
> ---
>   kernel/bpf/verifier.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 0efbac0fd126..dd67108fb1d7 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -1629,7 +1629,7 @@ static bool __reg64_bound_s32(s64 a)
>   
>   static bool __reg64_bound_u32(u64 a)
>   {
> -	return a >= U32_MIN && a <= U32_MAX;
> +	return a <= U32_MAX;
>   }

I cannot find the related link. But IIRC, Alexei commented that
the code is written this way to express the intention (within
32bit bounds) so this patch is unnecessary...

>   
>   static void __reg_combine_64_into_32(struct bpf_reg_state *reg)

  reply	other threads:[~2022-07-29 17:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29  5:49 Zeng Jingxiang
2022-07-29 17:15 ` Yonghong Song [this message]
2022-07-29 17:17   ` Hao Luo

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=e186cbd5-4c22-8069-717d-35bb8f8e4fff@fb.com \
    --to=yhs@fb.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=linuszeng@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=zengjx95@gmail.com \
    /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

all inboxes | Powered by JetHome®