From: Eduard Zingerman <eddyz87@gmail.com>
To: Song Liu <song@kernel.org>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH bpf-next v2 2/3] selftests/bpf: allow BTF specs and func infos in test_verifier tests
Date: Wed, 01 Jun 2022 02:20:01 +0300 [thread overview]
Message-ID: <b517e19ffbd19b24b630cdeafdb4adb444a8dd56.camel@gmail.com> (raw)
In-Reply-To: <CAPhsuW7wwt+J=oHXeB_8s8Tu63dzgODh56aCFPv-Vp43bofutA@mail.gmail.com>
> On Tue, 2022-05-31 at 13:52 -0700, Song Liu wrote:
Hi Song,
Thanks a lot for the review, I'll apply the suggested changes and
provide the v3 in one or two days. My only objection is below.
> > {
> > - int fd_prog, expected_ret, alignment_prevented_execution;
> > + int fd_prog, btf_fd, expected_ret, alignment_prevented_execution;
> > int prog_len, prog_type = test->prog_type;
> > struct bpf_insn *prog = test->insns;
> > LIBBPF_OPTS(bpf_prog_load_opts, opts); __u32 pflags;
> > int i, err;
> >
> > + fd_prog = -1;
>
> This is not really necessary.
Actually this one is necessary to avoid compiler warning, note the
following fragment of the do_test_single function below:
static void do_test_single(...)
{
...
if (...) {
btf_fd = load_btf_for_test(...);
if (btf_fd < 0)
goto fail_log;
opts.prog_btf_fd = btf_fd;
}
...
fd_prog = bpf_prog_load(..., &opts);
...
close_fds:
...
close(fd_prog);
close(btf_fd);
...
return;
fail_log:
...
goto close_fds;
}
If load_btf_for_test fails the goto fail_log would eventually jump to
close_fds, where fd_prog would be in an uninitialised state.
Best regards,
Eduard
next prev parent reply other threads:[~2022-05-31 23:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-29 22:36 [PATCH bpf-next v2 0/3] bpf_loop inlining Eduard Zingerman
2022-05-29 22:36 ` [PATCH bpf-next v2 1/3] selftests/bpf: specify expected instructions in test_verifier tests Eduard Zingerman
2022-05-31 18:26 ` Song Liu
2022-05-29 22:36 ` [PATCH bpf-next v2 2/3] selftests/bpf: allow BTF specs and func infos " Eduard Zingerman
2022-05-31 20:52 ` Song Liu
2022-05-31 23:20 ` Eduard Zingerman [this message]
2022-06-01 4:10 ` Song Liu
2022-05-29 22:36 ` [PATCH bpf-next v2 3/3] bpf: Inline calls to bpf_loop when callback is known Eduard Zingerman
2022-05-31 22:10 ` Song Liu
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=b517e19ffbd19b24b630cdeafdb4adb444a8dd56.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=song@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