@@ -137,30 +137,30 @@ NOKPROBE_SYMBOL(synthesize_relcall);
137
137
* Returns non-zero if INSN is boostable.
138
138
* RIP relative instructions are adjusted at copying time in 64 bits mode
139
139
*/
140
- int can_boost (struct insn * insn , void * addr )
140
+ bool can_boost (struct insn * insn , void * addr )
141
141
{
142
142
kprobe_opcode_t opcode ;
143
143
insn_byte_t prefix ;
144
144
int i ;
145
145
146
146
if (search_exception_tables ((unsigned long )addr ))
147
- return 0 ; /* Page fault may occur on this address. */
147
+ return false ; /* Page fault may occur on this address. */
148
148
149
149
/* 2nd-byte opcode */
150
150
if (insn -> opcode .nbytes == 2 )
151
151
return test_bit (insn -> opcode .bytes [1 ],
152
152
(unsigned long * )twobyte_is_boostable );
153
153
154
154
if (insn -> opcode .nbytes != 1 )
155
- return 0 ;
155
+ return false ;
156
156
157
157
for_each_insn_prefix (insn , i , prefix ) {
158
158
insn_attr_t attr ;
159
159
160
160
attr = inat_get_opcode_attribute (prefix );
161
161
/* Can't boost Address-size override prefix and CS override prefix */
162
162
if (prefix == 0x2e || inat_is_address_size_prefix (attr ))
163
- return 0 ;
163
+ return false ;
164
164
}
165
165
166
166
opcode = insn -> opcode .bytes [0 ];
@@ -181,12 +181,12 @@ int can_boost(struct insn *insn, void *addr)
181
181
case 0xf6 ... 0xf7 : /* Grp3 */
182
182
case 0xfe : /* Grp4 */
183
183
/* ... are not boostable */
184
- return 0 ;
184
+ return false ;
185
185
case 0xff : /* Grp5 */
186
186
/* Only indirect jmp is boostable */
187
187
return X86_MODRM_REG (insn -> modrm .bytes [0 ]) == 4 ;
188
188
default :
189
- return 1 ;
189
+ return true ;
190
190
}
191
191
}
192
192
@@ -253,20 +253,18 @@ unsigned long recover_probed_instruction(kprobe_opcode_t *buf, unsigned long add
253
253
}
254
254
255
255
/* Check if paddr is at an instruction boundary */
256
- static int can_probe (unsigned long paddr )
256
+ static bool can_probe (unsigned long paddr )
257
257
{
258
258
unsigned long addr , __addr , offset = 0 ;
259
259
struct insn insn ;
260
260
kprobe_opcode_t buf [MAX_INSN_SIZE ];
261
261
262
262
if (!kallsyms_lookup_size_offset (paddr , NULL , & offset ))
263
- return 0 ;
263
+ return false ;
264
264
265
265
/* Decode instructions */
266
266
addr = paddr - offset ;
267
267
while (addr < paddr ) {
268
- int ret ;
269
-
270
268
/*
271
269
* Check if the instruction has been modified by another
272
270
* kprobe, in which case we replace the breakpoint by the
@@ -277,11 +275,10 @@ static int can_probe(unsigned long paddr)
277
275
*/
278
276
__addr = recover_probed_instruction (buf , addr );
279
277
if (!__addr )
280
- return 0 ;
278
+ return false ;
281
279
282
- ret = insn_decode_kernel (& insn , (void * )__addr );
283
- if (ret < 0 )
284
- return 0 ;
280
+ if (insn_decode_kernel (& insn , (void * )__addr ) < 0 )
281
+ return false;
285
282
286
283
#ifdef CONFIG_KGDB
287
284
/*
@@ -290,7 +287,7 @@ static int can_probe(unsigned long paddr)
290
287
*/
291
288
if (insn .opcode .bytes [0 ] == INT3_INSN_OPCODE &&
292
289
kgdb_has_hit_break (addr ))
293
- return 0 ;
290
+ return false ;
294
291
#endif
295
292
addr += insn .length ;
296
293
}
@@ -310,10 +307,10 @@ static int can_probe(unsigned long paddr)
310
307
*/
311
308
__addr = recover_probed_instruction (buf , addr );
312
309
if (!__addr )
313
- return 0 ;
310
+ return false ;
314
311
315
312
if (insn_decode_kernel (& insn , (void * )__addr ) < 0 )
316
- return 0 ;
313
+ return false ;
317
314
318
315
if (insn .opcode .value == 0xBA )
319
316
offset = 12 ;
@@ -324,7 +321,7 @@ static int can_probe(unsigned long paddr)
324
321
325
322
/* This movl/addl is used for decoding CFI. */
326
323
if (is_cfi_trap (addr + offset ))
327
- return 0 ;
324
+ return false ;
328
325
}
329
326
330
327
out :
0 commit comments