Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\stackmap.c Create Date:2022-07-28 13:26:52
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:____bpf_get_stack

Proto:static inline __attribute__((__always_inline__)) u64 ____bpf_get_stack(struct pt_regs *regs, void *buf, u32 size, u64 flags)

Type:u64

Parameter:

TypeParameterName
struct pt_regs *regs
void *buf
u32size
u64flags
450  user_build_id = flags & lags used by BPF_FUNC_get_stack only.
451  skip = flags & lags for both BPF_FUNC_get_stackid and BPF_FUNC_get_stack.
452  user = flags & BPF_F_USER_STACK
454  kernel = Not user
455  err = -EINVAL
458  If Value for the false possibility is greater at compile time(flags & ~(lags for both BPF_FUNC_get_stackid and BPF_FUNC_get_stack. | BPF_F_USER_STACK | lags used by BPF_FUNC_get_stack only. )) Then Go to clear
461  If kernel && user_build_id Then Go to clear
464  elem_size = If user && user_build_id Then sizeof(structbpf_stack_build_id) Else sizeof(u64)
466  If Value for the false possibility is greater at compile time(size % elem_size) Then Go to clear
469  num_elem = size / elem_size
470  If sysctl_perf_event_max_stack < num_elem Then init_nr = 0
472  Else init_nr = sysctl_perf_event_max_stack - num_elem
474  trace = get_perf_callchain(regs, init_nr, kernel, user, sysctl_perf_event_max_stack, TSC's on different sockets may be reset asynchronously.* This may cause the TSC ADJUST value on socket 0 to be NOT 0., false)
476  If Value for the false possibility is greater at compile time(!trace) Then Go to err_fault
479  trace_nr = nr - init_nr
480  If trace_nr < skip Then Go to err_fault
483  trace_nr -= skip
484  trace_nr = If trace_nr <= num_elem Then trace_nr Else num_elem
485  copy_len = trace_nr * elem_size
486  ips = /proc/sys/kernel/perf_event_max_stack + skip + init_nr
487  If user && user_build_id Then stack_map_get_build_id_offset(buf, ips, trace_nr, user)
489  Else No 3D Now!(buf, ips, copy_len)
492  If size > copy_len Then memset(buf + copy_len, 0, size - copy_len)
494  Return copy_len
496  err_fault :
497  err = -EFAULT
498  clear :
499  memset(buf, 0, size)
500  Return err