From: Stanislav Fomichev <sdf@google.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net,
Stanislav Fomichev <sdf@google.com>
Subject: [PATCH bpf-next 1/2] selftests/bpf: skip verifier tests that depend on CONFIG_CGROUP_BPF
Date: Wed, 12 Dec 2018 10:27:24 -0800 [thread overview]
Message-ID: <20181212182725.106418-1-sdf@google.com> (raw)
The following prog types don't make sense without bpf cgroup:
* BPF_PROG_TYPE_CGROUP_SKB
* BPF_PROG_TYPE_CGROUP_SOCK
* BPF_PROG_TYPE_CGROUP_SOCK_ADDR
Skip running verifier tests that exercise these prog types if
kernel is built without proper support.
See commit e5c504858a18 ("selftests/bpf: skip verifier sockmap tests
on kernels without support") for original motivation.
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
tools/testing/selftests/bpf/test_verifier.c | 35 +++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index f5015566ae1b..b5470a399996 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -44,6 +44,7 @@
/* fallback to all features enabled */
# define CONFIG_BPF_STREAM_PARSER 1
# define CONFIG_XDP_SOCKETS 1
+# define CONFIG_CGROUP_BPF 1
#endif
#include "bpf_rlimit.h"
#include "bpf_rand.h"
@@ -2098,6 +2099,7 @@ static struct bpf_test tests[] = {
.errstr = "invalid bpf_context access",
.result = REJECT,
.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"check cb access: half",
@@ -2256,6 +2258,7 @@ static struct bpf_test tests[] = {
.errstr = "invalid bpf_context access",
.result = REJECT,
.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"check cb access: word",
@@ -2428,6 +2431,7 @@ static struct bpf_test tests[] = {
.errstr = "invalid bpf_context access",
.result = REJECT,
.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"check out of range skb->cb access",
@@ -4981,6 +4985,7 @@ static struct bpf_test tests[] = {
.result_unpriv = REJECT,
.errstr_unpriv = "invalid bpf_context access off=76 size=4",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"direct packet read test#2 for CGROUP_SKB",
@@ -5005,6 +5010,7 @@ static struct bpf_test tests[] = {
},
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"direct packet read test#3 for CGROUP_SKB",
@@ -5036,6 +5042,7 @@ static struct bpf_test tests[] = {
},
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"direct packet read test#4 for CGROUP_SKB",
@@ -5071,6 +5078,7 @@ static struct bpf_test tests[] = {
},
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid access of tc_classid for CGROUP_SKB",
@@ -5083,6 +5091,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "invalid bpf_context access",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid access of data_meta for CGROUP_SKB",
@@ -5095,6 +5104,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "invalid bpf_context access",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid access of flow_keys for CGROUP_SKB",
@@ -5107,6 +5117,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "invalid bpf_context access",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid write access to napi_id for CGROUP_SKB",
@@ -5121,6 +5132,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "invalid bpf_context access",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"valid cgroup storage access",
@@ -5137,6 +5149,7 @@ static struct bpf_test tests[] = {
.fixup_cgroup_storage = { 1 },
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid cgroup storage access 1",
@@ -5154,6 +5167,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "cannot pass map_type 1 into func bpf_get_local_storage",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid cgroup storage access 2",
@@ -5168,6 +5182,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "fd 1 is not pointing to valid bpf_map",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid cgroup storage access 3",
@@ -5185,6 +5200,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "invalid access to map value, value_size=64 off=256 size=4",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid cgroup storage access 4",
@@ -5202,6 +5218,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "invalid access to map value, value_size=64 off=-2 size=4",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
},
{
@@ -5220,6 +5237,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "get_local_storage() doesn't support non-zero flags",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid cgroup storage access 6",
@@ -5238,6 +5256,7 @@ static struct bpf_test tests[] = {
.errstr = "get_local_storage() doesn't support non-zero flags",
.errstr_unpriv = "R2 leaks addr into helper function",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"valid per-cpu cgroup storage access",
@@ -5254,6 +5273,7 @@ static struct bpf_test tests[] = {
.fixup_percpu_cgroup_storage = { 1 },
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid per-cpu cgroup storage access 1",
@@ -5271,6 +5291,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "cannot pass map_type 1 into func bpf_get_local_storage",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid per-cpu cgroup storage access 2",
@@ -5285,6 +5306,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "fd 1 is not pointing to valid bpf_map",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid per-cpu cgroup storage access 3",
@@ -5302,6 +5324,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "invalid access to map value, value_size=64 off=256 size=4",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid per-cpu cgroup storage access 4",
@@ -5319,6 +5342,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "invalid access to map value, value_size=64 off=-2 size=4",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
},
{
@@ -5337,6 +5361,7 @@ static struct bpf_test tests[] = {
.result = REJECT,
.errstr = "get_local_storage() doesn't support non-zero flags",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"invalid per-cpu cgroup storage access 6",
@@ -5355,6 +5380,7 @@ static struct bpf_test tests[] = {
.errstr = "get_local_storage() doesn't support non-zero flags",
.errstr_unpriv = "R2 leaks addr into helper function",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"write tstamp from CGROUP_SKB",
@@ -5369,6 +5395,7 @@ static struct bpf_test tests[] = {
.result_unpriv = REJECT,
.errstr_unpriv = "invalid bpf_context access off=152 size=8",
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"read tstamp from CGROUP_SKB",
@@ -5380,6 +5407,7 @@ static struct bpf_test tests[] = {
},
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"multiple registers share map_lookup_elem result",
@@ -10770,6 +10798,7 @@ static struct bpf_test tests[] = {
.errstr = "R0 has value (0x0; 0xffffffff)",
.result = REJECT,
.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"bpf_exit with invalid return code. test2",
@@ -10780,6 +10809,7 @@ static struct bpf_test tests[] = {
},
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"bpf_exit with invalid return code. test3",
@@ -10791,6 +10821,7 @@ static struct bpf_test tests[] = {
.errstr = "R0 has value (0x0; 0x3)",
.result = REJECT,
.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"bpf_exit with invalid return code. test4",
@@ -10800,6 +10831,7 @@ static struct bpf_test tests[] = {
},
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"bpf_exit with invalid return code. test5",
@@ -10810,6 +10842,7 @@ static struct bpf_test tests[] = {
.errstr = "R0 has value (0x2; 0x0)",
.result = REJECT,
.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"bpf_exit with invalid return code. test6",
@@ -10820,6 +10853,7 @@ static struct bpf_test tests[] = {
.errstr = "R0 is not a known value (ctx)",
.result = REJECT,
.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"bpf_exit with invalid return code. test7",
@@ -10832,6 +10866,7 @@ static struct bpf_test tests[] = {
.errstr = "R0 has unknown scalar value",
.result = REJECT,
.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
+ .config_disabled = !IS_BUILTIN(CONFIG_CGROUP_BPF),
},
{
"calls: basic sanity",
--
2.20.0.rc2.403.gdbc3b29805-goog
next reply other threads:[~2018-12-12 18:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-12 18:27 Stanislav Fomichev [this message]
2018-12-12 18:27 ` [PATCH bpf-next 2/2] selftests/bpf: skip verifier tests that depend on CONFIG_BPF_EVENTS Stanislav Fomichev
2018-12-12 18:51 ` [PATCH bpf-next 1/2] selftests/bpf: skip verifier tests that depend on CONFIG_CGROUP_BPF Alexei Starovoitov
2018-12-12 18:59 ` Stanislav Fomichev
2018-12-12 19:04 ` Alexei Starovoitov
2018-12-12 19:24 ` Stanislav Fomichev
2018-12-12 19:54 ` Stanislav Fomichev
2018-12-12 20:13 ` Alexei Starovoitov
2018-12-12 21:23 ` Edward Cree
2018-12-12 22:07 ` Alexei Starovoitov
2018-12-12 22:32 ` Stanislav Fomichev
2018-12-13 6:06 ` Alexei Starovoitov
2018-12-13 11:52 ` Daniel Borkmann
2018-12-13 12:18 ` Quentin Monnet
2018-12-13 16:37 ` Stanislav Fomichev
2018-12-13 17:02 ` Quentin Monnet
2018-12-13 17:10 ` Stanislav Fomichev
2018-12-14 11:43 ` Quentin Monnet
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=20181212182725.106418-1-sdf@google.com \
--to=sdf@google.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.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;
as well as URLs for NNTP newsgroup(s).