Message ID | 20200729221410.147556-5-vgoyal@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | virtiofsd: Add notion of unprivileged mode | expand |
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c index 76ef891105..a6fa816b6c 100644 --- a/tools/virtiofsd/passthrough_ll.c +++ b/tools/virtiofsd/passthrough_ll.c @@ -3209,7 +3209,10 @@ static void setup_root(struct lo_data *lo, struct lo_inode *root) int fd, res; struct stat stat; - fd = open("/", O_PATH); + if (lo->sandbox == SANDBOX_NONE) + fd = open(lo->source, O_PATH); + else + fd = open("/", O_PATH); if (fd == -1) { fuse_log(FUSE_LOG_ERR, "open(%s, O_PATH): %m\n", lo->source); exit(1);
In sandbox=NONE mode, lo->source points to the directory which is being exported. We have not done any chroot()/pivot_root(). So open lo->source. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> --- tools/virtiofsd/passthrough_ll.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)