netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Hao Luo <haoluo@google.com>
Cc: Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andriin@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@chromium.org>
Subject: Re: [PATCH] bpf: Fix test_verifier after introducing resolve_pseudo_ldimm64
Date: Tue, 6 Oct 2020 17:56:20 -0700	[thread overview]
Message-ID: <CAEf4BzakCTkR2E1EPgAKEgdBqwLif3HOZWCypE0h-Z9oS5zrkg@mail.gmail.com> (raw)
In-Reply-To: <CA+khW7hVh4PJHtZSNG-_ZPxthQdvKSxoL4P17GZn5NdQxjnHxA@mail.gmail.com>

On Tue, Oct 6, 2020 at 5:51 PM Hao Luo <haoluo@google.com> wrote:
>
> On Tue, Oct 6, 2020 at 5:43 PM Andrii Nakryiko
> <andrii.nakryiko@gmail.com> wrote:
> >
> > On Tue, Oct 6, 2020 at 4:45 PM Hao Luo <haoluo@google.com> wrote:
> > >
> > > Commit 4976b718c355 ("bpf: Introduce pseudo_btf_id") switched
> > > the order of check_subprogs() and resolve_pseudo_ldimm() in
> > > the verifier. Now an empty prog and the prog of a single
> > > invalid ldimm expect to see the error "last insn is not an
> > > exit or jmp" instead, because the check for subprogs comes
> > > first. Fix the expection of the error message.
> > >
> > > Tested:
> > >  # ./test_verifier
> > >  Summary: 1130 PASSED, 538 SKIPPED, 0 FAILED
> > >  and the full set of bpf selftests.
> > >
> > > Fixes: 4976b718c355 ("bpf: Introduce pseudo_btf_id")
> > > Signed-off-by: Hao Luo <haoluo@google.com>
> > > ---
> [...]
> > > diff --git a/tools/testing/selftests/bpf/verifier/ld_imm64.c b/tools/testing/selftests/bpf/verifier/ld_imm64.c
> > > index 3856dba733e9..f300ba62edd0 100644
> > > --- a/tools/testing/selftests/bpf/verifier/ld_imm64.c
> > > +++ b/tools/testing/selftests/bpf/verifier/ld_imm64.c
> > > @@ -55,7 +55,7 @@
> > >         .insns = {
> > >         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 0),
> > >         },
> > > -       .errstr = "invalid bpf_ld_imm64 insn",
> > > +       .errstr = "last insn is not an exit or jmp",
> >
> > but this completely defeats the purpose of the test; better add
> > BPF_EXIT_INSN() after ldimm64 instruction to actually get to
> > validation of ldimm64
> >
>
> Actually there is already a test (test4) that covers this case. So it
> makes sense to remove it, I think. I will resend with this change.

ah, this test validates that half of ldimm64 at the very end won't
cause any troubles to verifier... Yeah, I guess now it's pointless
because it can never be the very last instruction.

>
> > >         .result = REJECT,
> > >  },
> > >  {
> > > --
> > > 2.28.0.806.g8561365e88-goog
> > >

      reply	other threads:[~2020-10-07  0:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 23:17 [PATCH] bpf: Fix test_verifier after introducing resolve_pseudo_ldimm64 Hao Luo
2020-10-07  0:43 ` Andrii Nakryiko
2020-10-07  0:50   ` Hao Luo
2020-10-07  0:56     ` Andrii Nakryiko [this message]

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=CAEf4BzakCTkR2E1EPgAKEgdBqwLif3HOZWCypE0h-Z9oS5zrkg@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.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;
as well as URLs for NNTP newsgroup(s).