Skip to content

Commit ed211d9

Browse files
committed
libnetwork/rootlessnetns: set mount propagation to slave
We don't want to leak our mounts to the host but we still like to to update mounts/umount events from the host. This is so when a fs is unmounted on the host we don't happen to keep it open in aardvark-dns. Fixes: containers/podman#25994 Fixes: 4225302 ("libnetwork/rootlessnetns: make mountns tree private") Signed-off-by: Paul Holzinger <[email protected]>
1 parent 9aeb335 commit ed211d9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

libnetwork/internal/rootlessnetns/netns_linux.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,14 @@ func (n *Netns) setupMounts() error {
369369

370370
// Ensure we mount private in our mountns to prevent accidentally
371371
// overwriting the host mounts in case the default propagation is shared.
372-
err = unix.Mount("", "/", "", unix.MS_PRIVATE|unix.MS_REC, "")
372+
// However using private propagation is not what we want as new mounts/umounts
373+
// are not propagted into our namespace thus we use salve.
374+
// This is a problem because we now may hold mount points open that were unmounted
375+
// on the host confusing users why the underlying device is still busy as they no
376+
// longer see the mount: https://github.com/containers/podman/issues/25994
377+
err = unix.Mount("", "/", "", unix.MS_SLAVE|unix.MS_REC, "")
373378
if err != nil {
374-
return wrapError("make tree private in new mount namespace", err)
379+
return wrapError("set mount propagation to slave in new mount namespace", err)
375380
}
376381

377382
xdgRuntimeDir, err := homedir.GetRuntimeDir()

0 commit comments

Comments
 (0)