mirror of
https://github.com/containers/podman.git
synced 2025-05-20 16:47:39 +08:00
libpod: do not chmod bind mounts
with the new mount API is available, the OCI runtime doesn't require that each parent directory for a bind mount must be accessible. Instead it is opened in the initial user namespace and passed down to the container init process. This requires that the kernel supports the new mount API and that the OCI runtime uses it. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -1917,15 +1917,6 @@ func (c *Container) makeBindMounts() error {
|
||||
return fmt.Errorf("assigning mounts to container %s: %w", c.ID(), err)
|
||||
}
|
||||
}
|
||||
|
||||
if !hasCurrentUserMapped(c) {
|
||||
if err := makeAccessible(resolvPath, c.RootUID(), c.RootGID()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := makeAccessible(hostsPath, c.RootUID(), c.RootGID()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if !c.config.UseImageResolvConf {
|
||||
if err := c.createResolvConf(); err != nil {
|
||||
|
@ -183,16 +183,14 @@ func hasCurrentUserMapped(ctr *Container) bool {
|
||||
|
||||
// CreateContainer creates a container.
|
||||
func (r *ConmonOCIRuntime) CreateContainer(ctr *Container, restoreOptions *ContainerCheckpointOptions) (int64, error) {
|
||||
// always make the run dir accessible to the current user so that the PID files can be read without
|
||||
// always make the container directory accessible to the current user so that the PID files can be read without
|
||||
// being in the rootless user namespace.
|
||||
if err := makeAccessible(ctr.state.RunDir, 0, 0); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if !hasCurrentUserMapped(ctr) {
|
||||
for _, i := range []string{ctr.state.RunDir, ctr.runtime.config.Engine.TmpDir, ctr.config.StaticDir, ctr.state.Mountpoint, ctr.runtime.config.Engine.VolumePath} {
|
||||
if err := makeAccessible(i, ctr.RootUID(), ctr.RootGID()); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if err := makeAccessible(ctr.state.Mountpoint, ctr.RootUID(), ctr.RootGID()); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// if we are running a non privileged container, be sure to umount some kernel paths so they are not
|
||||
|
Reference in New Issue
Block a user