diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2017-03-31 02:24:04 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-01 12:36:37 -0700 |
commit | 02ea80b1850e48abbce77878896229d7cc5cb230 (patch) | |
tree | 9098a803f81125ec916cbb36610b45ddd6731f51 /tools/include | |
parent | 79adffcd6489ef43bda2dfded3d637d7fb4fac80 (diff) | |
download | op-kernel-dev-02ea80b1850e48abbce77878896229d7cc5cb230.zip op-kernel-dev-02ea80b1850e48abbce77878896229d7cc5cb230.tar.gz |
bpf: add various verifier test cases for self-tests
Add a couple of test cases, for example, probing for xadd on a spilled
pointer to packet and map_value_adj register, various other map_value_adj
tests including the unaligned load/store, and trying out pointer arithmetic
on map_value_adj register itself. For the unaligned load/store, we need
to figure out whether the architecture has efficient unaligned access and
need to mark affected tests accordingly.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/include')
-rw-r--r-- | tools/include/linux/filter.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/include/linux/filter.h b/tools/include/linux/filter.h index 122153b..390d7c9 100644 --- a/tools/include/linux/filter.h +++ b/tools/include/linux/filter.h @@ -168,6 +168,16 @@ .off = OFF, \ .imm = 0 }) +/* Atomic memory add, *(uint *)(dst_reg + off16) += src_reg */ + +#define BPF_STX_XADD(SIZE, DST, SRC, OFF) \ + ((struct bpf_insn) { \ + .code = BPF_STX | BPF_SIZE(SIZE) | BPF_XADD, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = OFF, \ + .imm = 0 }) + /* Memory store, *(uint *) (dst_reg + off16) = imm32 */ #define BPF_ST_MEM(SIZE, DST, OFF, IMM) \ |