函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\bpf_trace.c Create Date:2022-07-27 13:47:57
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:perf_event_attach_bpf_prog

函数原型:int perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog)

返回类型:int

参数:

类型参数名称
struct perf_event *event
struct bpf_prog *prog
1324  ret等于负EEXIST
1330  如果 Do we override a kprobe? 且非trace_kprobe_on_func_entry(tp_event)或非trace_kprobe_error_injectable(tp_event)的值则返回:负EINVAL
1335  mutex_lock( & bpf_event_mutex)
1337  如果prog则转到:unlock
1340  old_array等于bpf_event_rcu_dereference(prog_array)
1341  如果old_arraybpf_prog_array_length(old_array)大于等于BPF_TRACE_MAX_PROGS
1343  ret等于负E2BIG
1344  转到:unlock
1347  ret等于bpf_prog_array_copy(old_array, NULL, prog, & new_array)
1348  如果ret小于0则转到:unlock
1352  prog等于prog
1353  cu_assign_pointer() - assign to RCU-protected pointer*@p: pointer to assign to*@v: value to assign (publish)* Assigns the specified value to the specified RCU-protected* pointer, ensuring that any concurrent RCU readers will see* any prior initialization(prog_array, new_array)
1354  bpf_prog_array_free(old_array)
1356  unlock :
1357  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1358  返回:ret