return -1;
}
if (type != LXC_AUTO_CGROUP_FULL_RW) {
- if (mount(NULL, dest, "cgroup", MS_BIND | MS_REMOUNT | MS_RDONLY, NULL) < 0) {
+ unsigned long flags = MS_BIND | MS_NOSUID | MS_NOEXEC | MS_NODEV |
+ MS_REMOUNT | MS_RDONLY;
+ if (mount(NULL, dest, "cgroup", flags, NULL) < 0) {
SYSERROR("Error remounting %s readonly", dest);
return -1;
}
/* mount just the container path rw */
char *source = must_make_path(h->mountpoint, h->base_cgroup, container_cgroup, NULL);
- char *rwpath = must_make_path(dest, container_cgroup, NULL);
+ char *rwpath = must_make_path(dest, h->base_cgroup, container_cgroup, NULL);
if (mount(source, rwpath, "cgroup", MS_BIND, NULL) < 0)
WARN("Failed to mount %s read-write: %m", rwpath);
INFO("Made %s read-write", rwpath);