Loading...
Note: File does not exist in v6.13.7.
1{
2 "bpf_map_ptr: read with negative offset rejected",
3 .insns = {
4 BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
5 BPF_LD_MAP_FD(BPF_REG_1, 0),
6 BPF_LDX_MEM(BPF_DW, BPF_REG_6, BPF_REG_1, -8),
7 BPF_MOV64_IMM(BPF_REG_0, 1),
8 BPF_EXIT_INSN(),
9 },
10 .fixup_map_array_48b = { 1 },
11 .result_unpriv = REJECT,
12 .errstr_unpriv = "bpf_array access is allowed only to CAP_PERFMON and CAP_SYS_ADMIN",
13 .result = REJECT,
14 .errstr = "R1 is bpf_array invalid negative access: off=-8",
15},
16{
17 "bpf_map_ptr: write rejected",
18 .insns = {
19 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
20 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
21 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
22 BPF_LD_MAP_FD(BPF_REG_1, 0),
23 BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_2, 0),
24 BPF_MOV64_IMM(BPF_REG_0, 1),
25 BPF_EXIT_INSN(),
26 },
27 .fixup_map_array_48b = { 3 },
28 .result_unpriv = REJECT,
29 .errstr_unpriv = "bpf_array access is allowed only to CAP_PERFMON and CAP_SYS_ADMIN",
30 .result = REJECT,
31 .errstr = "only read from bpf_array is supported",
32},
33{
34 "bpf_map_ptr: read non-existent field rejected",
35 .insns = {
36 BPF_MOV64_IMM(BPF_REG_6, 0),
37 BPF_LD_MAP_FD(BPF_REG_1, 0),
38 BPF_LDX_MEM(BPF_W, BPF_REG_6, BPF_REG_1, 1),
39 BPF_MOV64_IMM(BPF_REG_0, 1),
40 BPF_EXIT_INSN(),
41 },
42 .fixup_map_array_48b = { 1 },
43 .result_unpriv = REJECT,
44 .errstr_unpriv = "bpf_array access is allowed only to CAP_PERFMON and CAP_SYS_ADMIN",
45 .result = REJECT,
46 .errstr = "cannot access ptr member ops with moff 0 in struct bpf_map with off 1 size 4",
47},
48{
49 "bpf_map_ptr: read ops field accepted",
50 .insns = {
51 BPF_MOV64_IMM(BPF_REG_6, 0),
52 BPF_LD_MAP_FD(BPF_REG_1, 0),
53 BPF_LDX_MEM(BPF_DW, BPF_REG_6, BPF_REG_1, 0),
54 BPF_MOV64_IMM(BPF_REG_0, 1),
55 BPF_EXIT_INSN(),
56 },
57 .fixup_map_array_48b = { 1 },
58 .result_unpriv = REJECT,
59 .errstr_unpriv = "bpf_array access is allowed only to CAP_PERFMON and CAP_SYS_ADMIN",
60 .result = ACCEPT,
61 .retval = 1,
62},