From: Song Liu <songliubraving@fb.com>
To: Yonghong Song <yhs@fb.com>
Cc: "bpf@vger.kernel.org" <bpf@vger.kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH bpf-next v2 2/2] selftests/bpf: add a test for ptr_to_map_value on stack for helper access
Date: Thu, 10 Dec 2020 17:19:00 +0000 [thread overview]
Message-ID: <430138FE-BA48-4EE2-9D83-79192FB1DAD3@fb.com> (raw)
In-Reply-To: <20201210013350.943985-1-yhs@fb.com>
> On Dec 9, 2020, at 5:33 PM, Yonghong Song <yhs@fb.com> wrote:
>
> Change bpf_iter_task.c such that pointer to map_value may appear
> on the stack for bpf_seq_printf() to access. Without previous
> verifier patch, the bpf_iter test will fail.
>
> Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
> ---
> tools/testing/selftests/bpf/progs/bpf_iter_task.c | 3 ++-
> tools/testing/selftests/bpf/verifier/unpriv.c | 5 +++--
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_task.c b/tools/testing/selftests/bpf/progs/bpf_iter_task.c
> index 4983087852a0..b7f32c160f4e 100644
> --- a/tools/testing/selftests/bpf/progs/bpf_iter_task.c
> +++ b/tools/testing/selftests/bpf/progs/bpf_iter_task.c
> @@ -11,9 +11,10 @@ int dump_task(struct bpf_iter__task *ctx)
> {
> struct seq_file *seq = ctx->meta->seq;
> struct task_struct *task = ctx->task;
> + static char info[] = " === END ===";
>
> if (task == (void *)0) {
> - BPF_SEQ_PRINTF(seq, " === END ===\n");
> + BPF_SEQ_PRINTF(seq, "%s\n", info);
> return 0;
> }
>
> diff --git a/tools/testing/selftests/bpf/verifier/unpriv.c b/tools/testing/selftests/bpf/verifier/unpriv.c
> index 91bb77c24a2e..a3fe0fbaed41 100644
> --- a/tools/testing/selftests/bpf/verifier/unpriv.c
> +++ b/tools/testing/selftests/bpf/verifier/unpriv.c
> @@ -108,8 +108,9 @@
> BPF_EXIT_INSN(),
> },
> .fixup_map_hash_8b = { 3 },
> - .errstr = "invalid indirect read from stack off -8+0 size 8",
> - .result = REJECT,
> + .errstr_unpriv = "invalid indirect read from stack off -8+0 size 8",
> + .result_unpriv = REJECT,
> + .result = ACCEPT,
> },
> {
> "unpriv: mangle pointer on stack 1",
> --
> 2.24.1
>
prev parent reply other threads:[~2020-12-10 17:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-10 1:33 [PATCH bpf-next v2 0/2] bpf: permits pointers on stack for helper calls Yonghong Song
2020-12-10 1:33 ` [PATCH bpf-next v2 1/2] " Yonghong Song
2020-12-10 17:18 ` Song Liu
2020-12-11 0:10 ` Daniel Borkmann
2020-12-11 2:24 ` Yonghong Song
2020-12-10 1:33 ` [PATCH bpf-next v2 2/2] selftests/bpf: add a test for ptr_to_map_value on stack for helper access Yonghong Song
2020-12-10 17:19 ` Song Liu [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=430138FE-BA48-4EE2-9D83-79192FB1DAD3@fb.com \
--to=songliubraving@fb.com \
--cc=Kernel-team@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--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).