Skip to content

Commit 863aab3

Browse files
mannkafaiAlexei Starovoitov
authored andcommitted
bpf: Add log for attaching tracing programs to functions in deny list
Show the rejected function name when attaching tracing programs to functions in deny list. With this change, we know why tracing programs can't attach to functions like __rcu_read_lock() from log. $ ./fentry libbpf: prog '__rcu_read_lock': BPF program load failed: -EINVAL libbpf: prog '__rcu_read_lock': -- BEGIN PROG LOAD LOG -- Attaching tracing programs to function '__rcu_read_lock' is rejected. Suggested-by: Leon Hwang <[email protected]> Signed-off-by: KaFai Wan <[email protected]> Acked-by: Yafang Shao <[email protected]> Acked-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent a5a6b29 commit 863aab3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/bpf/verifier.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23981,6 +23981,8 @@ static int check_attach_btf_id(struct bpf_verifier_env *env)
2398123981
return ret;
2398223982
} else if (prog->type == BPF_PROG_TYPE_TRACING &&
2398323983
btf_id_set_contains(&btf_id_deny, btf_id)) {
23984+
verbose(env, "Attaching tracing programs to function '%s' is rejected.\n",
23985+
tgt_info.tgt_name);
2398423986
return -EINVAL;
2398523987
} else if ((prog->expected_attach_type == BPF_TRACE_FEXIT ||
2398623988
prog->expected_attach_type == BPF_MODIFY_RETURN) &&

0 commit comments

Comments
 (0)