Commit ce1f289f authored by Björn Töpel's avatar Björn Töpel Committed by Daniel Borkmann

selftests/bpf: Add F_NEEDS_EFFICIENT_UNALIGNED_ACCESS to some tests

Some verifier tests were missing F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
which made the test fail. Add the flag where needed.
Signed-off-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20230705113926.751791-2-bjorn@kernel.org
parent cf6eeb8f
...@@ -242,4 +242,5 @@ ...@@ -242,4 +242,5 @@
.result = REJECT, .result = REJECT,
.errstr = "R0 invalid mem access", .errstr = "R0 invalid mem access",
.errstr_unpriv = "R10 partial copy of pointer", .errstr_unpriv = "R10 partial copy of pointer",
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
...@@ -1169,6 +1169,7 @@ ...@@ -1169,6 +1169,7 @@
}, },
.result = ACCEPT, .result = ACCEPT,
.prog_type = BPF_PROG_TYPE_SK_SKB, .prog_type = BPF_PROG_TYPE_SK_SKB,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"pkt_end < pkt taken check", "pkt_end < pkt taken check",
...@@ -1190,4 +1191,5 @@ ...@@ -1190,4 +1191,5 @@
}, },
.result = ACCEPT, .result = ACCEPT,
.prog_type = BPF_PROG_TYPE_SK_SKB, .prog_type = BPF_PROG_TYPE_SK_SKB,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
...@@ -290,6 +290,7 @@ ...@@ -290,6 +290,7 @@
.result_unpriv = REJECT, .result_unpriv = REJECT,
.result = ACCEPT, .result = ACCEPT,
.retval = 2, .retval = 2,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"jgt32: BPF_K", "jgt32: BPF_K",
...@@ -360,6 +361,7 @@ ...@@ -360,6 +361,7 @@
.result_unpriv = REJECT, .result_unpriv = REJECT,
.result = ACCEPT, .result = ACCEPT,
.retval = 2, .retval = 2,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"jle32: BPF_K", "jle32: BPF_K",
...@@ -430,6 +432,7 @@ ...@@ -430,6 +432,7 @@
.result_unpriv = REJECT, .result_unpriv = REJECT,
.result = ACCEPT, .result = ACCEPT,
.retval = 2, .retval = 2,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"jlt32: BPF_K", "jlt32: BPF_K",
...@@ -500,6 +503,7 @@ ...@@ -500,6 +503,7 @@
.result_unpriv = REJECT, .result_unpriv = REJECT,
.result = ACCEPT, .result = ACCEPT,
.retval = 2, .retval = 2,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"jsge32: BPF_K", "jsge32: BPF_K",
...@@ -570,6 +574,7 @@ ...@@ -570,6 +574,7 @@
.result_unpriv = REJECT, .result_unpriv = REJECT,
.result = ACCEPT, .result = ACCEPT,
.retval = 2, .retval = 2,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"jsgt32: BPF_K", "jsgt32: BPF_K",
...@@ -640,6 +645,7 @@ ...@@ -640,6 +645,7 @@
.result_unpriv = REJECT, .result_unpriv = REJECT,
.result = ACCEPT, .result = ACCEPT,
.retval = 2, .retval = 2,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"jsle32: BPF_K", "jsle32: BPF_K",
...@@ -710,6 +716,7 @@ ...@@ -710,6 +716,7 @@
.result_unpriv = REJECT, .result_unpriv = REJECT,
.result = ACCEPT, .result = ACCEPT,
.retval = 2, .retval = 2,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"jslt32: BPF_K", "jslt32: BPF_K",
...@@ -780,6 +787,7 @@ ...@@ -780,6 +787,7 @@
.result_unpriv = REJECT, .result_unpriv = REJECT,
.result = ACCEPT, .result = ACCEPT,
.retval = 2, .retval = 2,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"jgt32: range bound deduction, reg op imm", "jgt32: range bound deduction, reg op imm",
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
.fixup_map_kptr = { 1 }, .fixup_map_kptr = { 1 },
.result = REJECT, .result = REJECT,
.errstr = "kptr access cannot have variable offset", .errstr = "kptr access cannot have variable offset",
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"map_kptr: bpf_kptr_xchg non-const var_off", "map_kptr: bpf_kptr_xchg non-const var_off",
...@@ -121,6 +122,7 @@ ...@@ -121,6 +122,7 @@
.fixup_map_kptr = { 1 }, .fixup_map_kptr = { 1 },
.result = REJECT, .result = REJECT,
.errstr = "kptr access misaligned expected=0 off=7", .errstr = "kptr access misaligned expected=0 off=7",
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"map_kptr: reject var_off != 0", "map_kptr: reject var_off != 0",
......
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
}, },
.fixup_map_ringbuf = { 1 }, .fixup_map_ringbuf = { 1 },
.prog_type = BPF_PROG_TYPE_XDP, .prog_type = BPF_PROG_TYPE_XDP,
.flags = BPF_F_TEST_STATE_FREQ, .flags = BPF_F_TEST_STATE_FREQ | F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
.errstr = "invalid access to memory, mem_size=1 off=42 size=8", .errstr = "invalid access to memory, mem_size=1 off=42 size=8",
.result = REJECT, .result = REJECT,
}, },
......
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