summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-11-16 06:51:26 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2018-11-28 07:53:28 -0500
commit3beacb73bced227b211bf3b8710382b94358614b (patch)
tree5cd787b22935645c92c613b79081bb132e361944 /libpod
parent193e6197567e47f9650a33ed09d435a0ec0df803 (diff)
downloadpodman-3beacb73bced227b211bf3b8710382b94358614b.tar.gz
podman-3beacb73bced227b211bf3b8710382b94358614b.tar.bz2
podman-3beacb73bced227b211bf3b8710382b94358614b.zip
Disable mount options when running --privileged
We now default to setting storage options to "nodev", when running privileged containers, we need to turn this off so the processes can manipulate the image. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 051e0aeb7..a426191a4 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -273,6 +273,27 @@ func (c *Container) setupStorage(ctx context.Context) error {
},
LabelOpts: c.config.LabelOpts,
}
+ if c.config.Privileged {
+ privOpt := func(opt string) bool {
+ for _, privopt := range []string{"nodev", "nosuid", "noexec"} {
+ if opt == privopt {
+ return true
+ }
+ }
+ return false
+ }
+ defOptions, err := storage.GetDefaultMountOptions()
+ if err != nil {
+ return errors.Wrapf(err, "error getting default mount options")
+ }
+ var newOptions []string
+ for _, opt := range defOptions {
+ if !privOpt(opt) {
+ newOptions = append(newOptions, opt)
+ }
+ }
+ options.MountOpts = newOptions
+ }
if c.config.Rootfs == "" {
options.IDMappingOptions = c.config.IDMappings