函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Must be called with cgroup_mutex held to avoid races.

函数原型:int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, union bpf_attr __user *uattr)

返回类型:int

参数:

类型参数名称
struct cgroup *cgrp
const union bpf_attr *attr
union bpf_attr __user *uattr
501  __userprog_ids等于u64_to_user_ptr(prog_ids)
502  type等于attach_type
503  progs等于 attached progs to this cgroup and attach flags * when flags == 0 or BPF_F_ALLOW_OVERRIDE the progs list will * have either zero or one element * when BPF_F_ALLOW_MULTI the list can have up to BPF_CGROUP_MAX_PROGS[type]
504  flags等于flags[type]
506  ret等于0
508  effective等于cu_dereference_protected() - fetch RCU pointer when updates prevented*@p: The pointer to read, prior to dereferencing*@c: The conditions under which the dereference will take place* Return the value of the specified RCU-protected pointer, but omit( array of effective progs in this cgroup [type], lockdep_is_held( & cgroup_mutex is the master lock))
511  如果query_flags按位与lags for BPF_PROG_QUERY cnt等于bpf_prog_array_length(effective)
513  否则cnt等于 number of elements in the list.* it's slow but the list cannot be long
516  如果copy_to_user( & attach_flags, & flags, flags的长度)则返回:负EFAULT
518  如果copy_to_user( & prog_cnt, & cnt, cnt的长度)则返回:负EFAULT
520  如果prog_cnt恒等于0或非prog_ids或非cnt则返回:0
523  如果prog_cnt小于cnt
524  cnt等于prog_cnt
525  ret等于负ENOSPC
528  如果query_flags按位与lags for BPF_PROG_QUERY
529  返回:bpf_prog_array_copy_to_user(effective, prog_ids, cnt)
530  否则
534  i等于0
536  id等于id
537  如果copy_to_user(prog_ids + i, & id, id的长度)则返回:负EFAULT
539  如果i先自加恒等于cnt退出
543  返回:ret
调用者
名称描述
cgroup_bpf_query