projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
66e5eb8
)
bpf, tests: Add test for 32-bit context pointer argument passing
author
Johan Almbladh
<johan.almbladh@anyfinetworks.com>
Mon, 9 Aug 2021 09:18:26 +0000
(11:18 +0200)
committer
Daniel Borkmann
<daniel@iogearbox.net>
Tue, 10 Aug 2021 09:33:25 +0000
(11:33 +0200)
On a 32-bit architecture, the context pointer will occupy the low
half of R1, and the other half will be zero.
Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link:
https://lore.kernel.org/bpf/20210809091829.810076-12-johan.almbladh@anyfinetworks.com
lib/test_bpf.c
patch
|
blob
|
history
diff --git
a/lib/test_bpf.c
b/lib/test_bpf.c
index
896d37f
..
fcfaf45
100644
(file)
--- a/
lib/test_bpf.c
+++ b/
lib/test_bpf.c
@@
-2092,6
+2092,22
@@
static struct bpf_test tests[] = {
#undef NUMER
#undef DENOM
},
+#ifdef CONFIG_32BIT
+ {
+ "INT: 32-bit context pointer word order and zero-extension",
+ .u.insns_int = {
+ BPF_ALU32_IMM(BPF_MOV, R0, 0),
+ BPF_JMP32_IMM(BPF_JEQ, R1, 0, 3),
+ BPF_ALU64_IMM(BPF_RSH, R1, 32),
+ BPF_JMP32_IMM(BPF_JNE, R1, 0, 1),
+ BPF_ALU32_IMM(BPF_MOV, R0, 1),
+ BPF_EXIT_INSN(),
+ },
+ INTERNAL,
+ { },
+ { { 0, 1 } }
+ },
+#endif
{
"check: missing ret",
.u.insns = {