@@ -34,13 +34,21 @@ static noinline u32 kprobe_target(u32 value)
34
34
35
35
static int kp_pre_handler (struct kprobe * p , struct pt_regs * regs )
36
36
{
37
+ if (preemptible ()) {
38
+ handler_errors ++ ;
39
+ pr_err ("pre-handler is preemptible\n" );
40
+ }
37
41
preh_val = (rand1 / div_factor );
38
42
return 0 ;
39
43
}
40
44
41
45
static void kp_post_handler (struct kprobe * p , struct pt_regs * regs ,
42
46
unsigned long flags )
43
47
{
48
+ if (preemptible ()) {
49
+ handler_errors ++ ;
50
+ pr_err ("post-handler is preemptible\n" );
51
+ }
44
52
if (preh_val != (rand1 / div_factor )) {
45
53
handler_errors ++ ;
46
54
pr_err ("incorrect value in post_handler\n" );
@@ -156,6 +164,10 @@ static int test_kprobes(void)
156
164
157
165
static u32 j_kprobe_target (u32 value )
158
166
{
167
+ if (preemptible ()) {
168
+ handler_errors ++ ;
169
+ pr_err ("jprobe-handler is preemptible\n" );
170
+ }
159
171
if (value != rand1 ) {
160
172
handler_errors ++ ;
161
173
pr_err ("incorrect value in jprobe handler\n" );
@@ -232,6 +244,10 @@ static u32 krph_val;
232
244
233
245
static int entry_handler (struct kretprobe_instance * ri , struct pt_regs * regs )
234
246
{
247
+ if (preemptible ()) {
248
+ handler_errors ++ ;
249
+ pr_err ("kretprobe entry handler is preemptible\n" );
250
+ }
235
251
krph_val = (rand1 / div_factor );
236
252
return 0 ;
237
253
}
@@ -240,6 +256,10 @@ static int return_handler(struct kretprobe_instance *ri, struct pt_regs *regs)
240
256
{
241
257
unsigned long ret = regs_return_value (regs );
242
258
259
+ if (preemptible ()) {
260
+ handler_errors ++ ;
261
+ pr_err ("kretprobe return handler is preemptible\n" );
262
+ }
243
263
if (ret != (rand1 / div_factor )) {
244
264
handler_errors ++ ;
245
265
pr_err ("incorrect value in kretprobe handler\n" );
0 commit comments