summaryrefslogtreecommitdiff
path: root/tools/include
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2018-06-02 23:06:31 +0200
committerAlexei Starovoitov <ast@kernel.org>2018-06-03 07:42:06 -0700
commit06be0864c77ae6861632a678a6378511a4828d6e (patch)
tree1dcb6db94fcedbfe8c04352b3ad4e379a69b1fd5 /tools/include
parent25c1013e0464340aeb090a11c6d0b154bc52afd7 (diff)
downloadlinux-riscv-06be0864c77ae6861632a678a6378511a4828d6e.tar.gz
linux-riscv-06be0864c77ae6861632a678a6378511a4828d6e.tar.bz2
linux-riscv-06be0864c77ae6861632a678a6378511a4828d6e.zip
bpf: test case for map pointer poison with calls/branches
Add several test cases where the same or different map pointers originate from different paths in the program and execute a map lookup or tail call at a common location. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/include')
-rw-r--r--tools/include/linux/filter.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/include/linux/filter.h b/tools/include/linux/filter.h
index c5e512da8d8a..af55acf73e75 100644
--- a/tools/include/linux/filter.h
+++ b/tools/include/linux/filter.h
@@ -263,6 +263,16 @@
#define BPF_LD_MAP_FD(DST, MAP_FD) \
BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD)
+/* Relative call */
+
+#define BPF_CALL_REL(TGT) \
+ ((struct bpf_insn) { \
+ .code = BPF_JMP | BPF_CALL, \
+ .dst_reg = 0, \
+ .src_reg = BPF_PSEUDO_CALL, \
+ .off = 0, \
+ .imm = TGT })
+
/* Program exit */
#define BPF_EXIT_INSN() \