2 "check valid spill/fill",
4 /* spill R1(ctx) into stack */
5 BPF_STX_MEM(BPF_DW
, BPF_REG_10
, BPF_REG_1
, -8),
6 /* fill it back into R2 */
7 BPF_LDX_MEM(BPF_DW
, BPF_REG_2
, BPF_REG_10
, -8),
8 /* should be able to access R0 = *(R2 + 8) */
9 /* BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_2, 8), */
10 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
13 .errstr_unpriv
= "R0 leaks addr",
15 .result_unpriv
= REJECT
,
16 .retval
= POINTER_VALUE
,
19 "check valid spill/fill, skb mark",
21 BPF_ALU64_REG(BPF_MOV
, BPF_REG_6
, BPF_REG_1
),
22 BPF_STX_MEM(BPF_DW
, BPF_REG_10
, BPF_REG_6
, -8),
23 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_10
, -8),
24 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_0
,
25 offsetof(struct __sk_buff
, mark
)),
29 .result_unpriv
= ACCEPT
,
32 "check corrupted spill/fill",
34 /* spill R1(ctx) into stack */
35 BPF_STX_MEM(BPF_DW
, BPF_REG_10
, BPF_REG_1
, -8),
36 /* mess up with R1 pointer on stack */
37 BPF_ST_MEM(BPF_B
, BPF_REG_10
, -7, 0x23),
38 /* fill back into R0 is fine for priv.
39 * R0 now becomes SCALAR_VALUE.
41 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_10
, -8),
42 /* Load from R0 should fail. */
43 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_0
, 8),
46 .errstr_unpriv
= "attempt to corrupt spilled",
47 .errstr
= "R0 invalid mem access 'inv",
49 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
52 "check corrupted spill/fill, LSB",
54 BPF_STX_MEM(BPF_DW
, BPF_REG_10
, BPF_REG_1
, -8),
55 BPF_ST_MEM(BPF_H
, BPF_REG_10
, -8, 0xcafe),
56 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_10
, -8),
59 .errstr_unpriv
= "attempt to corrupt spilled",
60 .result_unpriv
= REJECT
,
62 .retval
= POINTER_VALUE
,
65 "check corrupted spill/fill, MSB",
67 BPF_STX_MEM(BPF_DW
, BPF_REG_10
, BPF_REG_1
, -8),
68 BPF_ST_MEM(BPF_W
, BPF_REG_10
, -4, 0x12345678),
69 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_10
, -8),
72 .errstr_unpriv
= "attempt to corrupt spilled",
73 .result_unpriv
= REJECT
,
75 .retval
= POINTER_VALUE
,