aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_linux.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-07-10 16:18:45 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-07-10 16:18:45 +0200
commit95e7a88b9746c73e727b94d85a626cf6dd612f16 (patch)
tree4b70e3e852520ceb6d9051457d4fea21221b5002 /executor/common_linux.h
parent01e35718418b9c51f079b62117aa984bb7e3568b (diff)
sys/linux: implement fuse as normal syscalls
Remove syz_fuse* and implement them as normal syscalls. We not have enough expressive power to form mount options.
Diffstat (limited to 'executor/common_linux.h')
-rw-r--r--executor/common_linux.h67
1 files changed, 0 insertions, 67 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index c045cc8f7..0b23d201e 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -91,11 +91,6 @@
#include <string.h>
#include <sys/stat.h>
#endif
-#if defined(SYZ_EXECUTOR) || defined(__NR_syz_fuse_mount) || defined(__NR_syz_fuseblk_mount)
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/sysmacros.h>
-#endif
#if defined(SYZ_EXECUTOR) || defined(__NR_syz_open_pts)
#include <fcntl.h>
#include <sys/ioctl.h>
@@ -686,68 +681,6 @@ static uintptr_t syz_open_pts(uintptr_t a0, uintptr_t a1)
}
#endif
-#if defined(SYZ_EXECUTOR) || defined(__NR_syz_fuse_mount)
-static uintptr_t syz_fuse_mount(uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5)
-{
- // syz_fuse_mount(target filename, mode flags[fuse_mode], uid uid, gid gid, maxread intptr, flags flags[mount_flags]) fd[fuse]
- uint64 target = a0;
- uint64 mode = a1;
- uint64 uid = a2;
- uint64 gid = a3;
- uint64 maxread = a4;
- uint64 flags = a5;
-
- int fd = open("/dev/fuse", O_RDWR);
- if (fd == -1)
- return fd;
- char buf[1024];
- sprintf(buf, "fd=%d,user_id=%ld,group_id=%ld,rootmode=0%o", fd, (long)uid, (long)gid, (unsigned)mode & ~3u);
- if (maxread != 0)
- sprintf(buf + strlen(buf), ",max_read=%ld", (long)maxread);
- if (mode & 1)
- strcat(buf, ",default_permissions");
- if (mode & 2)
- strcat(buf, ",allow_other");
- syscall(SYS_mount, "", target, "fuse", flags, buf);
- // Ignore errors, maybe fuzzer can do something useful with fd alone.
- return fd;
-}
-#endif
-
-#if defined(SYZ_EXECUTOR) || defined(__NR_syz_fuseblk_mount)
-static uintptr_t syz_fuseblk_mount(uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7)
-{
- // syz_fuseblk_mount(target filename, blkdev filename, mode flags[fuse_mode], uid uid, gid gid, maxread intptr, blksize intptr, flags flags[mount_flags]) fd[fuse]
- uint64 target = a0;
- uint64 blkdev = a1;
- uint64 mode = a2;
- uint64 uid = a3;
- uint64 gid = a4;
- uint64 maxread = a5;
- uint64 blksize = a6;
- uint64 flags = a7;
-
- int fd = open("/dev/fuse", O_RDWR);
- if (fd == -1)
- return fd;
- if (syscall(SYS_mknodat, AT_FDCWD, blkdev, S_IFBLK, makedev(7, 199)))
- return fd;
- char buf[256];
- sprintf(buf, "fd=%d,user_id=%ld,group_id=%ld,rootmode=0%o", fd, (long)uid, (long)gid, (unsigned)mode & ~3u);
- if (maxread != 0)
- sprintf(buf + strlen(buf), ",max_read=%ld", (long)maxread);
- if (blksize != 0)
- sprintf(buf + strlen(buf), ",blksize=%ld", (long)blksize);
- if (mode & 1)
- strcat(buf, ",default_permissions");
- if (mode & 2)
- strcat(buf, ",allow_other");
- syscall(SYS_mount, blkdev, target, "fuseblk", flags, buf);
- // Ignore errors, maybe fuzzer can do something useful with fd alone.
- return fd;
-}
-#endif
-
#if defined(SYZ_EXECUTOR) || defined(__NR_syz_init_net_socket)
#if defined(SYZ_EXECUTOR) || defined(SYZ_SANDBOX_NONE) || defined(SYZ_SANDBOX_SETUID) || defined(SYZ_SANDBOX_NAMESPACE)
const int kInitNetNsFd = 253;