From 96a31541954f67fa12c6b8361fa77d9c7a3b7665 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 28 Oct 2021 14:00:16 +0000 Subject: executor: do not follow symlinks during umount Add a UMOUNT_NOFOLLOW flag to umount2 in order to prevent remove_dir from unmounting what was not mounted by the executed program. --- executor/common_linux.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'executor/common_linux.h') diff --git a/executor/common_linux.h b/executor/common_linux.h index 6875c88a0..7df9476eb 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -4206,7 +4206,7 @@ retry: #if SYZ_EXECUTOR if (!flag_sandbox_android) #endif - while (umount2(dir, MNT_DETACH) == 0) { + while (umount2(dir, MNT_DETACH | UMOUNT_NOFOLLOW) == 0) { debug("umount(%s)\n", dir); } #endif @@ -4232,7 +4232,7 @@ retry: #if SYZ_EXECUTOR if (!flag_sandbox_android) #endif - while (umount2(filename, MNT_DETACH) == 0) { + while (umount2(filename, MNT_DETACH | UMOUNT_NOFOLLOW) == 0) { debug("umount(%s)\n", filename); } #endif @@ -4270,7 +4270,7 @@ retry: if (!flag_sandbox_android) { #endif debug("umount(%s)\n", filename); - if (umount2(filename, MNT_DETACH)) + if (umount2(filename, MNT_DETACH | UMOUNT_NOFOLLOW)) exitf("umount(%s) failed", filename); #if SYZ_EXECUTOR } @@ -4305,7 +4305,7 @@ retry: if (!flag_sandbox_android) { #endif debug("umount(%s)\n", dir); - if (umount2(dir, MNT_DETACH)) + if (umount2(dir, MNT_DETACH | UMOUNT_NOFOLLOW)) exitf("umount(%s) failed", dir); #if SYZ_EXECUTOR } -- cgit mrf-deployment