Hou Tao
169410eba2
bpf: Check rcu_read_lock_trace_held() before calling bpf map helpers
...
These three bpf_map_{lookup,update,delete}_elem() helpers are also
available for sleepable bpf program, so add the corresponding lock
assertion for sleepable bpf program, otherwise the following warning
will be reported when a sleepable bpf program manipulates bpf map under
interpreter mode (aka bpf_jit_enable=0):
WARNING: CPU: 3 PID: 4985 at kernel/bpf/helpers.c:40 ......
CPU: 3 PID: 4985 Comm: test_progs Not tainted 6.6.0+ #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) ......
RIP: 0010:bpf_map_lookup_elem+0x54/0x60
......
Call Trace:
<TASK>
? __warn+0xa5/0x240
? bpf_map_lookup_elem+0x54/0x60
? report_bug+0x1ba/0x1f0
? handle_bug+0x40/0x80
? exc_invalid_op+0x18/0x50
? asm_exc_invalid_op+0x1b/0x20
? __pfx_bpf_map_lookup_elem+0x10/0x10
? rcu_lockdep_current_cpu_online+0x65/0xb0
? rcu_is_watching+0x23/0x50
? bpf_map_lookup_elem+0x54/0x60
? __pfx_bpf_map_lookup_elem+0x10/0x10
___bpf_prog_run+0x513/0x3b70
__bpf_prog_run32+0x9d/0xd0
? __bpf_prog_enter_sleepable_recur+0xad/0x120
? __bpf_prog_enter_sleepable_recur+0x3e/0x120
bpf_trampoline_6442580665+0x4d/0x1000
__x64_sys_getpgid+0x5/0x30
? do_syscall_64+0x36/0xb0
entry_SYSCALL_64_after_hwframe+0x6e/0x76
</TASK>
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20231204140425.1480317-2-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2023-12-04 17:50:26 -08:00
..
2023-07-06 12:42:25 -07:00
2023-03-22 15:11:30 -07:00
2023-06-19 14:04:04 +02:00
2023-04-04 16:57:16 -07:00
2023-04-26 16:07:23 -07:00
2023-11-01 22:33:53 -07:00
2023-09-06 11:08:14 +02:00
2023-05-12 12:01:03 -07:00
2023-08-08 17:21:42 -07:00
2023-01-26 23:26:40 -08:00
2021-11-01 14:10:00 -07:00
2023-09-14 15:30:45 -07:00
2023-04-04 16:57:16 -07:00
2023-11-09 19:07:51 -08:00
2023-11-07 15:24:25 -08:00
2023-11-01 11:16:34 -10:00
2023-11-15 07:51:06 -08:00
2023-10-17 15:02:03 +02:00
2023-11-01 22:33:53 -07:00
2023-10-17 15:02:03 +02:00
2023-08-04 16:15:50 -07:00
2021-09-02 14:49:23 +02:00
2022-12-14 12:02:14 -08:00
2023-10-24 14:25:55 +02:00
2023-12-04 17:50:26 -08:00
2023-10-18 14:08:30 +02:00
2023-07-19 10:07:27 -07:00
2022-05-10 11:20:45 -07:00
2023-04-29 10:05:22 -07:00
2023-12-02 11:36:51 -08:00
2023-11-09 19:07:38 -08:00
2023-07-19 10:07:27 -07:00
2023-06-02 16:22:12 -07:00
2023-11-01 22:33:53 -07:00
2023-11-26 18:00:26 -08:00
2021-11-07 11:54:51 -08:00
2023-10-06 17:11:20 -07:00
2021-12-29 20:03:05 -08:00
2023-09-21 21:49:45 +02:00
2022-11-11 12:05:14 -08:00
2023-09-11 19:04:49 -07:00
2023-06-19 14:04:04 +02:00
2023-10-24 14:26:07 +02:00
2023-11-10 11:06:10 -08:00
2023-11-17 10:30:02 -08:00
2023-11-19 11:43:44 -08:00
2023-10-23 15:01:53 -07:00
2023-12-02 11:36:51 -08:00
2023-09-12 13:06:12 -07:00
2023-12-04 15:57:27 +01:00