5 BPF_LDX_MEM(BPF_DW
, BPF_REG_7
, BPF_REG_2
, 0),
7 /* reg, bit 63 or bit 0 set, taken */
8 BPF_LD_IMM64(BPF_REG_8
, 0x8000000000000001),
9 BPF_JMP_REG(BPF_JSET
, BPF_REG_7
, BPF_REG_8
, 1),
12 /* reg, bit 62, not taken */
13 BPF_LD_IMM64(BPF_REG_8
, 0x4000000000000000),
14 BPF_JMP_REG(BPF_JSET
, BPF_REG_7
, BPF_REG_8
, 1),
15 BPF_JMP_IMM(BPF_JA
, 0, 0, 1),
18 /* imm, any bit set, taken */
19 BPF_JMP_IMM(BPF_JSET
, BPF_REG_7
, -1, 1),
22 /* imm, bit 31 set, taken */
23 BPF_JMP_IMM(BPF_JSET
, BPF_REG_7
, 0x80000000, 1),
26 /* all good - return r0 == 2 */
27 BPF_MOV64_IMM(BPF_REG_0
, 2),
30 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
35 .data64
= { (1ULL << 63) | (1U << 31) | (1U << 0), }
38 .data64
= { (1ULL << 63) | (1U << 31), }
41 .data64
= { (1ULL << 31) | (1U << 0), }
44 .data64
= { (__u32
)-1, }
47 .data64
= { ~0x4000000000000000ULL
, }
56 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
62 BPF_LDX_MEM(BPF_DW
, BPF_REG_7
, BPF_REG_2
, 0),
64 BPF_JMP_IMM(BPF_JSET
, BPF_REG_7
, 0x80000000, 1),
67 BPF_MOV64_IMM(BPF_REG_0
, 2),
70 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
73 .data
= { 1, 0, 0, 0, 0, 0, 0, 1, },
74 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
77 "jset: known const compare",
79 BPF_MOV64_IMM(BPF_REG_0
, 1),
80 BPF_JMP_IMM(BPF_JSET
, BPF_REG_0
, 1, 1),
81 BPF_LDX_MEM(BPF_B
, BPF_REG_8
, BPF_REG_9
, 0),
84 .prog_type
= BPF_PROG_TYPE_SOCKET_FILTER
,
86 .result_unpriv
= ACCEPT
,
91 "jset: known const compare bad",
93 BPF_MOV64_IMM(BPF_REG_0
, 0),
94 BPF_JMP_IMM(BPF_JSET
, BPF_REG_0
, 1, 1),
95 BPF_LDX_MEM(BPF_B
, BPF_REG_8
, BPF_REG_9
, 0),
98 .prog_type
= BPF_PROG_TYPE_SOCKET_FILTER
,
99 .errstr_unpriv
= "!read_ok",
100 .result_unpriv
= REJECT
,
101 .errstr
= "!read_ok",
105 "jset: unknown const compare taken",
107 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
108 BPF_JMP_IMM(BPF_JSET
, BPF_REG_0
, 1, 1),
109 BPF_JMP_IMM(BPF_JA
, 0, 0, 1),
110 BPF_LDX_MEM(BPF_B
, BPF_REG_8
, BPF_REG_9
, 0),
113 .prog_type
= BPF_PROG_TYPE_SOCKET_FILTER
,
114 .errstr_unpriv
= "!read_ok",
115 .result_unpriv
= REJECT
,
116 .errstr
= "!read_ok",
120 "jset: unknown const compare not taken",
122 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
123 BPF_JMP_IMM(BPF_JSET
, BPF_REG_0
, 1, 1),
124 BPF_LDX_MEM(BPF_B
, BPF_REG_8
, BPF_REG_9
, 0),
127 .prog_type
= BPF_PROG_TYPE_SOCKET_FILTER
,
128 .errstr_unpriv
= "!read_ok",
129 .result_unpriv
= REJECT
,
130 .errstr
= "!read_ok",
134 "jset: half-known const compare",
136 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
137 BPF_ALU64_IMM(BPF_OR
, BPF_REG_0
, 2),
138 BPF_JMP_IMM(BPF_JSET
, BPF_REG_0
, 3, 1),
139 BPF_LDX_MEM(BPF_B
, BPF_REG_8
, BPF_REG_9
, 0),
140 BPF_MOV64_IMM(BPF_REG_0
, 0),
143 .prog_type
= BPF_PROG_TYPE_SOCKET_FILTER
,
144 .result_unpriv
= ACCEPT
,
150 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
151 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
152 BPF_MOV64_IMM(BPF_REG_0
, 0),
153 BPF_ALU64_IMM(BPF_AND
, BPF_REG_1
, 0xff),
154 BPF_JMP_IMM(BPF_JSET
, BPF_REG_1
, 0xf0, 3),
155 BPF_JMP_IMM(BPF_JLT
, BPF_REG_1
, 0x10, 1),
156 BPF_LDX_MEM(BPF_B
, BPF_REG_8
, BPF_REG_9
, 0),
158 BPF_JMP_IMM(BPF_JSET
, BPF_REG_1
, 0x10, 1),
160 BPF_JMP_IMM(BPF_JGE
, BPF_REG_1
, 0x10, 1),
161 BPF_LDX_MEM(BPF_B
, BPF_REG_8
, BPF_REG_9
, 0),
164 .prog_type
= BPF_PROG_TYPE_SOCKET_FILTER
,
165 .result_unpriv
= ACCEPT
,