Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\bpf_trace.c Create Date:2022-07-28 12:37:38
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:perf_event_attach_bpf_prog

Proto:int perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog)

Type:int

Parameter:

TypeParameterName
struct perf_event *event
struct bpf_prog *prog
1324  ret = -EEXIST
1330  If Do we override a kprobe? && ( Not trace_kprobe_on_func_entry(tp_event) || Not trace_kprobe_error_injectable(tp_event) ) Then Return -EINVAL
1335  mutex_lock( & bpf_event_mutex)
1337  If prog Then Go to unlock
1340  old_array = bpf_event_rcu_dereference(prog_array)
1341  If old_array && bpf_prog_array_length(old_array) >= BPF_TRACE_MAX_PROGS Then
1343  ret = -E2BIG
1344  Go to unlock
1347  ret = bpf_prog_array_copy(old_array, NULL, prog, & new_array)
1348  If ret < 0 Then Go to 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  Return ret