Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\events\core.c Create Date:2022-07-28 13:40:53
Last Modify:2022-05-20 07:50:19 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:perf_copy_attr

Proto:static int perf_copy_attr(struct perf_event_attr __user *uattr, struct perf_event_attr *attr)

Type:int

Parameter:

TypeParameterName
struct perf_event_attr __user *uattr
struct perf_event_attr *attr
10906  memset(attr, 0, size of attr )
10908  ret = Get a simple variable from user space(size, & Size of the attr structure, for fwd/bwd compat.)
10909  If ret Then Return ret
10913  If Not size Then size = sizeof first published struct
10915  If size < sizeof first published struct || size > PAGE_SIZE Then Go to err_size
10918  ret = py_struct_from_user: copy a struct from userspace*@dst: Destination address, in kernel space
10919  If ret Then
10920  If ret == -E2BIG Then Go to err_size
10922  Return ret
10925  Size of the attr structure, for fwd/bwd compat. = size
10927  If __reserved_1 || __reserved_2 || __reserved_3 Then Return -EINVAL
10930  If sample_type & ~(PERF_SAMPLE_MAX - 1) Then Return -EINVAL
10933  If read_format & ~(PERF_FORMAT_MAX - 1) Then Return -EINVAL
10936  If sample_type & PERF_SAMPLE_BRANCH_STACK Then
10937  mask = um perf_branch_sample_type
10940  If mask & ~(PERF_SAMPLE_BRANCH_MAX - 1) Then Return -EINVAL
10944  If Not (mask & ~PERF_SAMPLE_BRANCH_PLM_ALL) Then Return -EINVAL
10948  If Not (mask & PERF_SAMPLE_BRANCH_PLM_ALL) Then
10967  If ret Then Return ret
10972  If sample_type & PERF_SAMPLE_REGS_USER Then
10973  ret = perf_reg_validate(Defines set of user regs to dump on samples.* See asm/perf_regs.h for details.)
10974  If ret Then Return ret
10978  If sample_type & PERF_SAMPLE_STACK_USER Then
10979  If Not arch_perf_have_user_stack_dump() Then Return -ENOSYS
10987  If Defines size of the user stack to dump on samples. >= USHRT_MAX Then Return -EINVAL
10989  Else if Not IS_ALIGNED(Defines size of the user stack to dump on samples., sizeof(u64)) Then Return -EINVAL
10993  If Not sample_max_stack Then sample_max_stack = sysctl_perf_event_max_stack
10996  If sample_type & PERF_SAMPLE_REGS_INTR Then ret = perf_reg_validate(Defines set of regs to dump for each sample* state captured on:* - precise = 0: PMU interrupt* - precise > 0: sampled instruction* See asm/perf_regs.h for details.)
10998  out :
10999  Return ret
11001  err_size :
11002  Write a simple value into user space( size of attr , & Size of the attr structure, for fwd/bwd compat.)
11003  ret = -E2BIG
11004  Go to out
Caller
NameDescribe
_perf_ioctl