Skip to content

Commit c48df5d

Browse files
mannkafaiKernel Patches Daemon
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]>
1 parent 7d65df7 commit c48df5d

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
@@ -23928,6 +23928,8 @@ static int check_attach_btf_id(struct bpf_verifier_env *env)
2392823928
return ret;
2392923929
} else if (prog->type == BPF_PROG_TYPE_TRACING &&
2393023930
btf_id_set_contains(&btf_id_deny, btf_id)) {
23931+
verbose(env, "Attaching tracing programs to function '%s' is rejected.\n",
23932+
tgt_info.tgt_name);
2393123933
return -EINVAL;
2393223934
} else if ((prog->expected_attach_type == BPF_TRACE_FEXIT ||
2393323935
prog->expected_attach_type == BPF_MODIFY_RETURN) &&

0 commit comments

Comments
 (0)