MCPcopy Create free account
hub / github.com/containerd/nerdctl / CanLoadNewProfile

Function CanLoadNewProfile

pkg/apparmorutil/apparmorutil_linux.go:73–75  ·  view source on GitHub ↗

CanLoadNewProfile returns whether the current process can load a new AppArmor profile. CanLoadNewProfile needs root. CanLoadNewProfile checks both /sys/module/apparmor/parameters/enabled and /sys/kernel/security. Related: https://gitlab.com/apparmor/apparmor/-/blob/v3.0.3/libraries/libapparmor/sr

()

Source from the content-addressed store, hash-verified

71//
72// Related: https://gitlab.com/apparmor/apparmor/-/blob/v3.0.3/libraries/libapparmor/src/kernel.c#L311
73func CanLoadNewProfile() bool {
74 return !userns.RunningInUserNS() && os.Geteuid() == 0 && hostSupports()
75}
76
77var (
78 paramEnabled bool

Callers 3

generateSecurityOptsFunction · 0.92
loadAppArmorFunction · 0.92
TestRunApparmorFunction · 0.92

Calls 1

hostSupportsFunction · 0.85

Tested by 1

TestRunApparmorFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…