Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions internal/shim/manager/mount_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"os/exec"
"strings"
"syscall"

"github.com/containerd/log"
)

// cloneMntNs configures the child command to start in a new user + mount
Expand Down Expand Up @@ -55,12 +53,16 @@ import (
// If namespace creation is not possible (e.g. AppArmor restricts
// unprivileged user namespaces), the function logs a warning and the shim
// will run without mount isolation.
Comment thread
akerouanton marked this conversation as resolved.
func cloneMntNs(ctx context.Context, cmd *exec.Cmd) {
func cloneMntNs(_ context.Context, cmd *exec.Cmd) {
if restricted, err := apparmorRestrictsUserns(); err != nil {
log.G(ctx).WithError(err).Warn("failed to check apparmor userns restriction, skipping mount namespace isolation")
// Failed to check apparmor userns restriction, skipping mount namespace isolation")
// We can't log anything here as it will break the TTRPC protocol!
// TODO(vvoland): Find a better way to surface this to the user.
return
Comment thread
akerouanton marked this conversation as resolved.
} else if restricted {
log.G(ctx).Warn("apparmor_restrict_unprivileged_userns=1 prevents user namespace creation; shim will run without mount namespace isolation")
// apparmor_restrict_unprivileged_userns=1 prevents user namespace creation; shim will run without mount namespace isolation
// We can't log anything here as it will break the TTRPC protocol!
// TODO(vvoland): Find a better way to surface this to the user.
return
Comment thread
akerouanton marked this conversation as resolved.
Comment thread
akerouanton marked this conversation as resolved.
}

Expand Down
Loading