aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-03-30 11:13:19 -0400
committerGitHub <noreply@github.com>2022-03-30 11:13:19 -0400
commit0a839a59ec43ae03c522a1b82224605219256ab1 (patch)
treed88cc6fb228c89301a837d1b4501aed34d1cb69b /libpod
parent05f083461047d0b5425e22334e8259038a51492e (diff)
parente7b7fcbd8a8bfc71ce4d038fe50fee59ac26ca45 (diff)
downloadpodman-0a839a59ec43ae03c522a1b82224605219256ab1.tar.gz
podman-0a839a59ec43ae03c522a1b82224605219256ab1.tar.bz2
podman-0a839a59ec43ae03c522a1b82224605219256ab1.zip
Merge pull request #13694 from giuseppe/v4.0-backport-no-inheritable
[4.0] do not set the inheritable capabilities
Diffstat (limited to 'libpod')
-rw-r--r--libpod/oci_conmon_exec_linux.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/libpod/oci_conmon_exec_linux.go b/libpod/oci_conmon_exec_linux.go
index aa970bbde..65123b37e 100644
--- a/libpod/oci_conmon_exec_linux.go
+++ b/libpod/oci_conmon_exec_linux.go
@@ -758,11 +758,14 @@ func prepareProcessExec(c *Container, options *ExecOptions, env []string, sessio
} else {
pspec.Capabilities.Bounding = ctrSpec.Process.Capabilities.Bounding
}
+
+ // Always unset the inheritable capabilities similarly to what the Linux kernel does
+ // They are used only when using capabilities with uid != 0.
+ pspec.Capabilities.Inheritable = []string{}
+
if execUser.Uid == 0 {
pspec.Capabilities.Effective = pspec.Capabilities.Bounding
- pspec.Capabilities.Inheritable = pspec.Capabilities.Bounding
pspec.Capabilities.Permitted = pspec.Capabilities.Bounding
- pspec.Capabilities.Ambient = pspec.Capabilities.Bounding
} else {
if user == c.config.User {
pspec.Capabilities.Effective = ctrSpec.Process.Capabilities.Effective