From 811673eeff8cc23f59b64c1522e44d1793a2985a Mon Sep 17 00:00:00 2001 From: smitsohu Date: Fri, 4 May 2018 12:08:25 +0200 Subject: enhance post-mount checks --- src/firejail/pulseaudio.c | 4 ++-- src/firejail/x11.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/firejail/pulseaudio.c b/src/firejail/pulseaudio.c index ad93efe3c..a7a1c3acc 100644 --- a/src/firejail/pulseaudio.c +++ b/src/firejail/pulseaudio.c @@ -176,9 +176,9 @@ void pulseaudio_init(void) { errExit("mount pulseaudio"); fs_logger2("tmpfs", homeusercfg); - // check /proc/self/mounts to confirm the mount is ok + // check /proc/self/mountinfo to confirm the mount is ok MountData *mptr = get_last_mount(); - if (strncmp(mptr->dir,homeusercfg,strlen(homeusercfg)) != 0) { + if (strncmp(mptr->fstype, "tmpfs", 5) != 0 || strncmp(mptr->dir, homeusercfg, strlen(homeusercfg)) != 0) { fprintf(stderr, "Error: invalid mount on top of %s (should be %s)\n", mptr->dir, homeusercfg); exit(1); } diff --git a/src/firejail/x11.c b/src/firejail/x11.c index d8b5961a2..554035c60 100644 --- a/src/firejail/x11.c +++ b/src/firejail/x11.c @@ -1194,9 +1194,9 @@ void x11_xorg(void) { if (set_perms(dest, getuid(), getgid(), 0600)) errExit("set_perms"); - // check /proc/self/mounts to confirm the mount is ok + // check /proc/self/mountinfo to confirm the mount is ok MountData *mptr = get_last_mount(); - if (strncmp(mptr->dir,dest,strlen(dest)) != 0) { + if (strncmp(mptr->fstype, "tmpfs", 5) != 0 || strncmp(mptr->dir, dest, strlen(dest)) != 0) { fprintf(stderr, "Error: invalid mount on top of %s (should be %s)\n", mptr->dir, dest); exit(1); } -- cgit v1.2.3-54-g00ecf