Commit c3de733
bpf: test_run: fix atomic context in timer path causing sleep-in-atomic BUG
The timer mode is initialized to NO_PREEMPT mode by default,
this disable preemption and force execution in atomic context
causing issue on PREEMPT_RT configurations when invoking
spin_lock_bh(), 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
Fix this, by removing NO_PREEMPT/NO_MIGRATE mode check.
Also, the test timer context no longer needs explicit calls to
migrate_disable()/migrate_enable() with rcu_read_lock()/rcu_read_unlock().
Use helpers rcu_read_lock_dont_migrate() and rcu_read_unlock_migrate()
instead.
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=1f1fbecb9413cdbfbef8
Tested-by: [email protected]
Signed-off-by: Sahil Chandna <[email protected]>
Acked-by: Yonghong Song <[email protected]>1 parent 06bf66d commit c3de733
1 file changed
+6
-17
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 | | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 39 | + | |
46 | 40 | | |
47 | 41 | | |
48 | 42 | | |
49 | 43 | | |
50 | 44 | | |
51 | 45 | | |
52 | 46 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 47 | + | |
59 | 48 | | |
60 | 49 | | |
61 | 50 | | |
| |||
374 | 363 | | |
375 | 364 | | |
376 | 365 | | |
377 | | - | |
| 366 | + | |
378 | 367 | | |
379 | 368 | | |
380 | 369 | | |
| |||
404 | 393 | | |
405 | 394 | | |
406 | 395 | | |
407 | | - | |
| 396 | + | |
408 | 397 | | |
409 | 398 | | |
410 | 399 | | |
| |||
1440 | 1429 | | |
1441 | 1430 | | |
1442 | 1431 | | |
1443 | | - | |
| 1432 | + | |
1444 | 1433 | | |
1445 | 1434 | | |
1446 | 1435 | | |
| |||
1508 | 1497 | | |
1509 | 1498 | | |
1510 | 1499 | | |
1511 | | - | |
| 1500 | + | |
1512 | 1501 | | |
1513 | 1502 | | |
1514 | 1503 | | |
| |||
0 commit comments