aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2017-12-15 12:19:36 -0500
committerAlexei Starovoitov <ast@kernel.org>2017-12-15 12:19:37 -0500
commitc1b08ebe5003ae291470cb6e26923628ab19606f (patch)
treed6536ec187e003bb6a7c87cc8acdef20e16bf6c2 /tools
parent2d17d8d79e77ff3f1b35b87522fc72fa562260ff (diff)
parent87ab8194303e73af2898e9e1c8b3b9bcfe91e7a9 (diff)
Merge branch 'bpf-jit-fixes'
Daniel Borkmann says: ==================== Two fixes that deal with buggy usage of bpf_helper_changes_pkt_data() in the sense that they also reload cached skb data when there's no skb context but xdp one, for example. A fix where skb meta data is reloaded out of the wrong register on helper call, rest is test cases and making sure on verifier side that there's always the guarantee that ctx sits in r1. Thanks! ==================== Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/test_verifier.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index 3c64f30cf63c..b03ecfd7185b 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -6117,6 +6117,30 @@ static struct bpf_test tests[] = {
6117 .result = ACCEPT, 6117 .result = ACCEPT,
6118 }, 6118 },
6119 { 6119 {
6120 "ld_abs: tests on r6 and skb data reload helper",
6121 .insns = {
6122 BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
6123 BPF_LD_ABS(BPF_B, 0),
6124 BPF_LD_ABS(BPF_H, 0),
6125 BPF_LD_ABS(BPF_W, 0),
6126 BPF_MOV64_REG(BPF_REG_7, BPF_REG_6),
6127 BPF_MOV64_IMM(BPF_REG_6, 0),
6128 BPF_MOV64_REG(BPF_REG_1, BPF_REG_7),
6129 BPF_MOV64_IMM(BPF_REG_2, 1),
6130 BPF_MOV64_IMM(BPF_REG_3, 2),
6131 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
6132 BPF_FUNC_skb_vlan_push),
6133 BPF_MOV64_REG(BPF_REG_6, BPF_REG_7),
6134 BPF_LD_ABS(BPF_B, 0),
6135 BPF_LD_ABS(BPF_H, 0),
6136 BPF_LD_ABS(BPF_W, 0),
6137 BPF_MOV64_IMM(BPF_REG_0, 42),
6138 BPF_EXIT_INSN(),
6139 },
6140 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
6141 .result = ACCEPT,
6142 },
6143 {
6120 "ld_ind: check calling conv, r1", 6144 "ld_ind: check calling conv, r1",
6121 .insns = { 6145 .insns = {
6122 BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), 6146 BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),