github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/pkg/sentry/syscalls/linux/linux64.go (about) 1 // Copyright 2019 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package linux provides syscall tables for amd64 Linux. 16 package linux 17 18 import ( 19 "github.com/SagerNet/gvisor/pkg/abi" 20 "github.com/SagerNet/gvisor/pkg/abi/linux" 21 "github.com/SagerNet/gvisor/pkg/errors/linuxerr" 22 "github.com/SagerNet/gvisor/pkg/hostarch" 23 "github.com/SagerNet/gvisor/pkg/sentry/arch" 24 "github.com/SagerNet/gvisor/pkg/sentry/kernel" 25 "github.com/SagerNet/gvisor/pkg/sentry/syscalls" 26 "github.com/SagerNet/gvisor/pkg/syserror" 27 ) 28 29 const ( 30 // LinuxSysname is the OS name advertised by gVisor. 31 LinuxSysname = "Linux" 32 33 // LinuxRelease is the Linux release version number advertised by gVisor. 34 LinuxRelease = "4.4.0" 35 36 // LinuxVersion is the version info advertised by gVisor. 37 LinuxVersion = "#1 SMP Sun Jan 10 15:06:54 PST 2016" 38 ) 39 40 // AMD64 is a table of Linux amd64 syscall API with the corresponding syscall 41 // numbers from Linux 4.4. 42 var AMD64 = &kernel.SyscallTable{ 43 OS: abi.Linux, 44 Arch: arch.AMD64, 45 Version: kernel.Version{ 46 // Version 4.4 is chosen as a stable, longterm version of Linux, which 47 // guides the interface provided by this syscall table. The build 48 // version is that for a clean build with default kernel config, at 5 49 // minutes after v4.4 was tagged. 50 Sysname: LinuxSysname, 51 Release: LinuxRelease, 52 Version: LinuxVersion, 53 }, 54 AuditNumber: linux.AUDIT_ARCH_X86_64, 55 Table: map[uintptr]kernel.Syscall{ 56 0: syscalls.Supported("read", Read), 57 1: syscalls.Supported("write", Write), 58 2: syscalls.PartiallySupported("open", Open, "Options O_DIRECT, O_NOATIME, O_PATH, O_TMPFILE, O_SYNC are not supported.", nil), 59 3: syscalls.Supported("close", Close), 60 4: syscalls.Supported("stat", Stat), 61 5: syscalls.Supported("fstat", Fstat), 62 6: syscalls.Supported("lstat", Lstat), 63 7: syscalls.Supported("poll", Poll), 64 8: syscalls.Supported("lseek", Lseek), 65 9: syscalls.PartiallySupported("mmap", Mmap, "Generally supported with exceptions. Options MAP_FIXED_NOREPLACE, MAP_SHARED_VALIDATE, MAP_SYNC MAP_GROWSDOWN, MAP_HUGETLB are not supported.", nil), 66 10: syscalls.Supported("mprotect", Mprotect), 67 11: syscalls.Supported("munmap", Munmap), 68 12: syscalls.Supported("brk", Brk), 69 13: syscalls.Supported("rt_sigaction", RtSigaction), 70 14: syscalls.Supported("rt_sigprocmask", RtSigprocmask), 71 15: syscalls.Supported("rt_sigreturn", RtSigreturn), 72 16: syscalls.PartiallySupported("ioctl", Ioctl, "Only a few ioctls are implemented for backing devices and file systems.", nil), 73 17: syscalls.Supported("pread64", Pread64), 74 18: syscalls.Supported("pwrite64", Pwrite64), 75 19: syscalls.Supported("readv", Readv), 76 20: syscalls.Supported("writev", Writev), 77 21: syscalls.Supported("access", Access), 78 22: syscalls.Supported("pipe", Pipe), 79 23: syscalls.Supported("select", Select), 80 24: syscalls.Supported("sched_yield", SchedYield), 81 25: syscalls.Supported("mremap", Mremap), 82 26: syscalls.PartiallySupported("msync", Msync, "Full data flush is not guaranteed at this time.", nil), 83 27: syscalls.PartiallySupported("mincore", Mincore, "Stub implementation. The sandbox does not have access to this information. Reports all mapped pages are resident.", nil), 84 28: syscalls.PartiallySupported("madvise", Madvise, "Options MADV_DONTNEED, MADV_DONTFORK are supported. Other advice is ignored.", nil), 85 29: syscalls.PartiallySupported("shmget", Shmget, "Option SHM_HUGETLB is not supported.", nil), 86 30: syscalls.PartiallySupported("shmat", Shmat, "Option SHM_RND is not supported.", nil), 87 31: syscalls.PartiallySupported("shmctl", Shmctl, "Options SHM_LOCK, SHM_UNLOCK are not supported.", nil), 88 32: syscalls.Supported("dup", Dup), 89 33: syscalls.Supported("dup2", Dup2), 90 34: syscalls.Supported("pause", Pause), 91 35: syscalls.Supported("nanosleep", Nanosleep), 92 36: syscalls.Supported("getitimer", Getitimer), 93 37: syscalls.Supported("alarm", Alarm), 94 38: syscalls.Supported("setitimer", Setitimer), 95 39: syscalls.Supported("getpid", Getpid), 96 40: syscalls.Supported("sendfile", Sendfile), 97 41: syscalls.PartiallySupported("socket", Socket, "Limited support for AF_NETLINK, NETLINK_ROUTE sockets. Limited support for SOCK_RAW.", nil), 98 42: syscalls.Supported("connect", Connect), 99 43: syscalls.Supported("accept", Accept), 100 44: syscalls.Supported("sendto", SendTo), 101 45: syscalls.Supported("recvfrom", RecvFrom), 102 46: syscalls.Supported("sendmsg", SendMsg), 103 47: syscalls.PartiallySupported("recvmsg", RecvMsg, "Not all flags and control messages are supported.", nil), 104 48: syscalls.PartiallySupported("shutdown", Shutdown, "Not all flags and control messages are supported.", nil), 105 49: syscalls.PartiallySupported("bind", Bind, "Autobind for abstract Unix sockets is not supported.", nil), 106 50: syscalls.Supported("listen", Listen), 107 51: syscalls.Supported("getsockname", GetSockName), 108 52: syscalls.Supported("getpeername", GetPeerName), 109 53: syscalls.Supported("socketpair", SocketPair), 110 54: syscalls.PartiallySupported("setsockopt", SetSockOpt, "Not all socket options are supported.", nil), 111 55: syscalls.PartiallySupported("getsockopt", GetSockOpt, "Not all socket options are supported.", nil), 112 56: syscalls.PartiallySupported("clone", Clone, "Mount namespace (CLONE_NEWNS) not supported. Options CLONE_PARENT, CLONE_SYSVSEM not supported.", nil), 113 57: syscalls.Supported("fork", Fork), 114 58: syscalls.Supported("vfork", Vfork), 115 59: syscalls.Supported("execve", Execve), 116 60: syscalls.Supported("exit", Exit), 117 61: syscalls.Supported("wait4", Wait4), 118 62: syscalls.Supported("kill", Kill), 119 63: syscalls.Supported("uname", Uname), 120 64: syscalls.Supported("semget", Semget), 121 65: syscalls.PartiallySupported("semop", Semop, "Option SEM_UNDO not supported.", nil), 122 66: syscalls.Supported("semctl", Semctl), 123 67: syscalls.Supported("shmdt", Shmdt), 124 68: syscalls.ErrorWithEvent("msgget", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/135"}), // TODO(b/29354921) 125 69: syscalls.ErrorWithEvent("msgsnd", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/135"}), // TODO(b/29354921) 126 70: syscalls.ErrorWithEvent("msgrcv", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/135"}), // TODO(b/29354921) 127 71: syscalls.ErrorWithEvent("msgctl", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/135"}), // TODO(b/29354921) 128 72: syscalls.PartiallySupported("fcntl", Fcntl, "Not all options are supported.", nil), 129 73: syscalls.PartiallySupported("flock", Flock, "Locks are held within the sandbox only.", nil), 130 74: syscalls.PartiallySupported("fsync", Fsync, "Full data flush is not guaranteed at this time.", nil), 131 75: syscalls.PartiallySupported("fdatasync", Fdatasync, "Full data flush is not guaranteed at this time.", nil), 132 76: syscalls.Supported("truncate", Truncate), 133 77: syscalls.Supported("ftruncate", Ftruncate), 134 78: syscalls.Supported("getdents", Getdents), 135 79: syscalls.Supported("getcwd", Getcwd), 136 80: syscalls.Supported("chdir", Chdir), 137 81: syscalls.Supported("fchdir", Fchdir), 138 82: syscalls.Supported("rename", Rename), 139 83: syscalls.Supported("mkdir", Mkdir), 140 84: syscalls.Supported("rmdir", Rmdir), 141 85: syscalls.Supported("creat", Creat), 142 86: syscalls.PartiallySupported("link", Link, "Limited support with Gofer. Link count and linked files may get out of sync because gVisor is not aware of external hardlinks.", nil), 143 87: syscalls.Supported("unlink", Unlink), 144 88: syscalls.Supported("symlink", Symlink), 145 89: syscalls.Supported("readlink", Readlink), 146 90: syscalls.Supported("chmod", Chmod), 147 91: syscalls.PartiallySupported("fchmod", Fchmod, "Options S_ISUID and S_ISGID not supported.", nil), 148 92: syscalls.Supported("chown", Chown), 149 93: syscalls.Supported("fchown", Fchown), 150 94: syscalls.Supported("lchown", Lchown), 151 95: syscalls.Supported("umask", Umask), 152 96: syscalls.Supported("gettimeofday", Gettimeofday), 153 97: syscalls.Supported("getrlimit", Getrlimit), 154 98: syscalls.PartiallySupported("getrusage", Getrusage, "Fields ru_maxrss, ru_minflt, ru_majflt, ru_inblock, ru_oublock are not supported. Fields ru_utime and ru_stime have low precision.", nil), 155 99: syscalls.PartiallySupported("sysinfo", Sysinfo, "Fields loads, sharedram, bufferram, totalswap, freeswap, totalhigh, freehigh not supported.", nil), 156 100: syscalls.Supported("times", Times), 157 101: syscalls.PartiallySupported("ptrace", Ptrace, "Options PTRACE_PEEKSIGINFO, PTRACE_SECCOMP_GET_FILTER not supported.", nil), 158 102: syscalls.Supported("getuid", Getuid), 159 103: syscalls.PartiallySupported("syslog", Syslog, "Outputs a dummy message for security reasons.", nil), 160 104: syscalls.Supported("getgid", Getgid), 161 105: syscalls.Supported("setuid", Setuid), 162 106: syscalls.Supported("setgid", Setgid), 163 107: syscalls.Supported("geteuid", Geteuid), 164 108: syscalls.Supported("getegid", Getegid), 165 109: syscalls.Supported("setpgid", Setpgid), 166 110: syscalls.Supported("getppid", Getppid), 167 111: syscalls.Supported("getpgrp", Getpgrp), 168 112: syscalls.Supported("setsid", Setsid), 169 113: syscalls.Supported("setreuid", Setreuid), 170 114: syscalls.Supported("setregid", Setregid), 171 115: syscalls.Supported("getgroups", Getgroups), 172 116: syscalls.Supported("setgroups", Setgroups), 173 117: syscalls.Supported("setresuid", Setresuid), 174 118: syscalls.Supported("getresuid", Getresuid), 175 119: syscalls.Supported("setresgid", Setresgid), 176 120: syscalls.Supported("getresgid", Getresgid), 177 121: syscalls.Supported("getpgid", Getpgid), 178 122: syscalls.ErrorWithEvent("setfsuid", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/260"}), // TODO(b/112851702) 179 123: syscalls.ErrorWithEvent("setfsgid", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/260"}), // TODO(b/112851702) 180 124: syscalls.Supported("getsid", Getsid), 181 125: syscalls.Supported("capget", Capget), 182 126: syscalls.Supported("capset", Capset), 183 127: syscalls.Supported("rt_sigpending", RtSigpending), 184 128: syscalls.Supported("rt_sigtimedwait", RtSigtimedwait), 185 129: syscalls.Supported("rt_sigqueueinfo", RtSigqueueinfo), 186 130: syscalls.Supported("rt_sigsuspend", RtSigsuspend), 187 131: syscalls.Supported("sigaltstack", Sigaltstack), 188 132: syscalls.Supported("utime", Utime), 189 133: syscalls.PartiallySupported("mknod", Mknod, "Device creation is not generally supported. Only regular file and FIFO creation are supported.", nil), 190 134: syscalls.Error("uselib", syserror.ENOSYS, "Obsolete", nil), 191 135: syscalls.ErrorWithEvent("personality", linuxerr.EINVAL, "Unable to change personality.", nil), 192 136: syscalls.ErrorWithEvent("ustat", syserror.ENOSYS, "Needs filesystem support.", nil), 193 137: syscalls.PartiallySupported("statfs", Statfs, "Depends on the backing file system implementation.", nil), 194 138: syscalls.PartiallySupported("fstatfs", Fstatfs, "Depends on the backing file system implementation.", nil), 195 139: syscalls.ErrorWithEvent("sysfs", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/165"}), 196 140: syscalls.PartiallySupported("getpriority", Getpriority, "Stub implementation.", nil), 197 141: syscalls.PartiallySupported("setpriority", Setpriority, "Stub implementation.", nil), 198 142: syscalls.CapError("sched_setparam", linux.CAP_SYS_NICE, "", nil), 199 143: syscalls.PartiallySupported("sched_getparam", SchedGetparam, "Stub implementation.", nil), 200 144: syscalls.PartiallySupported("sched_setscheduler", SchedSetscheduler, "Stub implementation.", nil), 201 145: syscalls.PartiallySupported("sched_getscheduler", SchedGetscheduler, "Stub implementation.", nil), 202 146: syscalls.PartiallySupported("sched_get_priority_max", SchedGetPriorityMax, "Stub implementation.", nil), 203 147: syscalls.PartiallySupported("sched_get_priority_min", SchedGetPriorityMin, "Stub implementation.", nil), 204 148: syscalls.ErrorWithEvent("sched_rr_get_interval", linuxerr.EPERM, "", nil), 205 149: syscalls.PartiallySupported("mlock", Mlock, "Stub implementation. The sandbox lacks appropriate permissions.", nil), 206 150: syscalls.PartiallySupported("munlock", Munlock, "Stub implementation. The sandbox lacks appropriate permissions.", nil), 207 151: syscalls.PartiallySupported("mlockall", Mlockall, "Stub implementation. The sandbox lacks appropriate permissions.", nil), 208 152: syscalls.PartiallySupported("munlockall", Munlockall, "Stub implementation. The sandbox lacks appropriate permissions.", nil), 209 153: syscalls.CapError("vhangup", linux.CAP_SYS_TTY_CONFIG, "", nil), 210 154: syscalls.Error("modify_ldt", linuxerr.EPERM, "", nil), 211 155: syscalls.Error("pivot_root", linuxerr.EPERM, "", nil), 212 156: syscalls.Error("sysctl", linuxerr.EPERM, "Deprecated. Use /proc/sys instead.", nil), 213 157: syscalls.PartiallySupported("prctl", Prctl, "Not all options are supported.", nil), 214 158: syscalls.PartiallySupported("arch_prctl", ArchPrctl, "Options ARCH_GET_GS, ARCH_SET_GS not supported.", nil), 215 159: syscalls.CapError("adjtimex", linux.CAP_SYS_TIME, "", nil), 216 160: syscalls.PartiallySupported("setrlimit", Setrlimit, "Not all rlimits are enforced.", nil), 217 161: syscalls.Supported("chroot", Chroot), 218 162: syscalls.PartiallySupported("sync", Sync, "Full data flush is not guaranteed at this time.", nil), 219 163: syscalls.CapError("acct", linux.CAP_SYS_PACCT, "", nil), 220 164: syscalls.CapError("settimeofday", linux.CAP_SYS_TIME, "", nil), 221 165: syscalls.PartiallySupported("mount", Mount, "Not all options or file systems are supported.", nil), 222 166: syscalls.PartiallySupported("umount2", Umount2, "Not all options or file systems are supported.", nil), 223 167: syscalls.CapError("swapon", linux.CAP_SYS_ADMIN, "", nil), 224 168: syscalls.CapError("swapoff", linux.CAP_SYS_ADMIN, "", nil), 225 169: syscalls.CapError("reboot", linux.CAP_SYS_BOOT, "", nil), 226 170: syscalls.Supported("sethostname", Sethostname), 227 171: syscalls.Supported("setdomainname", Setdomainname), 228 172: syscalls.CapError("iopl", linux.CAP_SYS_RAWIO, "", nil), 229 173: syscalls.CapError("ioperm", linux.CAP_SYS_RAWIO, "", nil), 230 174: syscalls.CapError("create_module", linux.CAP_SYS_MODULE, "", nil), 231 175: syscalls.CapError("init_module", linux.CAP_SYS_MODULE, "", nil), 232 176: syscalls.CapError("delete_module", linux.CAP_SYS_MODULE, "", nil), 233 177: syscalls.Error("get_kernel_syms", syserror.ENOSYS, "Not supported in Linux > 2.6.", nil), 234 178: syscalls.Error("query_module", syserror.ENOSYS, "Not supported in Linux > 2.6.", nil), 235 179: syscalls.CapError("quotactl", linux.CAP_SYS_ADMIN, "", nil), // requires cap_sys_admin for most operations 236 180: syscalls.Error("nfsservctl", syserror.ENOSYS, "Removed after Linux 3.1.", nil), 237 181: syscalls.Error("getpmsg", syserror.ENOSYS, "Not implemented in Linux.", nil), 238 182: syscalls.Error("putpmsg", syserror.ENOSYS, "Not implemented in Linux.", nil), 239 183: syscalls.Error("afs_syscall", syserror.ENOSYS, "Not implemented in Linux.", nil), 240 184: syscalls.Error("tuxcall", syserror.ENOSYS, "Not implemented in Linux.", nil), 241 185: syscalls.Error("security", syserror.ENOSYS, "Not implemented in Linux.", nil), 242 186: syscalls.Supported("gettid", Gettid), 243 187: syscalls.Supported("readahead", Readahead), 244 188: syscalls.PartiallySupported("setxattr", SetXattr, "Only supported for tmpfs.", nil), 245 189: syscalls.PartiallySupported("lsetxattr", LSetXattr, "Only supported for tmpfs.", nil), 246 190: syscalls.PartiallySupported("fsetxattr", FSetXattr, "Only supported for tmpfs.", nil), 247 191: syscalls.PartiallySupported("getxattr", GetXattr, "Only supported for tmpfs.", nil), 248 192: syscalls.PartiallySupported("lgetxattr", LGetXattr, "Only supported for tmpfs.", nil), 249 193: syscalls.PartiallySupported("fgetxattr", FGetXattr, "Only supported for tmpfs.", nil), 250 194: syscalls.PartiallySupported("listxattr", ListXattr, "Only supported for tmpfs", nil), 251 195: syscalls.PartiallySupported("llistxattr", LListXattr, "Only supported for tmpfs", nil), 252 196: syscalls.PartiallySupported("flistxattr", FListXattr, "Only supported for tmpfs", nil), 253 197: syscalls.PartiallySupported("removexattr", RemoveXattr, "Only supported for tmpfs", nil), 254 198: syscalls.PartiallySupported("lremovexattr", LRemoveXattr, "Only supported for tmpfs", nil), 255 199: syscalls.PartiallySupported("fremovexattr", FRemoveXattr, "Only supported for tmpfs", nil), 256 200: syscalls.Supported("tkill", Tkill), 257 201: syscalls.Supported("time", Time), 258 202: syscalls.PartiallySupported("futex", Futex, "Robust futexes not supported.", nil), 259 203: syscalls.PartiallySupported("sched_setaffinity", SchedSetaffinity, "Stub implementation.", nil), 260 204: syscalls.PartiallySupported("sched_getaffinity", SchedGetaffinity, "Stub implementation.", nil), 261 205: syscalls.Error("set_thread_area", syserror.ENOSYS, "Expected to return ENOSYS on 64-bit", nil), 262 206: syscalls.PartiallySupported("io_setup", IoSetup, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"github.com/SagerNet/issue/204"}), 263 207: syscalls.PartiallySupported("io_destroy", IoDestroy, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"github.com/SagerNet/issue/204"}), 264 208: syscalls.PartiallySupported("io_getevents", IoGetevents, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"github.com/SagerNet/issue/204"}), 265 209: syscalls.PartiallySupported("io_submit", IoSubmit, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"github.com/SagerNet/issue/204"}), 266 210: syscalls.PartiallySupported("io_cancel", IoCancel, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"github.com/SagerNet/issue/204"}), 267 211: syscalls.Error("get_thread_area", syserror.ENOSYS, "Expected to return ENOSYS on 64-bit", nil), 268 212: syscalls.CapError("lookup_dcookie", linux.CAP_SYS_ADMIN, "", nil), 269 213: syscalls.Supported("epoll_create", EpollCreate), 270 214: syscalls.ErrorWithEvent("epoll_ctl_old", syserror.ENOSYS, "Deprecated.", nil), 271 215: syscalls.ErrorWithEvent("epoll_wait_old", syserror.ENOSYS, "Deprecated.", nil), 272 216: syscalls.ErrorWithEvent("remap_file_pages", syserror.ENOSYS, "Deprecated since Linux 3.16.", nil), 273 217: syscalls.Supported("getdents64", Getdents64), 274 218: syscalls.Supported("set_tid_address", SetTidAddress), 275 219: syscalls.Supported("restart_syscall", RestartSyscall), 276 220: syscalls.Supported("semtimedop", Semtimedop), 277 221: syscalls.PartiallySupported("fadvise64", Fadvise64, "Not all options are supported.", nil), 278 222: syscalls.Supported("timer_create", TimerCreate), 279 223: syscalls.Supported("timer_settime", TimerSettime), 280 224: syscalls.Supported("timer_gettime", TimerGettime), 281 225: syscalls.Supported("timer_getoverrun", TimerGetoverrun), 282 226: syscalls.Supported("timer_delete", TimerDelete), 283 227: syscalls.Supported("clock_settime", ClockSettime), 284 228: syscalls.Supported("clock_gettime", ClockGettime), 285 229: syscalls.Supported("clock_getres", ClockGetres), 286 230: syscalls.Supported("clock_nanosleep", ClockNanosleep), 287 231: syscalls.Supported("exit_group", ExitGroup), 288 232: syscalls.Supported("epoll_wait", EpollWait), 289 233: syscalls.Supported("epoll_ctl", EpollCtl), 290 234: syscalls.Supported("tgkill", Tgkill), 291 235: syscalls.Supported("utimes", Utimes), 292 236: syscalls.Error("vserver", syserror.ENOSYS, "Not implemented by Linux", nil), 293 237: syscalls.PartiallySupported("mbind", Mbind, "Stub implementation. Only a single NUMA node is advertised, and mempolicy is ignored accordingly, but mbind() will succeed and has effects reflected by get_mempolicy.", []string{"github.com/SagerNet/issue/262"}), 294 238: syscalls.PartiallySupported("set_mempolicy", SetMempolicy, "Stub implementation.", nil), 295 239: syscalls.PartiallySupported("get_mempolicy", GetMempolicy, "Stub implementation.", nil), 296 240: syscalls.ErrorWithEvent("mq_open", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 297 241: syscalls.ErrorWithEvent("mq_unlink", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 298 242: syscalls.ErrorWithEvent("mq_timedsend", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 299 243: syscalls.ErrorWithEvent("mq_timedreceive", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 300 244: syscalls.ErrorWithEvent("mq_notify", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 301 245: syscalls.ErrorWithEvent("mq_getsetattr", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 302 246: syscalls.CapError("kexec_load", linux.CAP_SYS_BOOT, "", nil), 303 247: syscalls.Supported("waitid", Waitid), 304 248: syscalls.Error("add_key", linuxerr.EACCES, "Not available to user.", nil), 305 249: syscalls.Error("request_key", linuxerr.EACCES, "Not available to user.", nil), 306 250: syscalls.Error("keyctl", linuxerr.EACCES, "Not available to user.", nil), 307 251: syscalls.CapError("ioprio_set", linux.CAP_SYS_ADMIN, "", nil), // requires cap_sys_nice or cap_sys_admin (depending) 308 252: syscalls.CapError("ioprio_get", linux.CAP_SYS_ADMIN, "", nil), // requires cap_sys_nice or cap_sys_admin (depending) 309 253: syscalls.PartiallySupported("inotify_init", InotifyInit, "Inotify events are only available inside the sandbox. Hard links are treated as different watch targets in gofer fs.", nil), 310 254: syscalls.PartiallySupported("inotify_add_watch", InotifyAddWatch, "Inotify events are only available inside the sandbox. Hard links are treated as different watch targets in gofer fs.", nil), 311 255: syscalls.PartiallySupported("inotify_rm_watch", InotifyRmWatch, "Inotify events are only available inside the sandbox. Hard links are treated as different watch targets in gofer fs.", nil), 312 256: syscalls.CapError("migrate_pages", linux.CAP_SYS_NICE, "", nil), 313 257: syscalls.Supported("openat", Openat), 314 258: syscalls.Supported("mkdirat", Mkdirat), 315 259: syscalls.Supported("mknodat", Mknodat), 316 260: syscalls.Supported("fchownat", Fchownat), 317 261: syscalls.Supported("futimesat", Futimesat), 318 262: syscalls.Supported("fstatat", Fstatat), 319 263: syscalls.Supported("unlinkat", Unlinkat), 320 264: syscalls.Supported("renameat", Renameat), 321 265: syscalls.PartiallySupported("linkat", Linkat, "See link(2).", nil), 322 266: syscalls.Supported("symlinkat", Symlinkat), 323 267: syscalls.Supported("readlinkat", Readlinkat), 324 268: syscalls.Supported("fchmodat", Fchmodat), 325 269: syscalls.Supported("faccessat", Faccessat), 326 270: syscalls.Supported("pselect", Pselect), 327 271: syscalls.Supported("ppoll", Ppoll), 328 272: syscalls.PartiallySupported("unshare", Unshare, "Mount, cgroup namespaces not supported. Network namespaces supported but must be empty.", nil), 329 273: syscalls.Supported("set_robust_list", SetRobustList), 330 274: syscalls.Supported("get_robust_list", GetRobustList), 331 275: syscalls.Supported("splice", Splice), 332 276: syscalls.Supported("tee", Tee), 333 277: syscalls.PartiallySupported("sync_file_range", SyncFileRange, "Full data flush is not guaranteed at this time.", nil), 334 278: syscalls.ErrorWithEvent("vmsplice", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/138"}), // TODO(b/29354098) 335 279: syscalls.CapError("move_pages", linux.CAP_SYS_NICE, "", nil), // requires cap_sys_nice (mostly) 336 280: syscalls.Supported("utimensat", Utimensat), 337 281: syscalls.Supported("epoll_pwait", EpollPwait), 338 282: syscalls.PartiallySupported("signalfd", Signalfd, "Semantics are slightly different.", []string{"github.com/SagerNet/issue/139"}), 339 283: syscalls.Supported("timerfd_create", TimerfdCreate), 340 284: syscalls.Supported("eventfd", Eventfd), 341 285: syscalls.PartiallySupported("fallocate", Fallocate, "Not all options are supported.", nil), 342 286: syscalls.Supported("timerfd_settime", TimerfdSettime), 343 287: syscalls.Supported("timerfd_gettime", TimerfdGettime), 344 288: syscalls.Supported("accept4", Accept4), 345 289: syscalls.PartiallySupported("signalfd4", Signalfd4, "Semantics are slightly different.", []string{"github.com/SagerNet/issue/139"}), 346 290: syscalls.Supported("eventfd2", Eventfd2), 347 291: syscalls.Supported("epoll_create1", EpollCreate1), 348 292: syscalls.Supported("dup3", Dup3), 349 293: syscalls.Supported("pipe2", Pipe2), 350 294: syscalls.PartiallySupported("inotify_init1", InotifyInit1, "Inotify events are only available inside the sandbox. Hard links are treated as different watch targets in gofer fs.", nil), 351 295: syscalls.Supported("preadv", Preadv), 352 296: syscalls.Supported("pwritev", Pwritev), 353 297: syscalls.Supported("rt_tgsigqueueinfo", RtTgsigqueueinfo), 354 298: syscalls.ErrorWithEvent("perf_event_open", linuxerr.ENODEV, "No support for perf counters", nil), 355 299: syscalls.PartiallySupported("recvmmsg", RecvMMsg, "Not all flags and control messages are supported.", nil), 356 300: syscalls.ErrorWithEvent("fanotify_init", syserror.ENOSYS, "Needs CONFIG_FANOTIFY", nil), 357 301: syscalls.ErrorWithEvent("fanotify_mark", syserror.ENOSYS, "Needs CONFIG_FANOTIFY", nil), 358 302: syscalls.Supported("prlimit64", Prlimit64), 359 303: syscalls.Error("name_to_handle_at", syserror.EOPNOTSUPP, "Not supported by gVisor filesystems", nil), 360 304: syscalls.Error("open_by_handle_at", syserror.EOPNOTSUPP, "Not supported by gVisor filesystems", nil), 361 305: syscalls.CapError("clock_adjtime", linux.CAP_SYS_TIME, "", nil), 362 306: syscalls.PartiallySupported("syncfs", Syncfs, "Depends on backing file system.", nil), 363 307: syscalls.PartiallySupported("sendmmsg", SendMMsg, "Not all flags and control messages are supported.", nil), 364 308: syscalls.ErrorWithEvent("setns", syserror.EOPNOTSUPP, "Needs filesystem support", []string{"github.com/SagerNet/issue/140"}), // TODO(b/29354995) 365 309: syscalls.Supported("getcpu", Getcpu), 366 310: syscalls.ErrorWithEvent("process_vm_readv", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/158"}), 367 311: syscalls.ErrorWithEvent("process_vm_writev", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/158"}), 368 312: syscalls.CapError("kcmp", linux.CAP_SYS_PTRACE, "", nil), 369 313: syscalls.CapError("finit_module", linux.CAP_SYS_MODULE, "", nil), 370 314: syscalls.ErrorWithEvent("sched_setattr", syserror.ENOSYS, "gVisor does not implement a scheduler.", []string{"github.com/SagerNet/issue/264"}), // TODO(b/118902272) 371 315: syscalls.ErrorWithEvent("sched_getattr", syserror.ENOSYS, "gVisor does not implement a scheduler.", []string{"github.com/SagerNet/issue/264"}), // TODO(b/118902272) 372 316: syscalls.ErrorWithEvent("renameat2", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/263"}), // TODO(b/118902772) 373 317: syscalls.Supported("seccomp", Seccomp), 374 318: syscalls.Supported("getrandom", GetRandom), 375 319: syscalls.Supported("memfd_create", MemfdCreate), 376 320: syscalls.CapError("kexec_file_load", linux.CAP_SYS_BOOT, "", nil), 377 321: syscalls.CapError("bpf", linux.CAP_SYS_ADMIN, "", nil), 378 322: syscalls.Supported("execveat", Execveat), 379 323: syscalls.ErrorWithEvent("userfaultfd", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/266"}), // TODO(b/118906345) 380 324: syscalls.PartiallySupported("membarrier", Membarrier, "Not supported on all platforms.", nil), 381 325: syscalls.PartiallySupported("mlock2", Mlock2, "Stub implementation. The sandbox lacks appropriate permissions.", nil), 382 383 // Syscalls implemented after 325 are "backports" from versions 384 // of Linux after 4.4. 385 326: syscalls.ErrorWithEvent("copy_file_range", syserror.ENOSYS, "", nil), 386 327: syscalls.Supported("preadv2", Preadv2), 387 328: syscalls.PartiallySupported("pwritev2", Pwritev2, "Flag RWF_HIPRI is not supported.", nil), 388 329: syscalls.ErrorWithEvent("pkey_mprotect", syserror.ENOSYS, "", nil), 389 330: syscalls.ErrorWithEvent("pkey_alloc", syserror.ENOSYS, "", nil), 390 331: syscalls.ErrorWithEvent("pkey_free", syserror.ENOSYS, "", nil), 391 332: syscalls.Supported("statx", Statx), 392 333: syscalls.ErrorWithEvent("io_pgetevents", syserror.ENOSYS, "", nil), 393 334: syscalls.PartiallySupported("rseq", RSeq, "Not supported on all platforms.", nil), 394 395 // Linux skips ahead to syscall 424 to sync numbers between arches. 396 424: syscalls.ErrorWithEvent("pidfd_send_signal", syserror.ENOSYS, "", nil), 397 425: syscalls.ErrorWithEvent("io_uring_setup", syserror.ENOSYS, "", nil), 398 426: syscalls.ErrorWithEvent("io_uring_enter", syserror.ENOSYS, "", nil), 399 427: syscalls.ErrorWithEvent("io_uring_register", syserror.ENOSYS, "", nil), 400 428: syscalls.ErrorWithEvent("open_tree", syserror.ENOSYS, "", nil), 401 429: syscalls.ErrorWithEvent("move_mount", syserror.ENOSYS, "", nil), 402 430: syscalls.ErrorWithEvent("fsopen", syserror.ENOSYS, "", nil), 403 431: syscalls.ErrorWithEvent("fsconfig", syserror.ENOSYS, "", nil), 404 432: syscalls.ErrorWithEvent("fsmount", syserror.ENOSYS, "", nil), 405 433: syscalls.ErrorWithEvent("fspick", syserror.ENOSYS, "", nil), 406 434: syscalls.ErrorWithEvent("pidfd_open", syserror.ENOSYS, "", nil), 407 435: syscalls.ErrorWithEvent("clone3", syserror.ENOSYS, "", nil), 408 441: syscalls.Supported("epoll_pwait2", EpollPwait2), 409 }, 410 Emulate: map[hostarch.Addr]uintptr{ 411 0xffffffffff600000: 96, // vsyscall gettimeofday(2) 412 0xffffffffff600400: 201, // vsyscall time(2) 413 0xffffffffff600800: 309, // vsyscall getcpu(2) 414 }, 415 Missing: func(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uintptr, error) { 416 t.Kernel().EmitUnimplementedEvent(t) 417 return 0, syserror.ENOSYS 418 }, 419 } 420 421 // ARM64 is a table of Linux arm64 syscall API with the corresponding syscall 422 // numbers from Linux 4.4. 423 var ARM64 = &kernel.SyscallTable{ 424 OS: abi.Linux, 425 Arch: arch.ARM64, 426 Version: kernel.Version{ 427 Sysname: LinuxSysname, 428 Release: LinuxRelease, 429 Version: LinuxVersion, 430 }, 431 AuditNumber: linux.AUDIT_ARCH_AARCH64, 432 Table: map[uintptr]kernel.Syscall{ 433 0: syscalls.PartiallySupported("io_setup", IoSetup, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"github.com/SagerNet/issue/204"}), 434 1: syscalls.PartiallySupported("io_destroy", IoDestroy, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"github.com/SagerNet/issue/204"}), 435 2: syscalls.PartiallySupported("io_submit", IoSubmit, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"github.com/SagerNet/issue/204"}), 436 3: syscalls.PartiallySupported("io_cancel", IoCancel, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"github.com/SagerNet/issue/204"}), 437 4: syscalls.PartiallySupported("io_getevents", IoGetevents, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"github.com/SagerNet/issue/204"}), 438 5: syscalls.PartiallySupported("setxattr", SetXattr, "Only supported for tmpfs.", nil), 439 6: syscalls.PartiallySupported("lsetxattr", LSetXattr, "Only supported for tmpfs.", nil), 440 7: syscalls.PartiallySupported("fsetxattr", FSetXattr, "Only supported for tmpfs.", nil), 441 8: syscalls.PartiallySupported("getxattr", GetXattr, "Only supported for tmpfs.", nil), 442 9: syscalls.PartiallySupported("lgetxattr", LGetXattr, "Only supported for tmpfs.", nil), 443 10: syscalls.PartiallySupported("fgetxattr", FGetXattr, "Only supported for tmpfs.", nil), 444 11: syscalls.PartiallySupported("listxattr", ListXattr, "Only supported for tmpfs", nil), 445 12: syscalls.PartiallySupported("llistxattr", LListXattr, "Only supported for tmpfs", nil), 446 13: syscalls.PartiallySupported("flistxattr", FListXattr, "Only supported for tmpfs", nil), 447 14: syscalls.PartiallySupported("removexattr", RemoveXattr, "Only supported for tmpfs", nil), 448 15: syscalls.PartiallySupported("lremovexattr", LRemoveXattr, "Only supported for tmpfs", nil), 449 16: syscalls.PartiallySupported("fremovexattr", FRemoveXattr, "Only supported for tmpfs", nil), 450 17: syscalls.Supported("getcwd", Getcwd), 451 18: syscalls.CapError("lookup_dcookie", linux.CAP_SYS_ADMIN, "", nil), 452 19: syscalls.Supported("eventfd2", Eventfd2), 453 20: syscalls.Supported("epoll_create1", EpollCreate1), 454 21: syscalls.Supported("epoll_ctl", EpollCtl), 455 22: syscalls.Supported("epoll_pwait", EpollPwait), 456 23: syscalls.Supported("dup", Dup), 457 24: syscalls.Supported("dup3", Dup3), 458 25: syscalls.PartiallySupported("fcntl", Fcntl, "Not all options are supported.", nil), 459 26: syscalls.PartiallySupported("inotify_init1", InotifyInit1, "Inotify events are only available inside the sandbox. Hard links are treated as different watch targets in gofer fs.", nil), 460 27: syscalls.PartiallySupported("inotify_add_watch", InotifyAddWatch, "Inotify events are only available inside the sandbox. Hard links are treated as different watch targets in gofer fs.", nil), 461 28: syscalls.PartiallySupported("inotify_rm_watch", InotifyRmWatch, "Inotify events are only available inside the sandbox. Hard links are treated as different watch targets in gofer fs.", nil), 462 29: syscalls.PartiallySupported("ioctl", Ioctl, "Only a few ioctls are implemented for backing devices and file systems.", nil), 463 30: syscalls.CapError("ioprio_set", linux.CAP_SYS_ADMIN, "", nil), // requires cap_sys_nice or cap_sys_admin (depending) 464 31: syscalls.CapError("ioprio_get", linux.CAP_SYS_ADMIN, "", nil), // requires cap_sys_nice or cap_sys_admin (depending) 465 32: syscalls.PartiallySupported("flock", Flock, "Locks are held within the sandbox only.", nil), 466 33: syscalls.Supported("mknodat", Mknodat), 467 34: syscalls.Supported("mkdirat", Mkdirat), 468 35: syscalls.Supported("unlinkat", Unlinkat), 469 36: syscalls.Supported("symlinkat", Symlinkat), 470 37: syscalls.Supported("linkat", Linkat), 471 38: syscalls.Supported("renameat", Renameat), 472 39: syscalls.PartiallySupported("umount2", Umount2, "Not all options or file systems are supported.", nil), 473 40: syscalls.PartiallySupported("mount", Mount, "Not all options or file systems are supported.", nil), 474 41: syscalls.Error("pivot_root", linuxerr.EPERM, "", nil), 475 42: syscalls.Error("nfsservctl", syserror.ENOSYS, "Removed after Linux 3.1.", nil), 476 43: syscalls.PartiallySupported("statfs", Statfs, "Depends on the backing file system implementation.", nil), 477 44: syscalls.PartiallySupported("fstatfs", Fstatfs, "Depends on the backing file system implementation.", nil), 478 45: syscalls.Supported("truncate", Truncate), 479 46: syscalls.Supported("ftruncate", Ftruncate), 480 47: syscalls.PartiallySupported("fallocate", Fallocate, "Not all options are supported.", nil), 481 48: syscalls.Supported("faccessat", Faccessat), 482 49: syscalls.Supported("chdir", Chdir), 483 50: syscalls.Supported("fchdir", Fchdir), 484 51: syscalls.Supported("chroot", Chroot), 485 52: syscalls.PartiallySupported("fchmod", Fchmod, "Options S_ISUID and S_ISGID not supported.", nil), 486 53: syscalls.Supported("fchmodat", Fchmodat), 487 54: syscalls.Supported("fchownat", Fchownat), 488 55: syscalls.Supported("fchown", Fchown), 489 56: syscalls.Supported("openat", Openat), 490 57: syscalls.Supported("close", Close), 491 58: syscalls.CapError("vhangup", linux.CAP_SYS_TTY_CONFIG, "", nil), 492 59: syscalls.Supported("pipe2", Pipe2), 493 60: syscalls.CapError("quotactl", linux.CAP_SYS_ADMIN, "", nil), // requires cap_sys_admin for most operations 494 61: syscalls.Supported("getdents64", Getdents64), 495 62: syscalls.Supported("lseek", Lseek), 496 63: syscalls.Supported("read", Read), 497 64: syscalls.Supported("write", Write), 498 65: syscalls.Supported("readv", Readv), 499 66: syscalls.Supported("writev", Writev), 500 67: syscalls.Supported("pread64", Pread64), 501 68: syscalls.Supported("pwrite64", Pwrite64), 502 69: syscalls.Supported("preadv", Preadv), 503 70: syscalls.Supported("pwritev", Pwritev), 504 71: syscalls.Supported("sendfile", Sendfile), 505 72: syscalls.Supported("pselect", Pselect), 506 73: syscalls.Supported("ppoll", Ppoll), 507 74: syscalls.PartiallySupported("signalfd4", Signalfd4, "Semantics are slightly different.", []string{"github.com/SagerNet/issue/139"}), 508 75: syscalls.ErrorWithEvent("vmsplice", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/138"}), // TODO(b/29354098) 509 76: syscalls.Supported("splice", Splice), 510 77: syscalls.Supported("tee", Tee), 511 78: syscalls.Supported("readlinkat", Readlinkat), 512 79: syscalls.Supported("fstatat", Fstatat), 513 80: syscalls.Supported("fstat", Fstat), 514 81: syscalls.PartiallySupported("sync", Sync, "Full data flush is not guaranteed at this time.", nil), 515 82: syscalls.PartiallySupported("fsync", Fsync, "Full data flush is not guaranteed at this time.", nil), 516 83: syscalls.PartiallySupported("fdatasync", Fdatasync, "Full data flush is not guaranteed at this time.", nil), 517 84: syscalls.PartiallySupported("sync_file_range", SyncFileRange, "Full data flush is not guaranteed at this time.", nil), 518 85: syscalls.Supported("timerfd_create", TimerfdCreate), 519 86: syscalls.Supported("timerfd_settime", TimerfdSettime), 520 87: syscalls.Supported("timerfd_gettime", TimerfdGettime), 521 88: syscalls.Supported("utimensat", Utimensat), 522 89: syscalls.CapError("acct", linux.CAP_SYS_PACCT, "", nil), 523 90: syscalls.Supported("capget", Capget), 524 91: syscalls.Supported("capset", Capset), 525 92: syscalls.ErrorWithEvent("personality", linuxerr.EINVAL, "Unable to change personality.", nil), 526 93: syscalls.Supported("exit", Exit), 527 94: syscalls.Supported("exit_group", ExitGroup), 528 95: syscalls.Supported("waitid", Waitid), 529 96: syscalls.Supported("set_tid_address", SetTidAddress), 530 97: syscalls.PartiallySupported("unshare", Unshare, "Mount, cgroup namespaces not supported. Network namespaces supported but must be empty.", nil), 531 98: syscalls.PartiallySupported("futex", Futex, "Robust futexes not supported.", nil), 532 99: syscalls.Supported("set_robust_list", SetRobustList), 533 100: syscalls.Supported("get_robust_list", GetRobustList), 534 101: syscalls.Supported("nanosleep", Nanosleep), 535 102: syscalls.Supported("getitimer", Getitimer), 536 103: syscalls.Supported("setitimer", Setitimer), 537 104: syscalls.CapError("kexec_load", linux.CAP_SYS_BOOT, "", nil), 538 105: syscalls.CapError("init_module", linux.CAP_SYS_MODULE, "", nil), 539 106: syscalls.CapError("delete_module", linux.CAP_SYS_MODULE, "", nil), 540 107: syscalls.Supported("timer_create", TimerCreate), 541 108: syscalls.Supported("timer_gettime", TimerGettime), 542 109: syscalls.Supported("timer_getoverrun", TimerGetoverrun), 543 110: syscalls.Supported("timer_settime", TimerSettime), 544 111: syscalls.Supported("timer_delete", TimerDelete), 545 112: syscalls.Supported("clock_settime", ClockSettime), 546 113: syscalls.Supported("clock_gettime", ClockGettime), 547 114: syscalls.Supported("clock_getres", ClockGetres), 548 115: syscalls.Supported("clock_nanosleep", ClockNanosleep), 549 116: syscalls.PartiallySupported("syslog", Syslog, "Outputs a dummy message for security reasons.", nil), 550 117: syscalls.PartiallySupported("ptrace", Ptrace, "Options PTRACE_PEEKSIGINFO, PTRACE_SECCOMP_GET_FILTER not supported.", nil), 551 118: syscalls.CapError("sched_setparam", linux.CAP_SYS_NICE, "", nil), 552 119: syscalls.PartiallySupported("sched_setscheduler", SchedSetscheduler, "Stub implementation.", nil), 553 120: syscalls.PartiallySupported("sched_getscheduler", SchedGetscheduler, "Stub implementation.", nil), 554 121: syscalls.PartiallySupported("sched_getparam", SchedGetparam, "Stub implementation.", nil), 555 122: syscalls.PartiallySupported("sched_setaffinity", SchedSetaffinity, "Stub implementation.", nil), 556 123: syscalls.PartiallySupported("sched_getaffinity", SchedGetaffinity, "Stub implementation.", nil), 557 124: syscalls.Supported("sched_yield", SchedYield), 558 125: syscalls.PartiallySupported("sched_get_priority_max", SchedGetPriorityMax, "Stub implementation.", nil), 559 126: syscalls.PartiallySupported("sched_get_priority_min", SchedGetPriorityMin, "Stub implementation.", nil), 560 127: syscalls.ErrorWithEvent("sched_rr_get_interval", linuxerr.EPERM, "", nil), 561 128: syscalls.Supported("restart_syscall", RestartSyscall), 562 129: syscalls.Supported("kill", Kill), 563 130: syscalls.Supported("tkill", Tkill), 564 131: syscalls.Supported("tgkill", Tgkill), 565 132: syscalls.Supported("sigaltstack", Sigaltstack), 566 133: syscalls.Supported("rt_sigsuspend", RtSigsuspend), 567 134: syscalls.Supported("rt_sigaction", RtSigaction), 568 135: syscalls.Supported("rt_sigprocmask", RtSigprocmask), 569 136: syscalls.Supported("rt_sigpending", RtSigpending), 570 137: syscalls.Supported("rt_sigtimedwait", RtSigtimedwait), 571 138: syscalls.Supported("rt_sigqueueinfo", RtSigqueueinfo), 572 139: syscalls.Supported("rt_sigreturn", RtSigreturn), 573 140: syscalls.PartiallySupported("setpriority", Setpriority, "Stub implementation.", nil), 574 141: syscalls.PartiallySupported("getpriority", Getpriority, "Stub implementation.", nil), 575 142: syscalls.CapError("reboot", linux.CAP_SYS_BOOT, "", nil), 576 143: syscalls.Supported("setregid", Setregid), 577 144: syscalls.Supported("setgid", Setgid), 578 145: syscalls.Supported("setreuid", Setreuid), 579 146: syscalls.Supported("setuid", Setuid), 580 147: syscalls.Supported("setresuid", Setresuid), 581 148: syscalls.Supported("getresuid", Getresuid), 582 149: syscalls.Supported("setresgid", Setresgid), 583 150: syscalls.Supported("getresgid", Getresgid), 584 151: syscalls.ErrorWithEvent("setfsuid", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/260"}), // TODO(b/112851702) 585 152: syscalls.ErrorWithEvent("setfsgid", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/260"}), // TODO(b/112851702) 586 153: syscalls.Supported("times", Times), 587 154: syscalls.Supported("setpgid", Setpgid), 588 155: syscalls.Supported("getpgid", Getpgid), 589 156: syscalls.Supported("getsid", Getsid), 590 157: syscalls.Supported("setsid", Setsid), 591 158: syscalls.Supported("getgroups", Getgroups), 592 159: syscalls.Supported("setgroups", Setgroups), 593 160: syscalls.Supported("uname", Uname), 594 161: syscalls.Supported("sethostname", Sethostname), 595 162: syscalls.Supported("setdomainname", Setdomainname), 596 163: syscalls.Supported("getrlimit", Getrlimit), 597 164: syscalls.PartiallySupported("setrlimit", Setrlimit, "Not all rlimits are enforced.", nil), 598 165: syscalls.PartiallySupported("getrusage", Getrusage, "Fields ru_maxrss, ru_minflt, ru_majflt, ru_inblock, ru_oublock are not supported. Fields ru_utime and ru_stime have low precision.", nil), 599 166: syscalls.Supported("umask", Umask), 600 167: syscalls.PartiallySupported("prctl", Prctl, "Not all options are supported.", nil), 601 168: syscalls.Supported("getcpu", Getcpu), 602 169: syscalls.Supported("gettimeofday", Gettimeofday), 603 170: syscalls.CapError("settimeofday", linux.CAP_SYS_TIME, "", nil), 604 171: syscalls.CapError("adjtimex", linux.CAP_SYS_TIME, "", nil), 605 172: syscalls.Supported("getpid", Getpid), 606 173: syscalls.Supported("getppid", Getppid), 607 174: syscalls.Supported("getuid", Getuid), 608 175: syscalls.Supported("geteuid", Geteuid), 609 176: syscalls.Supported("getgid", Getgid), 610 177: syscalls.Supported("getegid", Getegid), 611 178: syscalls.Supported("gettid", Gettid), 612 179: syscalls.PartiallySupported("sysinfo", Sysinfo, "Fields loads, sharedram, bufferram, totalswap, freeswap, totalhigh, freehigh not supported.", nil), 613 180: syscalls.ErrorWithEvent("mq_open", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 614 181: syscalls.ErrorWithEvent("mq_unlink", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 615 182: syscalls.ErrorWithEvent("mq_timedsend", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 616 183: syscalls.ErrorWithEvent("mq_timedreceive", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 617 184: syscalls.ErrorWithEvent("mq_notify", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 618 185: syscalls.ErrorWithEvent("mq_getsetattr", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/136"}), // TODO(b/29354921) 619 186: syscalls.ErrorWithEvent("msgget", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/135"}), // TODO(b/29354921) 620 187: syscalls.ErrorWithEvent("msgctl", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/135"}), // TODO(b/29354921) 621 188: syscalls.ErrorWithEvent("msgrcv", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/135"}), // TODO(b/29354921) 622 189: syscalls.ErrorWithEvent("msgsnd", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/135"}), // TODO(b/29354921) 623 190: syscalls.Supported("semget", Semget), 624 191: syscalls.Supported("semctl", Semctl), 625 192: syscalls.Supported("semtimedop", Semtimedop), 626 193: syscalls.PartiallySupported("semop", Semop, "Option SEM_UNDO not supported.", nil), 627 194: syscalls.PartiallySupported("shmget", Shmget, "Option SHM_HUGETLB is not supported.", nil), 628 195: syscalls.PartiallySupported("shmctl", Shmctl, "Options SHM_LOCK, SHM_UNLOCK are not supported.", nil), 629 196: syscalls.PartiallySupported("shmat", Shmat, "Option SHM_RND is not supported.", nil), 630 197: syscalls.Supported("shmdt", Shmdt), 631 198: syscalls.PartiallySupported("socket", Socket, "Limited support for AF_NETLINK, NETLINK_ROUTE sockets. Limited support for SOCK_RAW.", nil), 632 199: syscalls.Supported("socketpair", SocketPair), 633 200: syscalls.PartiallySupported("bind", Bind, "Autobind for abstract Unix sockets is not supported.", nil), 634 201: syscalls.Supported("listen", Listen), 635 202: syscalls.Supported("accept", Accept), 636 203: syscalls.Supported("connect", Connect), 637 204: syscalls.Supported("getsockname", GetSockName), 638 205: syscalls.Supported("getpeername", GetPeerName), 639 206: syscalls.Supported("sendto", SendTo), 640 207: syscalls.Supported("recvfrom", RecvFrom), 641 208: syscalls.PartiallySupported("setsockopt", SetSockOpt, "Not all socket options are supported.", nil), 642 209: syscalls.PartiallySupported("getsockopt", GetSockOpt, "Not all socket options are supported.", nil), 643 210: syscalls.PartiallySupported("shutdown", Shutdown, "Not all flags and control messages are supported.", nil), 644 211: syscalls.Supported("sendmsg", SendMsg), 645 212: syscalls.PartiallySupported("recvmsg", RecvMsg, "Not all flags and control messages are supported.", nil), 646 213: syscalls.Supported("readahead", Readahead), 647 214: syscalls.Supported("brk", Brk), 648 215: syscalls.Supported("munmap", Munmap), 649 216: syscalls.Supported("mremap", Mremap), 650 217: syscalls.Error("add_key", linuxerr.EACCES, "Not available to user.", nil), 651 218: syscalls.Error("request_key", linuxerr.EACCES, "Not available to user.", nil), 652 219: syscalls.Error("keyctl", linuxerr.EACCES, "Not available to user.", nil), 653 220: syscalls.PartiallySupported("clone", Clone, "Mount namespace (CLONE_NEWNS) not supported. Options CLONE_PARENT, CLONE_SYSVSEM not supported.", nil), 654 221: syscalls.Supported("execve", Execve), 655 222: syscalls.PartiallySupported("mmap", Mmap, "Generally supported with exceptions. Options MAP_FIXED_NOREPLACE, MAP_SHARED_VALIDATE, MAP_SYNC MAP_GROWSDOWN, MAP_HUGETLB are not supported.", nil), 656 223: syscalls.PartiallySupported("fadvise64", Fadvise64, "Not all options are supported.", nil), 657 224: syscalls.CapError("swapon", linux.CAP_SYS_ADMIN, "", nil), 658 225: syscalls.CapError("swapoff", linux.CAP_SYS_ADMIN, "", nil), 659 226: syscalls.Supported("mprotect", Mprotect), 660 227: syscalls.PartiallySupported("msync", Msync, "Full data flush is not guaranteed at this time.", nil), 661 228: syscalls.PartiallySupported("mlock", Mlock, "Stub implementation. The sandbox lacks appropriate permissions.", nil), 662 229: syscalls.PartiallySupported("munlock", Munlock, "Stub implementation. The sandbox lacks appropriate permissions.", nil), 663 230: syscalls.PartiallySupported("mlockall", Mlockall, "Stub implementation. The sandbox lacks appropriate permissions.", nil), 664 231: syscalls.PartiallySupported("munlockall", Munlockall, "Stub implementation. The sandbox lacks appropriate permissions.", nil), 665 232: syscalls.PartiallySupported("mincore", Mincore, "Stub implementation. The sandbox does not have access to this information. Reports all mapped pages are resident.", nil), 666 233: syscalls.PartiallySupported("madvise", Madvise, "Options MADV_DONTNEED, MADV_DONTFORK are supported. Other advice is ignored.", nil), 667 234: syscalls.ErrorWithEvent("remap_file_pages", syserror.ENOSYS, "Deprecated since Linux 3.16.", nil), 668 235: syscalls.PartiallySupported("mbind", Mbind, "Stub implementation. Only a single NUMA node is advertised, and mempolicy is ignored accordingly, but mbind() will succeed and has effects reflected by get_mempolicy.", []string{"github.com/SagerNet/issue/262"}), 669 236: syscalls.PartiallySupported("get_mempolicy", GetMempolicy, "Stub implementation.", nil), 670 237: syscalls.PartiallySupported("set_mempolicy", SetMempolicy, "Stub implementation.", nil), 671 238: syscalls.CapError("migrate_pages", linux.CAP_SYS_NICE, "", nil), 672 239: syscalls.CapError("move_pages", linux.CAP_SYS_NICE, "", nil), // requires cap_sys_nice (mostly) 673 240: syscalls.Supported("rt_tgsigqueueinfo", RtTgsigqueueinfo), 674 241: syscalls.ErrorWithEvent("perf_event_open", linuxerr.ENODEV, "No support for perf counters", nil), 675 242: syscalls.Supported("accept4", Accept4), 676 243: syscalls.PartiallySupported("recvmmsg", RecvMMsg, "Not all flags and control messages are supported.", nil), 677 260: syscalls.Supported("wait4", Wait4), 678 261: syscalls.Supported("prlimit64", Prlimit64), 679 262: syscalls.ErrorWithEvent("fanotify_init", syserror.ENOSYS, "Needs CONFIG_FANOTIFY", nil), 680 263: syscalls.ErrorWithEvent("fanotify_mark", syserror.ENOSYS, "Needs CONFIG_FANOTIFY", nil), 681 264: syscalls.Error("name_to_handle_at", syserror.EOPNOTSUPP, "Not supported by gVisor filesystems", nil), 682 265: syscalls.Error("open_by_handle_at", syserror.EOPNOTSUPP, "Not supported by gVisor filesystems", nil), 683 266: syscalls.CapError("clock_adjtime", linux.CAP_SYS_TIME, "", nil), 684 267: syscalls.PartiallySupported("syncfs", Syncfs, "Depends on backing file system.", nil), 685 268: syscalls.ErrorWithEvent("setns", syserror.EOPNOTSUPP, "Needs filesystem support", []string{"github.com/SagerNet/issue/140"}), // TODO(b/29354995) 686 269: syscalls.PartiallySupported("sendmmsg", SendMMsg, "Not all flags and control messages are supported.", nil), 687 270: syscalls.ErrorWithEvent("process_vm_readv", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/158"}), 688 271: syscalls.ErrorWithEvent("process_vm_writev", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/158"}), 689 272: syscalls.CapError("kcmp", linux.CAP_SYS_PTRACE, "", nil), 690 273: syscalls.CapError("finit_module", linux.CAP_SYS_MODULE, "", nil), 691 274: syscalls.ErrorWithEvent("sched_setattr", syserror.ENOSYS, "gVisor does not implement a scheduler.", []string{"github.com/SagerNet/issue/264"}), // TODO(b/118902272) 692 275: syscalls.ErrorWithEvent("sched_getattr", syserror.ENOSYS, "gVisor does not implement a scheduler.", []string{"github.com/SagerNet/issue/264"}), // TODO(b/118902272) 693 276: syscalls.ErrorWithEvent("renameat2", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/263"}), // TODO(b/118902772) 694 277: syscalls.Supported("seccomp", Seccomp), 695 278: syscalls.Supported("getrandom", GetRandom), 696 279: syscalls.Supported("memfd_create", MemfdCreate), 697 280: syscalls.CapError("bpf", linux.CAP_SYS_ADMIN, "", nil), 698 281: syscalls.Supported("execveat", Execveat), 699 282: syscalls.ErrorWithEvent("userfaultfd", syserror.ENOSYS, "", []string{"github.com/SagerNet/issue/266"}), // TODO(b/118906345) 700 283: syscalls.PartiallySupported("membarrier", Membarrier, "Not supported on all platforms.", nil), 701 284: syscalls.PartiallySupported("mlock2", Mlock2, "Stub implementation. The sandbox lacks appropriate permissions.", nil), 702 703 // Syscalls after 284 are "backports" from versions of Linux after 4.4. 704 285: syscalls.ErrorWithEvent("copy_file_range", syserror.ENOSYS, "", nil), 705 286: syscalls.Supported("preadv2", Preadv2), 706 287: syscalls.PartiallySupported("pwritev2", Pwritev2, "Flag RWF_HIPRI is not supported.", nil), 707 288: syscalls.ErrorWithEvent("pkey_mprotect", syserror.ENOSYS, "", nil), 708 289: syscalls.ErrorWithEvent("pkey_alloc", syserror.ENOSYS, "", nil), 709 290: syscalls.ErrorWithEvent("pkey_free", syserror.ENOSYS, "", nil), 710 291: syscalls.Supported("statx", Statx), 711 292: syscalls.ErrorWithEvent("io_pgetevents", syserror.ENOSYS, "", nil), 712 293: syscalls.PartiallySupported("rseq", RSeq, "Not supported on all platforms.", nil), 713 714 // Linux skips ahead to syscall 424 to sync numbers between arches. 715 424: syscalls.ErrorWithEvent("pidfd_send_signal", syserror.ENOSYS, "", nil), 716 425: syscalls.ErrorWithEvent("io_uring_setup", syserror.ENOSYS, "", nil), 717 426: syscalls.ErrorWithEvent("io_uring_enter", syserror.ENOSYS, "", nil), 718 427: syscalls.ErrorWithEvent("io_uring_register", syserror.ENOSYS, "", nil), 719 428: syscalls.ErrorWithEvent("open_tree", syserror.ENOSYS, "", nil), 720 429: syscalls.ErrorWithEvent("move_mount", syserror.ENOSYS, "", nil), 721 430: syscalls.ErrorWithEvent("fsopen", syserror.ENOSYS, "", nil), 722 431: syscalls.ErrorWithEvent("fsconfig", syserror.ENOSYS, "", nil), 723 432: syscalls.ErrorWithEvent("fsmount", syserror.ENOSYS, "", nil), 724 433: syscalls.ErrorWithEvent("fspick", syserror.ENOSYS, "", nil), 725 434: syscalls.ErrorWithEvent("pidfd_open", syserror.ENOSYS, "", nil), 726 435: syscalls.ErrorWithEvent("clone3", syserror.ENOSYS, "", nil), 727 441: syscalls.Supported("epoll_pwait2", EpollPwait2), 728 }, 729 Emulate: map[hostarch.Addr]uintptr{}, 730 Missing: func(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uintptr, error) { 731 t.Kernel().EmitUnimplementedEvent(t) 732 return 0, syserror.ENOSYS 733 }, 734 } 735 736 func init() { 737 kernel.RegisterSyscallTable(AMD64) 738 kernel.RegisterSyscallTable(ARM64) 739 }