Skip to content

Commit a0c109d

Browse files
laoarAlexei Starovoitov
authored andcommitted
bpf: Add __rcu_read_{lock,unlock} into btf id deny list
The tracing recursion prevention mechanism must be protected by rcu, that leaves __rcu_read_{lock,unlock} unprotected by this mechanism. If we trace them, the recursion will happen. Let's add them into the btf id deny list. When CONFIG_PREEMPT_RCU is enabled, it can be reproduced with a simple bpf program as such: SEC("fentry/__rcu_read_lock") int fentry_run() { return 0; } Signed-off-by: Yafang Shao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 7deca5e commit a0c109d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/bpf/verifier.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18671,6 +18671,10 @@ BTF_ID(func, rcu_read_unlock_strict)
1867118671
BTF_ID(func, preempt_count_add)
1867218672
BTF_ID(func, preempt_count_sub)
1867318673
#endif
18674+
#ifdef CONFIG_PREEMPT_RCU
18675+
BTF_ID(func, __rcu_read_lock)
18676+
BTF_ID(func, __rcu_read_unlock)
18677+
#endif
1867418678
BTF_SET_END(btf_id_deny)
1867518679

1867618680
static bool can_be_sleepable(struct bpf_prog *prog)

0 commit comments

Comments
 (0)