netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Ian Denhardt <ian@zenhack.net>,
	ast@kernel.org, daniel@iogearbox.net, bpf@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] tools, bpf_asm: Hard error on out of range jumps.
Date: Wed, 24 Feb 2021 10:30:55 +0100	[thread overview]
Message-ID: <f215762a6033020e79c2b9f5ab2a410c06499a1a.camel@linux.ibm.com> (raw)
In-Reply-To: <af571eef0bc5d33180879c0c81a7d1b26431b915.1614134213.git.ian@zenhack.net>

On Tue, 2021-02-23 at 21:15 -0500, Ian Denhardt wrote:
> Per discussion at:
> 
> https://lore.kernel.org/bpf/c964892195a6b91d20a67691448567ef528ffa6d.camel@linux.ibm.com/T/#t
> 
> ...this was originally introduced as a warning due to concerns about
> breaking existing code, but a hard error probably makes more sense,
> especially given that concerns about breakage were only speculation.
> ---
>  tools/bpf/bpf_exp.y | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/bpf/bpf_exp.y b/tools/bpf/bpf_exp.y
> index 8d48e896be50..8d03e5245da5 100644
> --- a/tools/bpf/bpf_exp.y
> +++ b/tools/bpf/bpf_exp.y
> @@ -549,9 +549,11 @@ static uint8_t bpf_encode_jt_jf_offset(int off,
> int i)
>  {
>         int delta = off - i - 1;
>  
> -       if (delta < 0 || delta > 255)
> -               fprintf(stderr, "warning: insn #%d jumps to insn #%d, "
> +       if (delta < 0 || delta > 255) {
> +               fprintf(stderr, "error: insn #%d jumps to insn #%d, "
>                                 "which is out of range\n", i, off);
> +               exit(1);
> +       }
>         return (uint8_t) delta;
>  }
>  

Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>


  reply	other threads:[~2021-02-24  9:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24  2:36 [PATCH 0/2] More strict error checking in bpf_asm Ian Denhardt
2021-02-24  2:15 ` [PATCH 1/2] tools, bpf_asm: Hard error on out of range jumps Ian Denhardt
2021-02-24  9:30   ` Ilya Leoshkevich [this message]
2021-02-24  2:24 ` [PATCH 2/2] tools, bpf_asm: exit non-zero on errors Ian Denhardt
2021-02-24 20:34 ` [PATCH 0/2] More strict error checking in bpf_asm Daniel Borkmann
  -- strict thread matches above, loose matches on Subject: below --
2021-02-24 21:15 [PATCH 0/2] More strict error checking in bpf_asm (v2) Ian Denhardt
2021-02-24  2:15 ` [PATCH 1/2] tools, bpf_asm: Hard error on out of range jumps Ian Denhardt
2021-02-24 21:24 [PATCH 0/2] More strict error checking in bpf_asm (v3) Ian Denhardt
2021-02-24  2:15 ` [PATCH 1/2] tools, bpf_asm: Hard error on out of range jumps Ian Denhardt

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=f215762a6033020e79c2b9f5ab2a410c06499a1a.camel@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=ian@zenhack.net \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).