Because containers need to - and safely can - mount cgroufs in that
case.
Note that if cgns is enabled but the unshare fails, we fail the container
start, so checking whether they are enabled is enough.
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
#include "log.h"
#include "lsm/lsm.h"
#include "conf.h"
+#include "utils.h"
lxc_log_define(lxc_apparmor, lxc);
static int mount_features_enabled = 0;
#define AA_DEF_PROFILE "lxc-container-default"
+#define AA_DEF_PROFILE_CGNS "lxc-container-default-cgns"
#define AA_MOUNT_RESTR "/sys/kernel/security/apparmor/features/mount/mask"
#define AA_ENABLED_FILE "/sys/module/apparmor/parameters/enabled"
#define AA_UNCHANGED "unchanged"
free(curlabel);
if (!label) {
- if (use_default)
- label = AA_DEF_PROFILE;
+ if (use_default) {
+ if (cgns_supported())
+ label = AA_DEF_PROFILE_CGNS;
+ else
+ label = AA_DEF_PROFILE;
+ }
else
label = "unconfined";
}