Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name: parent has non-overridable prog attached,* disallow attaching new programs to the descendent cgroup.* if parent has overridable or multi-prog, allow attaching

Proto:static bool hierarchy_allows_attach(struct cgroup *cgrp, enum bpf_attach_type type, u32 new_flags)

Type:bool

Parameter:

TypeParameterName
struct cgroup *cgrp
enum bpf_attach_typetype
u32new_flags
114  p = cgroup_parent(cgrp)
115  If Not p Then Return true
117  Do
118  flags = flags[type]
121  If flags & BPF_F_ALLOW_MULTI Then Return true
123  cnt = number of elements in the list.* it's slow but the list cannot be long
124  WARN_ON_ONCE(cnt > 1)
125  If cnt == 1 Then Return Not Not (flags & cgroup-bpf attach flags used in BPF_PROG_ATTACH command* NONE(default): No further bpf programs allowed in the subtree)
127  p = cgroup_parent(p)
128  When p cycle
129  Return true
Caller
NameDescribe
__cgroup_bpf_attach__cgroup_bpf_attach() - Attach the program to a cgroup, and* propagate the change to descendants*@cgrp: The cgroup which descendants to traverse*@prog: A program to attach*@type: Type of attach operation*@flags: Option flags