From 774eb66fc1eb006b601f3890958f02e7b90575ad Mon Sep 17 00:00:00 2001 From: Sam Huffman <40582525+samh-sifive@users.noreply.github.com> Date: Fri, 8 Mar 2019 13:26:31 -0800 Subject: [PATCH] fusermount: drop privileges for chdir() cd to mountpoint's parent directory using unprivileged rather than privileged access. This is to ensure that unmount works on mountpoints where root may not have privileged access. Fixes: #376 --- util/fusermount.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/fusermount.c b/util/fusermount.c index e6ac792..3f13e42 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -428,7 +428,9 @@ static int unmount_fuse_locked(const char *mnt, int quiet, int lazy) return -1; } + drop_privs(); res = chdir_to_parent(copy, &last); + restore_privs(); if (res == -1) goto out; -- 2.30.2