All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	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>
Subject: Re: [PATCH bpf-next v2 0/2] Use overflow.h helpers to check for overflows
Date: Mon, 1 Jul 2024 11:18:39 +0200	[thread overview]
Message-ID: <ZoJ0b_DtHvcTbehC@krava> (raw)
In-Reply-To: <20240701055907.82481-1-shung-hsi.yu@suse.com>

On Mon, Jul 01, 2024 at 01:59:03PM +0800, Shung-Hsi Yu wrote:
> This patch set refactors kernel/bpf/verifier.c to use type-agnostic,
> generic overflow-check helpers defined in include/linux/overflow.h to
> check for addition and subtraction overflow, and drop the
> signed_*_overflows() helpers we currently have in kernel/bpf/verifier.c.
> There should be no functional change in how the verifier works.
> 
> The main motivation is to make future refactoring[1] easier.
> 
> While check_mul_overflow() also exists and could potentially replace what
> we have in scalar*_min_max_mul(), it does not help with refactoring and
> would either change how the verifier works (e.g. lifting restriction on
> umax<=U32_MAX and u32_max<=U16_MAX) or make the code slightly harder to
> read, so it is left for future endeavour.
> 
> Changes from v1 <https://lore.kernel.org/r/20240623070324.12634-1-shung-hsi.yu@suse.com>:
> - use pointers to values in dst_reg directly as the sum/diff pointer and
>   remove the else branch (Jiri)
> - change local variables to be dst_reg pointers instead of src_reg values
> - include comparison of generated assembly before & after the change
>   (Alexei)
> 
> 1: https://github.com/kernel-patches/bpf/pull/7205/commits

CI failed, but it looks like aws hiccup:
  https://github.com/kernel-patches/bpf/actions/runs/9739067425/job/26873810583

lgtm

Acked-by: Jiri Olsa <jolsa@kernel.org>

jirka

> 
> Shung-Hsi Yu (2):
>   bpf: use check_add_overflow() to check for addition overflows
>   bpf: use check_sub_overflow() to check for subtraction overflows
> 
>  kernel/bpf/verifier.c | 151 ++++++++++++------------------------------
>  1 file changed, 42 insertions(+), 109 deletions(-)
> 
> -- 
> 2.45.2
> 

  parent reply	other threads:[~2024-07-01  9:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01  5:59 [PATCH bpf-next v2 0/2] Use overflow.h helpers to check for overflows Shung-Hsi Yu
2024-07-01  5:59 ` [PATCH bpf-next v2 1/2] bpf: use check_add_overflow() to check for addition overflows Shung-Hsi Yu
2024-07-10  2:08   ` Alexei Starovoitov
2024-07-11 15:06     ` Shung-Hsi Yu
2024-07-01  5:59 ` [PATCH bpf-next v2 2/2] bpf: use check_sub_overflow() to check for subtraction overflows Shung-Hsi Yu
2024-07-01  9:18 ` Jiri Olsa [this message]
2024-07-01  9:45   ` [PATCH bpf-next v2 0/2] Use overflow.h helpers to check for overflows 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=ZoJ0b_DtHvcTbehC@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@google.com \
    --cc=shung-hsi.yu@suse.com \
    --cc=song@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.