mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Harishankar Vishwanathan <harishankar.vishwanathan@gmail.com>,
	ast@kernel.org
Cc: harishankar.vishwanathan@rutgers.edu, paul@isovalent.com,
	Matan Shachnai <m.shachnai@rutgers.edu>,
	Srinivas Narayana <srinivas.narayana@rutgers.edu>,
	Santosh Nagarakatte <santosh.nagarakatte@rutgers.edu>,
	John Fastabend <john.fastabend@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Edward Cree <ecree@solarflare.com>,
	"David S. Miller" <davem@davemloft.net>,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 bpf-next] bpf: Fix latent unsoundness in and/or/xor value tracking
Date: Wed, 3 Apr 2024 10:39:20 +0200	[thread overview]
Message-ID: <82892691-a48f-ad06-7005-5bbd7d0757eb@iogearbox.net> (raw)
In-Reply-To: <20240402212039.51815-1-harishankar.vishwanathan@gmail.com>

On 4/2/24 11:20 PM, Harishankar Vishwanathan wrote:
[...]
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index fcb62300f407..a7404a7d690f 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -13326,23 +13326,21 @@ static void scalar32_min_max_and(struct bpf_reg_state *dst_reg,
>   		return;
>   	}
>   
> -	/* We get our minimum from the var_off, since that's inherently
> +	/* We get our minimum from the var32_off, since that's inherently
>   	 * bitwise.  Our maximum is the minimum of the operands' maxima.
>   	 */
>   	dst_reg->u32_min_value = var32_off.value;
>   	dst_reg->u32_max_value = min(dst_reg->u32_max_value, umax_val);
> -	if (dst_reg->s32_min_value < 0 || smin_val < 0) {

The smin_val is now unused, triggering the following warnings :

../kernel/bpf/verifier.c:13321:6: warning: unused variable 'smin_val' [-Wunused-variable]
  13321 |         s32 smin_val = src_reg->s32_min_value;
        |             ^~~~~~~~
../kernel/bpf/verifier.c:13352:6: warning: unused variable 'smin_val' [-Wunused-variable]
  13352 |         s64 smin_val = src_reg->smin_value;
        |             ^~~~~~~~
../kernel/bpf/verifier.c:13386:6: warning: unused variable 'smin_val' [-Wunused-variable]
  13386 |         s32 smin_val = src_reg->s32_min_value;
        |             ^~~~~~~~
../kernel/bpf/verifier.c:13417:6: warning: unused variable 'smin_val' [-Wunused-variable]
  13417 |         s64 smin_val = src_reg->smin_value;
        |             ^~~~~~~~
../kernel/bpf/verifier.c:13451:6: warning: unused variable 'smin_val' [-Wunused-variable]
  13451 |         s32 smin_val = src_reg->s32_min_value;
        |             ^~~~~~~~
../kernel/bpf/verifier.c:13479:6: warning: unused variable 'smin_val' [-Wunused-variable]
  13479 |         s64 smin_val = src_reg->smin_value;
        |             ^~~~~~~~

Removing these builds fine then, please follow-up with a v3.

Thanks,
Daniel

  reply	other threads:[~2024-04-03  9:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 21:20 Harishankar Vishwanathan
2024-04-03  8:39 ` Daniel Borkmann [this message]
2024-04-04  3:05   ` Harishankar Vishwanathan
2024-04-03 13:25 ` Edward Cree
2024-04-04  2:40   ` Harishankar Vishwanathan
2024-04-09 13:16     ` Shung-Hsi Yu
2024-04-09 17:17     ` Edward Cree
2024-04-10 11:43       ` Shung-Hsi Yu
2024-04-13  0:05         ` Harishankar Vishwanathan
2024-04-15  4:11           ` Shung-Hsi Yu

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=82892691-a48f-ad06-7005-5bbd7d0757eb@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=ecree@solarflare.com \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=harishankar.vishwanathan@gmail.com \
    --cc=harishankar.vishwanathan@rutgers.edu \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.shachnai@rutgers.edu \
    --cc=martin.lau@linux.dev \
    --cc=paul@isovalent.com \
    --cc=santosh.nagarakatte@rutgers.edu \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=srinivas.narayana@rutgers.edu \
    --cc=yonghong.song@linux.dev \
    /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®