Commit 0a686324 authored by David Miller's avatar David Miller Committed by Alexei Starovoitov

bpf: Apply F_NEEDS_EFFICIENT_UNALIGNED_ACCESS to more ACCEPT test cases.

If a testcase has alignment problems but is expected to be ACCEPT,
verify it using F_NEEDS_EFFICIENT_UNALIGNED_ACCESS too.

Maybe in the future if we add some architecture specific code to elide
the unaligned memory access warnings during the test, we can execute
these as well.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 2acc5fd5
...@@ -3918,6 +3918,7 @@ static struct bpf_test tests[] = { ...@@ -3918,6 +3918,7 @@ static struct bpf_test tests[] = {
}, },
.prog_type = BPF_PROG_TYPE_SCHED_CLS, .prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT, .result = ACCEPT,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"direct packet access: test21 (x += pkt_ptr, 2)", "direct packet access: test21 (x += pkt_ptr, 2)",
...@@ -3943,6 +3944,7 @@ static struct bpf_test tests[] = { ...@@ -3943,6 +3944,7 @@ static struct bpf_test tests[] = {
}, },
.prog_type = BPF_PROG_TYPE_SCHED_CLS, .prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT, .result = ACCEPT,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"direct packet access: test22 (x += pkt_ptr, 3)", "direct packet access: test22 (x += pkt_ptr, 3)",
...@@ -3973,6 +3975,7 @@ static struct bpf_test tests[] = { ...@@ -3973,6 +3975,7 @@ static struct bpf_test tests[] = {
}, },
.prog_type = BPF_PROG_TYPE_SCHED_CLS, .prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT, .result = ACCEPT,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"direct packet access: test23 (x += pkt_ptr, 4)", "direct packet access: test23 (x += pkt_ptr, 4)",
...@@ -4025,6 +4028,7 @@ static struct bpf_test tests[] = { ...@@ -4025,6 +4028,7 @@ static struct bpf_test tests[] = {
}, },
.prog_type = BPF_PROG_TYPE_SCHED_CLS, .prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT, .result = ACCEPT,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"direct packet access: test25 (marking on <, good access)", "direct packet access: test25 (marking on <, good access)",
...@@ -7732,6 +7736,7 @@ static struct bpf_test tests[] = { ...@@ -7732,6 +7736,7 @@ static struct bpf_test tests[] = {
.result = ACCEPT, .result = ACCEPT,
.prog_type = BPF_PROG_TYPE_SCHED_CLS, .prog_type = BPF_PROG_TYPE_SCHED_CLS,
.retval = 0 /* csum_diff of 64-byte packet */, .retval = 0 /* csum_diff of 64-byte packet */,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"helper access to variable memory: size = 0 not allowed on NULL (!ARG_PTR_TO_MEM_OR_NULL)", "helper access to variable memory: size = 0 not allowed on NULL (!ARG_PTR_TO_MEM_OR_NULL)",
...@@ -9694,6 +9699,7 @@ static struct bpf_test tests[] = { ...@@ -9694,6 +9699,7 @@ static struct bpf_test tests[] = {
}, },
.result = ACCEPT, .result = ACCEPT,
.prog_type = BPF_PROG_TYPE_XDP, .prog_type = BPF_PROG_TYPE_XDP,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"XDP pkt read, pkt_data' > pkt_end, bad access 1", "XDP pkt read, pkt_data' > pkt_end, bad access 1",
...@@ -9865,6 +9871,7 @@ static struct bpf_test tests[] = { ...@@ -9865,6 +9871,7 @@ static struct bpf_test tests[] = {
}, },
.result = ACCEPT, .result = ACCEPT,
.prog_type = BPF_PROG_TYPE_XDP, .prog_type = BPF_PROG_TYPE_XDP,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"XDP pkt read, pkt_end < pkt_data', bad access 1", "XDP pkt read, pkt_end < pkt_data', bad access 1",
...@@ -9977,6 +9984,7 @@ static struct bpf_test tests[] = { ...@@ -9977,6 +9984,7 @@ static struct bpf_test tests[] = {
}, },
.result = ACCEPT, .result = ACCEPT,
.prog_type = BPF_PROG_TYPE_XDP, .prog_type = BPF_PROG_TYPE_XDP,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"XDP pkt read, pkt_end >= pkt_data', bad access 1", "XDP pkt read, pkt_end >= pkt_data', bad access 1",
...@@ -10034,6 +10042,7 @@ static struct bpf_test tests[] = { ...@@ -10034,6 +10042,7 @@ static struct bpf_test tests[] = {
}, },
.result = ACCEPT, .result = ACCEPT,
.prog_type = BPF_PROG_TYPE_XDP, .prog_type = BPF_PROG_TYPE_XDP,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"XDP pkt read, pkt_data' <= pkt_end, bad access 1", "XDP pkt read, pkt_data' <= pkt_end, bad access 1",
...@@ -10146,6 +10155,7 @@ static struct bpf_test tests[] = { ...@@ -10146,6 +10155,7 @@ static struct bpf_test tests[] = {
}, },
.result = ACCEPT, .result = ACCEPT,
.prog_type = BPF_PROG_TYPE_XDP, .prog_type = BPF_PROG_TYPE_XDP,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"XDP pkt read, pkt_meta' > pkt_data, bad access 1", "XDP pkt read, pkt_meta' > pkt_data, bad access 1",
...@@ -10317,6 +10327,7 @@ static struct bpf_test tests[] = { ...@@ -10317,6 +10327,7 @@ static struct bpf_test tests[] = {
}, },
.result = ACCEPT, .result = ACCEPT,
.prog_type = BPF_PROG_TYPE_XDP, .prog_type = BPF_PROG_TYPE_XDP,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"XDP pkt read, pkt_data < pkt_meta', bad access 1", "XDP pkt read, pkt_data < pkt_meta', bad access 1",
...@@ -10429,6 +10440,7 @@ static struct bpf_test tests[] = { ...@@ -10429,6 +10440,7 @@ static struct bpf_test tests[] = {
}, },
.result = ACCEPT, .result = ACCEPT,
.prog_type = BPF_PROG_TYPE_XDP, .prog_type = BPF_PROG_TYPE_XDP,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"XDP pkt read, pkt_data >= pkt_meta', bad access 1", "XDP pkt read, pkt_data >= pkt_meta', bad access 1",
...@@ -10486,6 +10498,7 @@ static struct bpf_test tests[] = { ...@@ -10486,6 +10498,7 @@ static struct bpf_test tests[] = {
}, },
.result = ACCEPT, .result = ACCEPT,
.prog_type = BPF_PROG_TYPE_XDP, .prog_type = BPF_PROG_TYPE_XDP,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"XDP pkt read, pkt_meta' <= pkt_data, bad access 1", "XDP pkt read, pkt_meta' <= pkt_data, bad access 1",
...@@ -12405,6 +12418,7 @@ static struct bpf_test tests[] = { ...@@ -12405,6 +12418,7 @@ static struct bpf_test tests[] = {
.prog_type = BPF_PROG_TYPE_SCHED_CLS, .prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT, .result = ACCEPT,
.retval = 1, .retval = 1,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"calls: pkt_ptr spill into caller stack 4", "calls: pkt_ptr spill into caller stack 4",
...@@ -12439,6 +12453,7 @@ static struct bpf_test tests[] = { ...@@ -12439,6 +12453,7 @@ static struct bpf_test tests[] = {
.prog_type = BPF_PROG_TYPE_SCHED_CLS, .prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT, .result = ACCEPT,
.retval = 1, .retval = 1,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"calls: pkt_ptr spill into caller stack 5", "calls: pkt_ptr spill into caller stack 5",
...@@ -12584,6 +12599,7 @@ static struct bpf_test tests[] = { ...@@ -12584,6 +12599,7 @@ static struct bpf_test tests[] = {
}, },
.prog_type = BPF_PROG_TYPE_SCHED_CLS, .prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT, .result = ACCEPT,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"calls: pkt_ptr spill into caller stack 9", "calls: pkt_ptr spill into caller stack 9",
...@@ -13507,6 +13523,7 @@ static struct bpf_test tests[] = { ...@@ -13507,6 +13523,7 @@ static struct bpf_test tests[] = {
}, },
.prog_type = BPF_PROG_TYPE_SCHED_CLS, .prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT, .result = ACCEPT,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"reference tracking in call: free reference in subprog", "reference tracking in call: free reference in subprog",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment