Commit 0524a47
bpf: test_run: Use migrate_enable()/disable() universally
The timer context can safely use migrate_disable()/migrate_enable()
universally instead of conditional preemption or migration disabling.
Previously, the timer was initialized in NO_PREEMPT mode by default,
which disabled preemption and forced execution in atomic context.
This caused issues on PREEMPT_RT configurations when invoking
spin_lock_bh() — a sleeping lock — leading to the following warning:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 6107, name: syz.0.17
preempt_count: 1, expected: 0
RCU nest depth: 1, expected: 1
Preemption disabled at:
[<ffffffff891fce58>] bpf_test_timer_enter+0xf8/0x140 net/bpf/test_run.c:42
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=1f1fbecb9413cdbfbef8
Tested-by: [email protected]
Signed-off-by: Sahil Chandna <[email protected]>1 parent 5ba1e72 commit 0524a47
1 file changed
+6
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 40 | + | |
45 | 41 | | |
46 | 42 | | |
47 | 43 | | |
| |||
50 | 46 | | |
51 | 47 | | |
52 | 48 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 49 | + | |
58 | 50 | | |
59 | 51 | | |
60 | 52 | | |
| |||
374 | 366 | | |
375 | 367 | | |
376 | 368 | | |
377 | | - | |
| 369 | + | |
378 | 370 | | |
379 | 371 | | |
380 | 372 | | |
| |||
404 | 396 | | |
405 | 397 | | |
406 | 398 | | |
407 | | - | |
| 399 | + | |
408 | 400 | | |
409 | 401 | | |
410 | 402 | | |
| |||
1377 | 1369 | | |
1378 | 1370 | | |
1379 | 1371 | | |
1380 | | - | |
| 1372 | + | |
1381 | 1373 | | |
1382 | 1374 | | |
1383 | 1375 | | |
| |||
1445 | 1437 | | |
1446 | 1438 | | |
1447 | 1439 | | |
1448 | | - | |
| 1440 | + | |
1449 | 1441 | | |
1450 | 1442 | | |
1451 | 1443 | | |
| |||
0 commit comments