attach: allow LSM attach without new mnt namespace

Currently, the -c command (to set the selinux context) seems to be
broken because lxc-attach expects that also a new mount namespace
is specified via command line. This commit remove the check for the new
mount namespace to fix this issue. Please note that the
--elevated-privileges option is not affected by this issue.

Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Maximilian Blenk 2021-08-23 15:39:28 +02:00 committed by Christian Brauner
parent a0738fa00b
commit b445fcb114
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -165,8 +165,7 @@ static inline bool sync_wait_fd(int fd, int *fd_recv)
static bool attach_lsm(lxc_attach_options_t *options)
{
return (options->namespaces & CLONE_NEWNS) &&
(options->attach_flags & (LXC_ATTACH_LSM | LXC_ATTACH_LSM_LABEL));
return (options->attach_flags & (LXC_ATTACH_LSM | LXC_ATTACH_LSM_LABEL));
}
static struct attach_context *alloc_attach_context(void)