bpf: Apply F_NEEDS_EFFICIENT_UNALIGNED_ACCESS to more ACCEPT test cases.
authorDavid Miller <davem@davemloft.net>
Sat, 1 Dec 2018 05:08:50 +0000 (21:08 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 1 Dec 2018 05:38:48 +0000 (21:38 -0800)
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: David S. Miller <davem@davemloft.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/test_verifier.c

index 6bfd3242ea43324a000a02588d09eb5dfc46f221..c3b038f26ecef94ff7d5a779cf22183f57ba5570 100644 (file)
@@ -3918,6 +3918,7 @@ static struct bpf_test tests[] = {
                },
                .prog_type = BPF_PROG_TYPE_SCHED_CLS,
                .result = ACCEPT,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "direct packet access: test21 (x += pkt_ptr, 2)",
@@ -3943,6 +3944,7 @@ static struct bpf_test tests[] = {
                },
                .prog_type = BPF_PROG_TYPE_SCHED_CLS,
                .result = ACCEPT,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "direct packet access: test22 (x += pkt_ptr, 3)",
@@ -3973,6 +3975,7 @@ static struct bpf_test tests[] = {
                },
                .prog_type = BPF_PROG_TYPE_SCHED_CLS,
                .result = ACCEPT,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "direct packet access: test23 (x += pkt_ptr, 4)",
@@ -4025,6 +4028,7 @@ static struct bpf_test tests[] = {
                },
                .prog_type = BPF_PROG_TYPE_SCHED_CLS,
                .result = ACCEPT,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "direct packet access: test25 (marking on <, good access)",
@@ -7732,6 +7736,7 @@ static struct bpf_test tests[] = {
                .result = ACCEPT,
                .prog_type = BPF_PROG_TYPE_SCHED_CLS,
                .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)",
@@ -9694,6 +9699,7 @@ static struct bpf_test tests[] = {
                },
                .result = ACCEPT,
                .prog_type = BPF_PROG_TYPE_XDP,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "XDP pkt read, pkt_data' > pkt_end, bad access 1",
@@ -9865,6 +9871,7 @@ static struct bpf_test tests[] = {
                },
                .result = ACCEPT,
                .prog_type = BPF_PROG_TYPE_XDP,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "XDP pkt read, pkt_end < pkt_data', bad access 1",
@@ -9977,6 +9984,7 @@ static struct bpf_test tests[] = {
                },
                .result = ACCEPT,
                .prog_type = BPF_PROG_TYPE_XDP,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "XDP pkt read, pkt_end >= pkt_data', bad access 1",
@@ -10034,6 +10042,7 @@ static struct bpf_test tests[] = {
                },
                .result = ACCEPT,
                .prog_type = BPF_PROG_TYPE_XDP,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "XDP pkt read, pkt_data' <= pkt_end, bad access 1",
@@ -10146,6 +10155,7 @@ static struct bpf_test tests[] = {
                },
                .result = ACCEPT,
                .prog_type = BPF_PROG_TYPE_XDP,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "XDP pkt read, pkt_meta' > pkt_data, bad access 1",
@@ -10317,6 +10327,7 @@ static struct bpf_test tests[] = {
                },
                .result = ACCEPT,
                .prog_type = BPF_PROG_TYPE_XDP,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "XDP pkt read, pkt_data < pkt_meta', bad access 1",
@@ -10429,6 +10440,7 @@ static struct bpf_test tests[] = {
                },
                .result = ACCEPT,
                .prog_type = BPF_PROG_TYPE_XDP,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "XDP pkt read, pkt_data >= pkt_meta', bad access 1",
@@ -10486,6 +10498,7 @@ static struct bpf_test tests[] = {
                },
                .result = ACCEPT,
                .prog_type = BPF_PROG_TYPE_XDP,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "XDP pkt read, pkt_meta' <= pkt_data, bad access 1",
@@ -12405,6 +12418,7 @@ static struct bpf_test tests[] = {
                .prog_type = BPF_PROG_TYPE_SCHED_CLS,
                .result = ACCEPT,
                .retval = 1,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "calls: pkt_ptr spill into caller stack 4",
@@ -12439,6 +12453,7 @@ static struct bpf_test tests[] = {
                .prog_type = BPF_PROG_TYPE_SCHED_CLS,
                .result = ACCEPT,
                .retval = 1,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "calls: pkt_ptr spill into caller stack 5",
@@ -12584,6 +12599,7 @@ static struct bpf_test tests[] = {
                },
                .prog_type = BPF_PROG_TYPE_SCHED_CLS,
                .result = ACCEPT,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "calls: pkt_ptr spill into caller stack 9",
@@ -13507,6 +13523,7 @@ static struct bpf_test tests[] = {
                },
                .prog_type = BPF_PROG_TYPE_SCHED_CLS,
                .result = ACCEPT,
+               .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
        },
        {
                "reference tracking in call: free reference in subprog",