mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-12 07:43:25 -05:00
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 <leon.hwang@linux.dev> Signed-off-by: KaFai Wan <kafai.wan@linux.dev> Acked-by: Yafang Shao <laoar.shao@gmail.com> Acked-by: Yonghong Song <yonghong.song@linux.dev> Link: https://lore.kernel.org/r/20250724151454.499040-3-kafai.wan@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Alexei Starovoitov
parent
a5a6b29a70
commit
863aab3d4d
@@ -23981,6 +23981,8 @@ static int check_attach_btf_id(struct bpf_verifier_env *env)
|
||||
return ret;
|
||||
} else if (prog->type == BPF_PROG_TYPE_TRACING &&
|
||||
btf_id_set_contains(&btf_id_deny, btf_id)) {
|
||||
verbose(env, "Attaching tracing programs to function '%s' is rejected.\n",
|
||||
tgt_info.tgt_name);
|
||||
return -EINVAL;
|
||||
} else if ((prog->expected_attach_type == BPF_TRACE_FEXIT ||
|
||||
prog->expected_attach_type == BPF_MODIFY_RETURN) &&
|
||||
|
||||
Reference in New Issue
Block a user