summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/syscalls/linux/vfs2
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/syscalls/linux/vfs2')
-rw-r--r--pkg/sentry/syscalls/linux/vfs2/BUILD4
-rw-r--r--pkg/sentry/syscalls/linux/vfs2/linux64.go16
-rw-r--r--pkg/sentry/syscalls/linux/vfs2/linux64_override_amd64.go165
-rw-r--r--pkg/sentry/syscalls/linux/vfs2/linux64_override_arm64.go27
-rw-r--r--pkg/sentry/syscalls/linux/vfs2/vfs2.go172
5 files changed, 173 insertions, 211 deletions
diff --git a/pkg/sentry/syscalls/linux/vfs2/BUILD b/pkg/sentry/syscalls/linux/vfs2/BUILD
index ffca627d4..4c7b8f819 100644
--- a/pkg/sentry/syscalls/linux/vfs2/BUILD
+++ b/pkg/sentry/syscalls/linux/vfs2/BUILD
@@ -13,9 +13,6 @@ go_library(
"fscontext.go",
"getdents.go",
"ioctl.go",
- "linux64.go",
- "linux64_override_amd64.go",
- "linux64_override_arm64.go",
"mmap.go",
"path.go",
"pipe.go",
@@ -28,6 +25,7 @@ go_library(
"stat_arm64.go",
"sync.go",
"timerfd.go",
+ "vfs2.go",
"xattr.go",
],
marshal = True,
diff --git a/pkg/sentry/syscalls/linux/vfs2/linux64.go b/pkg/sentry/syscalls/linux/vfs2/linux64.go
deleted file mode 100644
index 19ee36081..000000000
--- a/pkg/sentry/syscalls/linux/vfs2/linux64.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2020 The gVisor Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package vfs2 provides syscall implementations that use VFS2.
-package vfs2
diff --git a/pkg/sentry/syscalls/linux/vfs2/linux64_override_amd64.go b/pkg/sentry/syscalls/linux/vfs2/linux64_override_amd64.go
deleted file mode 100644
index 47c5d18e7..000000000
--- a/pkg/sentry/syscalls/linux/vfs2/linux64_override_amd64.go
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2020 The gVisor Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build amd64
-
-package vfs2
-
-import (
- "gvisor.dev/gvisor/pkg/sentry/kernel"
- "gvisor.dev/gvisor/pkg/sentry/syscalls"
-)
-
-// Override syscall table to add syscalls implementations from this package.
-func Override(table map[uintptr]kernel.Syscall) {
- table[0] = syscalls.Supported("read", Read)
- table[1] = syscalls.Supported("write", Write)
- table[2] = syscalls.Supported("open", Open)
- table[3] = syscalls.Supported("close", Close)
- table[4] = syscalls.Supported("stat", Stat)
- table[5] = syscalls.Supported("fstat", Fstat)
- table[6] = syscalls.Supported("lstat", Lstat)
- table[7] = syscalls.Supported("poll", Poll)
- table[8] = syscalls.Supported("lseek", Lseek)
- table[9] = syscalls.Supported("mmap", Mmap)
- table[16] = syscalls.Supported("ioctl", Ioctl)
- table[17] = syscalls.Supported("pread64", Pread64)
- table[18] = syscalls.Supported("pwrite64", Pwrite64)
- table[19] = syscalls.Supported("readv", Readv)
- table[20] = syscalls.Supported("writev", Writev)
- table[21] = syscalls.Supported("access", Access)
- table[22] = syscalls.Supported("pipe", Pipe)
- table[23] = syscalls.Supported("select", Select)
- table[32] = syscalls.Supported("dup", Dup)
- table[33] = syscalls.Supported("dup2", Dup2)
- delete(table, 40) // sendfile
- table[41] = syscalls.Supported("socket", Socket)
- table[42] = syscalls.Supported("connect", Connect)
- table[43] = syscalls.Supported("accept", Accept)
- table[44] = syscalls.Supported("sendto", SendTo)
- table[45] = syscalls.Supported("recvfrom", RecvFrom)
- table[46] = syscalls.Supported("sendmsg", SendMsg)
- table[47] = syscalls.Supported("recvmsg", RecvMsg)
- table[48] = syscalls.Supported("shutdown", Shutdown)
- table[49] = syscalls.Supported("bind", Bind)
- table[50] = syscalls.Supported("listen", Listen)
- table[51] = syscalls.Supported("getsockname", GetSockName)
- table[52] = syscalls.Supported("getpeername", GetPeerName)
- table[53] = syscalls.Supported("socketpair", SocketPair)
- table[54] = syscalls.Supported("setsockopt", SetSockOpt)
- table[55] = syscalls.Supported("getsockopt", GetSockOpt)
- table[59] = syscalls.Supported("execve", Execve)
- table[72] = syscalls.Supported("fcntl", Fcntl)
- delete(table, 73) // flock
- table[74] = syscalls.Supported("fsync", Fsync)
- table[75] = syscalls.Supported("fdatasync", Fdatasync)
- table[76] = syscalls.Supported("truncate", Truncate)
- table[77] = syscalls.Supported("ftruncate", Ftruncate)
- table[78] = syscalls.Supported("getdents", Getdents)
- table[79] = syscalls.Supported("getcwd", Getcwd)
- table[80] = syscalls.Supported("chdir", Chdir)
- table[81] = syscalls.Supported("fchdir", Fchdir)
- table[82] = syscalls.Supported("rename", Rename)
- table[83] = syscalls.Supported("mkdir", Mkdir)
- table[84] = syscalls.Supported("rmdir", Rmdir)
- table[85] = syscalls.Supported("creat", Creat)
- table[86] = syscalls.Supported("link", Link)
- table[87] = syscalls.Supported("unlink", Unlink)
- table[88] = syscalls.Supported("symlink", Symlink)
- table[89] = syscalls.Supported("readlink", Readlink)
- table[90] = syscalls.Supported("chmod", Chmod)
- table[91] = syscalls.Supported("fchmod", Fchmod)
- table[92] = syscalls.Supported("chown", Chown)
- table[93] = syscalls.Supported("fchown", Fchown)
- table[94] = syscalls.Supported("lchown", Lchown)
- table[132] = syscalls.Supported("utime", Utime)
- table[133] = syscalls.Supported("mknod", Mknod)
- table[137] = syscalls.Supported("statfs", Statfs)
- table[138] = syscalls.Supported("fstatfs", Fstatfs)
- table[161] = syscalls.Supported("chroot", Chroot)
- table[162] = syscalls.Supported("sync", Sync)
- delete(table, 165) // mount
- delete(table, 166) // umount2
- delete(table, 187) // readahead
- table[188] = syscalls.Supported("setxattr", Setxattr)
- table[189] = syscalls.Supported("lsetxattr", Lsetxattr)
- table[190] = syscalls.Supported("fsetxattr", Fsetxattr)
- table[191] = syscalls.Supported("getxattr", Getxattr)
- table[192] = syscalls.Supported("lgetxattr", Lgetxattr)
- table[193] = syscalls.Supported("fgetxattr", Fgetxattr)
- table[194] = syscalls.Supported("listxattr", Listxattr)
- table[195] = syscalls.Supported("llistxattr", Llistxattr)
- table[196] = syscalls.Supported("flistxattr", Flistxattr)
- table[197] = syscalls.Supported("removexattr", Removexattr)
- table[198] = syscalls.Supported("lremovexattr", Lremovexattr)
- table[199] = syscalls.Supported("fremovexattr", Fremovexattr)
- delete(table, 206) // io_setup
- delete(table, 207) // io_destroy
- delete(table, 208) // io_getevents
- delete(table, 209) // io_submit
- delete(table, 210) // io_cancel
- table[213] = syscalls.Supported("epoll_create", EpollCreate)
- table[217] = syscalls.Supported("getdents64", Getdents64)
- delete(table, 221) // fdavise64
- table[232] = syscalls.Supported("epoll_wait", EpollWait)
- table[233] = syscalls.Supported("epoll_ctl", EpollCtl)
- table[235] = syscalls.Supported("utimes", Utimes)
- delete(table, 253) // inotify_init
- delete(table, 254) // inotify_add_watch
- delete(table, 255) // inotify_rm_watch
- table[257] = syscalls.Supported("openat", Openat)
- table[258] = syscalls.Supported("mkdirat", Mkdirat)
- table[259] = syscalls.Supported("mknodat", Mknodat)
- table[260] = syscalls.Supported("fchownat", Fchownat)
- table[261] = syscalls.Supported("futimens", Futimens)
- table[262] = syscalls.Supported("newfstatat", Newfstatat)
- table[263] = syscalls.Supported("unlinkat", Unlinkat)
- table[264] = syscalls.Supported("renameat", Renameat)
- table[265] = syscalls.Supported("linkat", Linkat)
- table[266] = syscalls.Supported("symlinkat", Symlinkat)
- table[267] = syscalls.Supported("readlinkat", Readlinkat)
- table[268] = syscalls.Supported("fchmodat", Fchmodat)
- table[269] = syscalls.Supported("faccessat", Faccessat)
- table[270] = syscalls.Supported("pselect", Pselect)
- table[271] = syscalls.Supported("ppoll", Ppoll)
- delete(table, 275) // splice
- delete(table, 276) // tee
- table[277] = syscalls.Supported("sync_file_range", SyncFileRange)
- table[280] = syscalls.Supported("utimensat", Utimensat)
- table[281] = syscalls.Supported("epoll_pwait", EpollPwait)
- delete(table, 282) // signalfd
- table[283] = syscalls.Supported("timerfd_create", TimerfdCreate)
- table[284] = syscalls.Supported("eventfd", Eventfd)
- delete(table, 285) // fallocate
- table[286] = syscalls.Supported("timerfd_settime", TimerfdSettime)
- table[287] = syscalls.Supported("timerfd_gettime", TimerfdGettime)
- table[288] = syscalls.Supported("accept4", Accept4)
- delete(table, 289) // signalfd4
- table[290] = syscalls.Supported("eventfd2", Eventfd2)
- table[291] = syscalls.Supported("epoll_create1", EpollCreate1)
- table[292] = syscalls.Supported("dup3", Dup3)
- table[293] = syscalls.Supported("pipe2", Pipe2)
- delete(table, 294) // inotify_init1
- table[295] = syscalls.Supported("preadv", Preadv)
- table[296] = syscalls.Supported("pwritev", Pwritev)
- table[299] = syscalls.Supported("recvmmsg", RecvMMsg)
- table[306] = syscalls.Supported("syncfs", Syncfs)
- table[307] = syscalls.Supported("sendmmsg", SendMMsg)
- table[316] = syscalls.Supported("renameat2", Renameat2)
- delete(table, 319) // memfd_create
- table[322] = syscalls.Supported("execveat", Execveat)
- table[327] = syscalls.Supported("preadv2", Preadv2)
- table[328] = syscalls.Supported("pwritev2", Pwritev2)
- table[332] = syscalls.Supported("statx", Statx)
-}
diff --git a/pkg/sentry/syscalls/linux/vfs2/linux64_override_arm64.go b/pkg/sentry/syscalls/linux/vfs2/linux64_override_arm64.go
deleted file mode 100644
index a6b367468..000000000
--- a/pkg/sentry/syscalls/linux/vfs2/linux64_override_arm64.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2020 The gVisor Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build arm64
-
-package vfs2
-
-import (
- "gvisor.dev/gvisor/pkg/sentry/kernel"
- "gvisor.dev/gvisor/pkg/sentry/syscalls"
-)
-
-// Override syscall table to add syscalls implementations from this package.
-func Override(table map[uintptr]kernel.Syscall) {
- table[63] = syscalls.Supported("read", Read)
-}
diff --git a/pkg/sentry/syscalls/linux/vfs2/vfs2.go b/pkg/sentry/syscalls/linux/vfs2/vfs2.go
new file mode 100644
index 000000000..f1b697844
--- /dev/null
+++ b/pkg/sentry/syscalls/linux/vfs2/vfs2.go
@@ -0,0 +1,172 @@
+// Copyright 2020 The gVisor Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package vfs2 provides syscall implementations that use VFS2.
+package vfs2
+
+import (
+ "gvisor.dev/gvisor/pkg/sentry/syscalls"
+ "gvisor.dev/gvisor/pkg/sentry/syscalls/linux"
+)
+
+// Override syscall table to add syscalls implementations from this package.
+func Override() {
+ // Override AMD64.
+ s := linux.AMD64
+ s.Table[0] = syscalls.Supported("read", Read)
+ s.Table[1] = syscalls.Supported("write", Write)
+ s.Table[2] = syscalls.Supported("open", Open)
+ s.Table[3] = syscalls.Supported("close", Close)
+ s.Table[4] = syscalls.Supported("stat", Stat)
+ s.Table[5] = syscalls.Supported("fstat", Fstat)
+ s.Table[6] = syscalls.Supported("lstat", Lstat)
+ s.Table[7] = syscalls.Supported("poll", Poll)
+ s.Table[8] = syscalls.Supported("lseek", Lseek)
+ s.Table[9] = syscalls.Supported("mmap", Mmap)
+ s.Table[16] = syscalls.Supported("ioctl", Ioctl)
+ s.Table[17] = syscalls.Supported("pread64", Pread64)
+ s.Table[18] = syscalls.Supported("pwrite64", Pwrite64)
+ s.Table[19] = syscalls.Supported("readv", Readv)
+ s.Table[20] = syscalls.Supported("writev", Writev)
+ s.Table[21] = syscalls.Supported("access", Access)
+ s.Table[22] = syscalls.Supported("pipe", Pipe)
+ s.Table[23] = syscalls.Supported("select", Select)
+ s.Table[32] = syscalls.Supported("dup", Dup)
+ s.Table[33] = syscalls.Supported("dup2", Dup2)
+ delete(s.Table, 40) // sendfile
+ s.Table[41] = syscalls.Supported("socket", Socket)
+ s.Table[42] = syscalls.Supported("connect", Connect)
+ s.Table[43] = syscalls.Supported("accept", Accept)
+ s.Table[44] = syscalls.Supported("sendto", SendTo)
+ s.Table[45] = syscalls.Supported("recvfrom", RecvFrom)
+ s.Table[46] = syscalls.Supported("sendmsg", SendMsg)
+ s.Table[47] = syscalls.Supported("recvmsg", RecvMsg)
+ s.Table[48] = syscalls.Supported("shutdown", Shutdown)
+ s.Table[49] = syscalls.Supported("bind", Bind)
+ s.Table[50] = syscalls.Supported("listen", Listen)
+ s.Table[51] = syscalls.Supported("getsockname", GetSockName)
+ s.Table[52] = syscalls.Supported("getpeername", GetPeerName)
+ s.Table[53] = syscalls.Supported("socketpair", SocketPair)
+ s.Table[54] = syscalls.Supported("setsockopt", SetSockOpt)
+ s.Table[55] = syscalls.Supported("getsockopt", GetSockOpt)
+ s.Table[59] = syscalls.Supported("execve", Execve)
+ s.Table[72] = syscalls.Supported("fcntl", Fcntl)
+ delete(s.Table, 73) // flock
+ s.Table[74] = syscalls.Supported("fsync", Fsync)
+ s.Table[75] = syscalls.Supported("fdatasync", Fdatasync)
+ s.Table[76] = syscalls.Supported("truncate", Truncate)
+ s.Table[77] = syscalls.Supported("ftruncate", Ftruncate)
+ s.Table[78] = syscalls.Supported("getdents", Getdents)
+ s.Table[79] = syscalls.Supported("getcwd", Getcwd)
+ s.Table[80] = syscalls.Supported("chdir", Chdir)
+ s.Table[81] = syscalls.Supported("fchdir", Fchdir)
+ s.Table[82] = syscalls.Supported("rename", Rename)
+ s.Table[83] = syscalls.Supported("mkdir", Mkdir)
+ s.Table[84] = syscalls.Supported("rmdir", Rmdir)
+ s.Table[85] = syscalls.Supported("creat", Creat)
+ s.Table[86] = syscalls.Supported("link", Link)
+ s.Table[87] = syscalls.Supported("unlink", Unlink)
+ s.Table[88] = syscalls.Supported("symlink", Symlink)
+ s.Table[89] = syscalls.Supported("readlink", Readlink)
+ s.Table[90] = syscalls.Supported("chmod", Chmod)
+ s.Table[91] = syscalls.Supported("fchmod", Fchmod)
+ s.Table[92] = syscalls.Supported("chown", Chown)
+ s.Table[93] = syscalls.Supported("fchown", Fchown)
+ s.Table[94] = syscalls.Supported("lchown", Lchown)
+ s.Table[132] = syscalls.Supported("utime", Utime)
+ s.Table[133] = syscalls.Supported("mknod", Mknod)
+ s.Table[137] = syscalls.Supported("statfs", Statfs)
+ s.Table[138] = syscalls.Supported("fstatfs", Fstatfs)
+ s.Table[161] = syscalls.Supported("chroot", Chroot)
+ s.Table[162] = syscalls.Supported("sync", Sync)
+ delete(s.Table, 165) // mount
+ delete(s.Table, 166) // umount2
+ delete(s.Table, 187) // readahead
+ s.Table[188] = syscalls.Supported("setxattr", Setxattr)
+ s.Table[189] = syscalls.Supported("lsetxattr", Lsetxattr)
+ s.Table[190] = syscalls.Supported("fsetxattr", Fsetxattr)
+ s.Table[191] = syscalls.Supported("getxattr", Getxattr)
+ s.Table[192] = syscalls.Supported("lgetxattr", Lgetxattr)
+ s.Table[193] = syscalls.Supported("fgetxattr", Fgetxattr)
+ s.Table[194] = syscalls.Supported("listxattr", Listxattr)
+ s.Table[195] = syscalls.Supported("llistxattr", Llistxattr)
+ s.Table[196] = syscalls.Supported("flistxattr", Flistxattr)
+ s.Table[197] = syscalls.Supported("removexattr", Removexattr)
+ s.Table[198] = syscalls.Supported("lremovexattr", Lremovexattr)
+ s.Table[199] = syscalls.Supported("fremovexattr", Fremovexattr)
+ delete(s.Table, 206) // io_setup
+ delete(s.Table, 207) // io_destroy
+ delete(s.Table, 208) // io_getevents
+ delete(s.Table, 209) // io_submit
+ delete(s.Table, 210) // io_cancel
+ s.Table[213] = syscalls.Supported("epoll_create", EpollCreate)
+ s.Table[217] = syscalls.Supported("getdents64", Getdents64)
+ delete(s.Table, 221) // fdavise64
+ s.Table[232] = syscalls.Supported("epoll_wait", EpollWait)
+ s.Table[233] = syscalls.Supported("epoll_ctl", EpollCtl)
+ s.Table[235] = syscalls.Supported("utimes", Utimes)
+ delete(s.Table, 253) // inotify_init
+ delete(s.Table, 254) // inotify_add_watch
+ delete(s.Table, 255) // inotify_rm_watch
+ s.Table[257] = syscalls.Supported("openat", Openat)
+ s.Table[258] = syscalls.Supported("mkdirat", Mkdirat)
+ s.Table[259] = syscalls.Supported("mknodat", Mknodat)
+ s.Table[260] = syscalls.Supported("fchownat", Fchownat)
+ s.Table[261] = syscalls.Supported("futimens", Futimens)
+ s.Table[262] = syscalls.Supported("newfstatat", Newfstatat)
+ s.Table[263] = syscalls.Supported("unlinkat", Unlinkat)
+ s.Table[264] = syscalls.Supported("renameat", Renameat)
+ s.Table[265] = syscalls.Supported("linkat", Linkat)
+ s.Table[266] = syscalls.Supported("symlinkat", Symlinkat)
+ s.Table[267] = syscalls.Supported("readlinkat", Readlinkat)
+ s.Table[268] = syscalls.Supported("fchmodat", Fchmodat)
+ s.Table[269] = syscalls.Supported("faccessat", Faccessat)
+ s.Table[270] = syscalls.Supported("pselect", Pselect)
+ s.Table[271] = syscalls.Supported("ppoll", Ppoll)
+ delete(s.Table, 275) // splice
+ delete(s.Table, 276) // tee
+ s.Table[277] = syscalls.Supported("sync_file_range", SyncFileRange)
+ s.Table[280] = syscalls.Supported("utimensat", Utimensat)
+ s.Table[281] = syscalls.Supported("epoll_pwait", EpollPwait)
+ delete(s.Table, 282) // signalfd
+ s.Table[283] = syscalls.Supported("timerfd_create", TimerfdCreate)
+ s.Table[284] = syscalls.Supported("eventfd", Eventfd)
+ delete(s.Table, 285) // fallocate
+ s.Table[286] = syscalls.Supported("timerfd_settime", TimerfdSettime)
+ s.Table[287] = syscalls.Supported("timerfd_gettime", TimerfdGettime)
+ s.Table[288] = syscalls.Supported("accept4", Accept4)
+ delete(s.Table, 289) // signalfd4
+ s.Table[290] = syscalls.Supported("eventfd2", Eventfd2)
+ s.Table[291] = syscalls.Supported("epoll_create1", EpollCreate1)
+ s.Table[292] = syscalls.Supported("dup3", Dup3)
+ s.Table[293] = syscalls.Supported("pipe2", Pipe2)
+ delete(s.Table, 294) // inotify_init1
+ s.Table[295] = syscalls.Supported("preadv", Preadv)
+ s.Table[296] = syscalls.Supported("pwritev", Pwritev)
+ s.Table[299] = syscalls.Supported("recvmmsg", RecvMMsg)
+ s.Table[306] = syscalls.Supported("syncfs", Syncfs)
+ s.Table[307] = syscalls.Supported("sendmmsg", SendMMsg)
+ s.Table[316] = syscalls.Supported("renameat2", Renameat2)
+ delete(s.Table, 319) // memfd_create
+ s.Table[322] = syscalls.Supported("execveat", Execveat)
+ s.Table[327] = syscalls.Supported("preadv2", Preadv2)
+ s.Table[328] = syscalls.Supported("pwritev2", Pwritev2)
+ s.Table[332] = syscalls.Supported("statx", Statx)
+ s.Init()
+
+ // Override ARM64.
+ s = linux.ARM64
+ s.Table[63] = syscalls.Supported("read", Read)
+ s.Init()
+}