Skip to content

Commit 6f78154

Browse files
bpf: Add log for attaching tracing programs to functions in deny list
JIRA: https://issues.redhat.com/browse/RHEL-78204 commit 863aab3 Author: KaFai Wan <[email protected]> Date: Thu Jul 24 23:14:52 2025 +0800 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]> Signed-off-by: Jerome Marchand <[email protected]>
1 parent ff345ab commit 6f78154

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
@@ -23985,6 +23985,8 @@ static int check_attach_btf_id(struct bpf_verifier_env *env)
2398523985
return ret;
2398623986
} else if (prog->type == BPF_PROG_TYPE_TRACING &&
2398723987
btf_id_set_contains(&btf_id_deny, btf_id)) {
23988+
verbose(env, "Attaching tracing programs to function '%s' is rejected.\n",
23989+
tgt_info.tgt_name);
2398823990
return -EINVAL;
2398923991
} else if ((prog->expected_attach_type == BPF_TRACE_FEXIT ||
2399023992
prog->expected_attach_type == BPF_MODIFY_RETURN) &&

0 commit comments

Comments
 (0)