diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/fs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/firejail/fs.c b/src/firejail/fs.c index 08b268d93..825f004cc 100644 --- a/src/firejail/fs.c +++ b/src/firejail/fs.c | |||
@@ -555,6 +555,7 @@ void fs_mnt(void) { | |||
555 | 555 | ||
556 | // mount /proc and /sys directories | 556 | // mount /proc and /sys directories |
557 | void fs_proc_sys_dev_boot(void) { | 557 | void fs_proc_sys_dev_boot(void) { |
558 | |||
558 | if (arg_debug) | 559 | if (arg_debug) |
559 | printf("Remounting /proc and /proc/sys filesystems\n"); | 560 | printf("Remounting /proc and /proc/sys filesystems\n"); |
560 | if (mount("proc", "/proc", "proc", MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_REC, NULL) < 0) | 561 | if (mount("proc", "/proc", "proc", MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_REC, NULL) < 0) |
@@ -571,9 +572,9 @@ void fs_proc_sys_dev_boot(void) { | |||
571 | /* Mount a version of /sys that describes the network namespace */ | 572 | /* Mount a version of /sys that describes the network namespace */ |
572 | if (arg_debug) | 573 | if (arg_debug) |
573 | printf("Remounting /sys directory\n"); | 574 | printf("Remounting /sys directory\n"); |
574 | // if this is an overlay, just mount a new /sys on top of the upper layer | 575 | // if this is an overlay, don't try to unmount, just mount a new sysfs |
575 | if (!arg_overlay) { | 576 | if (!arg_overlay) { |
576 | if (umount2("/sys", MNT_DETACH) < 0) | 577 | if (umount2("/sys", MNT_DETACH) < 0 && !cfg.chrootdir) |
577 | fwarning("failed to unmount /sys\n"); | 578 | fwarning("failed to unmount /sys\n"); |
578 | } | 579 | } |
579 | if (mount("sysfs", "/sys", "sysfs", MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REC, NULL) < 0) | 580 | if (mount("sysfs", "/sys", "sysfs", MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REC, NULL) < 0) |