From 0650bd1a5cd8eeda0b7c28cffbcb38eedb04acea Mon Sep 17 00:00:00 2001 From: Lucas Manning Date: Sat, 18 Feb 2023 13:10:56 -0800 Subject: [PATCH] Enable access, chroot, chown, and sync tests for FUSE. PiperOrigin-RevId: 510699649 --- pkg/sentry/fsimpl/fuse/file.go | 3 --- test/syscalls/BUILD | 8 ++++++++ test/syscalls/linux/chroot.cc | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/sentry/fsimpl/fuse/file.go b/pkg/sentry/fsimpl/fuse/file.go index fd68e7f00..502a24eea 100644 --- a/pkg/sentry/fsimpl/fuse/file.go +++ b/pkg/sentry/fsimpl/fuse/file.go @@ -144,9 +144,6 @@ func (fd *fileDescription) Sync(ctx context.Context) error { inode := fd.inode() inode.attrMu.Lock() defer inode.attrMu.Unlock() - if inode.filemode().IsDir() { - return linuxerr.EPERM - } conn := inode.fs.conn // no need to proceed if FUSE server doesn't implement Open. if conn.noOpen { diff --git a/test/syscalls/BUILD b/test/syscalls/BUILD index d24482467..f25cd2f44 100644 --- a/test/syscalls/BUILD +++ b/test/syscalls/BUILD @@ -22,6 +22,7 @@ syscall_test( ) syscall_test( + add_fusefs = True, add_overlay = True, test = "//test/syscalls/linux:access_test", ) @@ -79,17 +80,20 @@ syscall_test( syscall_test( size = "medium", + add_fusefs = True, add_overlay = True, test = "//test/syscalls/linux:chown_test", use_tmpfs = True, # chown tests require gofer to be running as root. ) syscall_test( + add_fusefs = True, add_overlay = True, test = "//test/syscalls/linux:chroot_test", ) syscall_test( + add_fusefs = True, add_overlay = True, test = "//test/syscalls/linux:pivot_root_test", use_tmpfs = True, @@ -143,6 +147,7 @@ syscall_test( ) syscall_test( + add_fusefs = True, add_overlay = True, test = "//test/syscalls/linux:dup_test", ) @@ -224,6 +229,7 @@ syscall_test( ) syscall_test( + add_fusefs = True, add_overlay = True, test = "//test/syscalls/linux:fsync_test", ) @@ -973,11 +979,13 @@ syscall_test( ) syscall_test( + add_fusefs = True, add_overlay = True, test = "//test/syscalls/linux:sync_test", ) syscall_test( + add_fusefs = True, add_overlay = True, test = "//test/syscalls/linux:sync_file_range_test", ) diff --git a/test/syscalls/linux/chroot.cc b/test/syscalls/linux/chroot.cc index 7e4626f03..c186a3ab6 100644 --- a/test/syscalls/linux/chroot.cc +++ b/test/syscalls/linux/chroot.cc @@ -310,6 +310,8 @@ TEST(ChrootTest, ProcMemSelfFdsNoEscapeProcOpen) { // expose the full file path via /proc/self/maps and instead honor the chroot. TEST(ChrootTest, ProcMemSelfMapsNoEscapeProcOpen) { SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_SYS_CHROOT))); + // TODO(b/264306751): Remove once FUSE implements mmap. + SKIP_IF(getenv("GVISOR_FUSE_TEST")); // Get a FD to /proc before we enter the chroot. const FileDescriptor proc =