From: Eric Dumazet <eric.dumazet@gmail.com>
To: Song Liu <songliubraving@fb.com>, netdev@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, kernel-team@fb.com,
edumazet@google.com
Subject: Re: [PATCH v6 bpf-next 2/2] bpf: add tests for direct packet access from CGROUP_SKB
Date: Fri, 19 Oct 2018 07:58:28 -0700 [thread overview]
Message-ID: <27029e13-b317-4478-e3d7-8b49c3742c2b@gmail.com> (raw)
In-Reply-To: <20181019055333.3829195-3-songliubraving@fb.com>
On 10/18/2018 10:53 PM, Song Liu wrote:
> Tests are added to make sure CGROUP_SKB cannot access:
> tc_classid, data_meta, flow_keys
>
> and can read and write:
> mark, prority, and cb[0-4]
>
> and can read other fields.
>
> To make selftest with skb->sk work, a dummy sk is added in
> bpf_prog_test_run_skb().
>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
> net/bpf/test_run.c | 7 +
> tools/testing/selftests/bpf/test_verifier.c | 171 ++++++++++++++++++++
> 2 files changed, 178 insertions(+)
>
> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> index 0c423b8cd75c..87ea279cb095 100644
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c
> @@ -10,6 +10,8 @@
> #include <linux/etherdevice.h>
> #include <linux/filter.h>
> #include <linux/sched/signal.h>
> +#include <net/sock.h>
> +#include <net/tcp.h>
>
> static __always_inline u32 bpf_test_run_one(struct bpf_prog *prog, void *ctx,
> struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE])
> @@ -115,6 +117,7 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
> u32 retval, duration;
> int hh_len = ETH_HLEN;
> struct sk_buff *skb;
> + struct sock sk = {0};
> void *data;
> int ret;
>
A dummy on stack, Nah forget it.
Please compile your test kernels with common debugging features,
I am sure some horrible thing will show up.
(Like debug_object_is_on_stack())
prev parent reply other threads:[~2018-10-19 23:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 5:53 [PATCH v6 bpf-next 0/2] bpf: add cg_skb_is_valid_access Song Liu
2018-10-19 5:53 ` [PATCH v6 bpf-next 1/2] bpf: add cg_skb_is_valid_access for BPF_PROG_TYPE_CGROUP_SKB Song Liu
2018-10-19 5:53 ` [PATCH v6 bpf-next 2/2] bpf: add tests for direct packet access from CGROUP_SKB Song Liu
2018-10-19 14:58 ` Eric Dumazet [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=27029e13-b317-4478-e3d7-8b49c3742c2b@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=edumazet@google.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@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