diff options
| author | Daniel Borkmann <daniel@iogearbox.net> | 2017-03-30 20:24:04 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-04-01 15:36:37 -0400 |
| commit | 02ea80b1850e48abbce77878896229d7cc5cb230 (patch) | |
| tree | 9098a803f81125ec916cbb36610b45ddd6731f51 /tools/include/linux | |
| parent | 79adffcd6489ef43bda2dfded3d637d7fb4fac80 (diff) | |
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/linux')
| -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 122153b16ea4..390d7c9685fd 100644 --- a/tools/include/linux/filter.h +++ b/tools/include/linux/filter.h | |||
| @@ -168,6 +168,16 @@ | |||
| 168 | .off = OFF, \ | 168 | .off = OFF, \ |
| 169 | .imm = 0 }) | 169 | .imm = 0 }) |
| 170 | 170 | ||
| 171 | /* Atomic memory add, *(uint *)(dst_reg + off16) += src_reg */ | ||
| 172 | |||
| 173 | #define BPF_STX_XADD(SIZE, DST, SRC, OFF) \ | ||
| 174 | ((struct bpf_insn) { \ | ||
| 175 | .code = BPF_STX | BPF_SIZE(SIZE) | BPF_XADD, \ | ||
| 176 | .dst_reg = DST, \ | ||
| 177 | .src_reg = SRC, \ | ||
| 178 | .off = OFF, \ | ||
| 179 | .imm = 0 }) | ||
| 180 | |||
| 171 | /* Memory store, *(uint *) (dst_reg + off16) = imm32 */ | 181 | /* Memory store, *(uint *) (dst_reg + off16) = imm32 */ |
| 172 | 182 | ||
| 173 | #define BPF_ST_MEM(SIZE, DST, OFF, IMM) \ | 183 | #define BPF_ST_MEM(SIZE, DST, OFF, IMM) \ |
