From: Zvi Effron <zeffron@riotgames.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Cody Haas <chaas@riotgames.com>,
Lisa Watanabe <lwatanabe@riotgames.com>
Subject: Re: [PATCH bpf-next v2 3/3] selftests/bpf: Add test for xdp_md context in BPF_PROG_TEST_RUN
Date: Fri, 28 May 2021 11:35:31 -0700 [thread overview]
Message-ID: <CAC1LvL1LWQB=LQc+dYMdjusJouv+oFOB83WNF+SzrOedBygEYw@mail.gmail.com> (raw)
In-Reply-To: <CAEf4Bzb=ECAtJAikaeSLomQCcwNC7JnwZxPc=j3=YnPjnfaycg@mail.gmail.com>
On Thu, May 27, 2021 at 6:28 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Thu, May 27, 2021 at 1:14 PM Zvi Effron <zeffron@riotgames.com> wrote:
> >
> > + /* Data past the end of the kernel's struct xdp_md must be 0 */
> > + bad_ctx[sizeof(bad_ctx) - 1] = 1;
> > + tattr.ctx_in = bad_ctx;
> > + tattr.ctx_size_in = sizeof(bad_ctx);
> > + err = bpf_prog_test_run_opts(prog_fd, &tattr);
> > + ASSERT_ERR(err, "bpf_prog_test_run(test2)");
> > + ASSERT_EQ(errno, 22, "test2-errno");
>
> by the time you are checking errno it might get overwritten. If you
> want to check errno, you have to remember it right after the function
> returns
>
I just noticed that the CHECK macro (which the ASSERT macro wraps)
already saves/restores errno. Is this not behavior that can be relied
on?
prev parent reply other threads:[~2021-05-28 18:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-27 20:13 [PATCH bpf-next v2 0/3] bpf: support input xdp_md context in BPF_PROG_TEST_RUN Zvi Effron
2021-05-27 20:13 ` [PATCH bpf-next v2 1/3] " Zvi Effron
2021-05-28 9:30 ` Maciej Fijalkowski
2021-05-28 18:40 ` Zvi Effron
2021-05-27 20:13 ` [PATCH bpf-next v2 2/3] bpf: support specifying ingress via " Zvi Effron
2021-05-27 20:13 ` [PATCH bpf-next v2 3/3] selftests/bpf: Add test for " Zvi Effron
2021-05-28 1:28 ` Andrii Nakryiko
2021-05-28 2:10 ` Zvi Effron
2021-05-28 3:21 ` Andrii Nakryiko
2021-05-28 18:35 ` Zvi Effron [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='CAC1LvL1LWQB=LQc+dYMdjusJouv+oFOB83WNF+SzrOedBygEYw@mail.gmail.com' \
--to=zeffron@riotgames.com \
--cc=andrii.nakryiko@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chaas@riotgames.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=lwatanabe@riotgames.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).