mirror of
https://github.com/containers/podman.git
synced 2025-05-20 16:47:39 +08:00
libpod: enforce noexec,nosuid,nodev for /dev/shm
these mount flags are already used for the /dev/shm mount on the host, but they are not set for the bind mount itself. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -510,6 +510,9 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
|
||||
if c.IsReadOnly() && dstPath != "/dev/shm" {
|
||||
newMount.Options = append(newMount.Options, "ro", "nosuid", "noexec", "nodev")
|
||||
}
|
||||
if dstPath == "/dev/shm" && c.state.BindMounts["/dev/shm"] == c.config.ShmDir {
|
||||
newMount.Options = append(newMount.Options, "nosuid", "noexec", "nodev")
|
||||
}
|
||||
if !MountExists(g.Mounts(), dstPath) {
|
||||
g.AddMount(newMount)
|
||||
} else {
|
||||
@ -1570,6 +1573,9 @@ func (c *Container) restore(ctx context.Context, options ContainerCheckpointOpti
|
||||
if c.IsReadOnly() && dstPath != "/dev/shm" {
|
||||
newMount.Options = append(newMount.Options, "ro", "nosuid", "noexec", "nodev")
|
||||
}
|
||||
if dstPath == "/dev/shm" && c.state.BindMounts["/dev/shm"] == c.config.ShmDir {
|
||||
newMount.Options = append(newMount.Options, "nosuid", "noexec", "nodev")
|
||||
}
|
||||
if !MountExists(g.Mounts(), dstPath) {
|
||||
g.AddMount(newMount)
|
||||
}
|
||||
|
Reference in New Issue
Block a user