From a5b7566c4a75cf70b3714f8dd2edc772174f28f9 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 23 Jan 2018 12:56:00 +0100 Subject: executor: handle old and new selinux mount points --- executor/common_linux.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'executor/common_linux.h') diff --git a/executor/common_linux.h b/executor/common_linux.h index 9fe76d6bb..c971801fe 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -879,7 +879,8 @@ static int namespace_sandbox_proc(void* arg) fail("mkdir failed"); if (mkdir("./syz-tmp/newroot/dev", 0700)) fail("mkdir failed"); - if (mount("/dev", "./syz-tmp/newroot/dev", NULL, MS_BIND | MS_REC | MS_PRIVATE, NULL)) + unsigned mount_flags = MS_BIND | MS_REC | MS_PRIVATE; + if (mount("/dev", "./syz-tmp/newroot/dev", NULL, mount_flags, NULL)) fail("mount(dev) failed"); if (mkdir("./syz-tmp/newroot/proc", 0700)) fail("mkdir failed"); @@ -887,7 +888,10 @@ static int namespace_sandbox_proc(void* arg) fail("mount(proc) failed"); if (mkdir("./syz-tmp/newroot/selinux", 0700)) fail("mkdir failed"); - if (mount("/selinux", "./syz-tmp/newroot/selinux", NULL, MS_BIND | MS_REC | MS_PRIVATE, NULL)) + // selinux mount used to be at /selinux, but then moved to /sys/fs/selinux. + const char* selinux_path = "./syz-tmp/newroot/selinux"; + if (mount("/selinux", selinux_path, NULL, mount_flags, NULL) && + mount("/sys/fs/selinux", selinux_path, NULL, mount_flags, NULL)) fail("mount(selinuxfs) failed"); if (mkdir("./syz-tmp/pivot", 0777)) fail("mkdir failed"); -- cgit mrf-deployment