github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/pkg/strace/syscall_linux_amd64.go (about) 1 // Copyright 2018 Google LLC. 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 strace 16 17 import ( 18 "golang.org/x/sys/unix" 19 ) 20 21 const archWidth = 64 22 23 // This is the amd64 syscall map. One might think that this one map could be used for all Linux 24 // flavors on all architectures. Ah, no. It's Linux, not Plan 9. Every arch has a different 25 // system call set. 26 var syscalls = SyscallMap{ 27 unix.SYS_READ: makeSyscallInfo("read", Hex, ReadBuffer, Hex), 28 unix.SYS_WRITE: makeSyscallInfo("write", Hex, WriteBuffer, Hex), 29 unix.SYS_OPEN: makeSyscallInfo("open", Path, OpenFlags, Mode), 30 unix.SYS_CLOSE: makeSyscallInfo("close", Hex), 31 unix.SYS_STAT: makeSyscallInfo("stat", Path, Stat), 32 unix.SYS_FSTAT: makeSyscallInfo("fstat", Hex, Stat), 33 unix.SYS_LSTAT: makeSyscallInfo("lstat", Path, Stat), 34 unix.SYS_POLL: makeSyscallInfo("poll", Hex, Hex, Hex), 35 unix.SYS_LSEEK: makeSyscallInfo("lseek", Hex, Hex, Hex), 36 unix.SYS_MMAP: makeSyscallInfo("mmap", Hex, Hex, Hex, Hex, Hex, Hex), 37 unix.SYS_MPROTECT: makeSyscallInfo("mprotect", Hex, Hex, Hex), 38 unix.SYS_MUNMAP: makeSyscallInfo("munmap", Hex, Hex), 39 unix.SYS_BRK: makeSyscallInfo("brk", Hex), 40 unix.SYS_RT_SIGACTION: makeSyscallInfo("rt_sigaction", Hex, Hex, Hex), 41 unix.SYS_RT_SIGPROCMASK: makeSyscallInfo("rt_sigprocmask", Hex, Hex, Hex, Hex), 42 unix.SYS_RT_SIGRETURN: makeSyscallInfo("rt_sigreturn"), 43 unix.SYS_IOCTL: makeSyscallInfo("ioctl", Hex, Hex, Hex), 44 unix.SYS_PREAD64: makeSyscallInfo("pread64", Hex, ReadBuffer, Hex, Hex), 45 unix.SYS_PWRITE64: makeSyscallInfo("pwrite64", Hex, WriteBuffer, Hex, Hex), 46 unix.SYS_READV: makeSyscallInfo("readv", Hex, ReadIOVec, Hex), 47 unix.SYS_WRITEV: makeSyscallInfo("writev", Hex, WriteIOVec, Hex), 48 unix.SYS_ACCESS: makeSyscallInfo("access", Path, Oct), 49 unix.SYS_PIPE: makeSyscallInfo("pipe", PipeFDs), 50 unix.SYS_SELECT: makeSyscallInfo("select", Hex, Hex, Hex, Hex, Timeval), 51 unix.SYS_SCHED_YIELD: makeSyscallInfo("sched_yield"), 52 unix.SYS_MREMAP: makeSyscallInfo("mremap", Hex, Hex, Hex, Hex, Hex), 53 unix.SYS_MSYNC: makeSyscallInfo("msync", Hex, Hex, Hex), 54 unix.SYS_MINCORE: makeSyscallInfo("mincore", Hex, Hex, Hex), 55 unix.SYS_MADVISE: makeSyscallInfo("madvise", Hex, Hex, Hex), 56 unix.SYS_SHMGET: makeSyscallInfo("shmget", Hex, Hex, Hex), 57 unix.SYS_SHMAT: makeSyscallInfo("shmat", Hex, Hex, Hex), 58 unix.SYS_SHMCTL: makeSyscallInfo("shmctl", Hex, Hex, Hex), 59 unix.SYS_DUP: makeSyscallInfo("dup", Hex), 60 unix.SYS_DUP2: makeSyscallInfo("dup2", Hex, Hex), 61 unix.SYS_PAUSE: makeSyscallInfo("pause"), 62 unix.SYS_NANOSLEEP: makeSyscallInfo("nanosleep", Timespec, PostTimespec), 63 unix.SYS_GETITIMER: makeSyscallInfo("getitimer", ItimerType, PostItimerVal), 64 unix.SYS_ALARM: makeSyscallInfo("alarm", Hex), 65 unix.SYS_SETITIMER: makeSyscallInfo("setitimer", ItimerType, ItimerVal, PostItimerVal), 66 unix.SYS_GETPID: makeSyscallInfo("getpid"), 67 unix.SYS_SENDFILE: makeSyscallInfo("sendfile", Hex, Hex, Hex, Hex), 68 unix.SYS_SOCKET: makeSyscallInfo("socket", SockFamily, SockType, SockProtocol), 69 unix.SYS_CONNECT: makeSyscallInfo("connect", Hex, SockAddr, Hex), 70 unix.SYS_ACCEPT: makeSyscallInfo("accept", Hex, PostSockAddr, SockLen), 71 unix.SYS_SENDTO: makeSyscallInfo("sendto", Hex, Hex, Hex, Hex, SockAddr, Hex), 72 unix.SYS_RECVFROM: makeSyscallInfo("recvfrom", Hex, Hex, Hex, Hex, PostSockAddr, SockLen), 73 unix.SYS_SENDMSG: makeSyscallInfo("sendmsg", Hex, SendMsgHdr, Hex), 74 unix.SYS_RECVMSG: makeSyscallInfo("recvmsg", Hex, RecvMsgHdr, Hex), 75 unix.SYS_SHUTDOWN: makeSyscallInfo("shutdown", Hex, Hex), 76 unix.SYS_BIND: makeSyscallInfo("bind", Hex, SockAddr, Hex), 77 unix.SYS_LISTEN: makeSyscallInfo("listen", Hex, Hex), 78 unix.SYS_GETSOCKNAME: makeSyscallInfo("getsockname", Hex, PostSockAddr, SockLen), 79 unix.SYS_GETPEERNAME: makeSyscallInfo("getpeername", Hex, PostSockAddr, SockLen), 80 unix.SYS_SOCKETPAIR: makeSyscallInfo("socketpair", SockFamily, SockType, SockProtocol, Hex), 81 unix.SYS_SETSOCKOPT: makeSyscallInfo("setsockopt", Hex, Hex, Hex, Hex, Hex), 82 unix.SYS_GETSOCKOPT: makeSyscallInfo("getsockopt", Hex, Hex, Hex, Hex, Hex), 83 unix.SYS_CLONE: makeSyscallInfo("clone", CloneFlags, Hex, Hex, Hex, Hex), 84 unix.SYS_FORK: makeSyscallInfo("fork"), 85 unix.SYS_VFORK: makeSyscallInfo("vfork"), 86 unix.SYS_EXECVE: makeSyscallInfo("execve", Path, ExecveStringVector, ExecveStringVector), 87 unix.SYS_EXIT: makeSyscallInfo("exit", Hex), 88 unix.SYS_WAIT4: makeSyscallInfo("wait4", Hex, Hex, Hex, Rusage), 89 unix.SYS_KILL: makeSyscallInfo("kill", Hex, Hex), 90 unix.SYS_UNAME: makeSyscallInfo("uname", Uname), 91 unix.SYS_SEMGET: makeSyscallInfo("semget", Hex, Hex, Hex), 92 unix.SYS_SEMOP: makeSyscallInfo("semop", Hex, Hex, Hex), 93 unix.SYS_SEMCTL: makeSyscallInfo("semctl", Hex, Hex, Hex, Hex), 94 unix.SYS_SHMDT: makeSyscallInfo("shmdt", Hex), 95 unix.SYS_MSGGET: makeSyscallInfo("msgget", Hex, Hex), 96 unix.SYS_MSGSND: makeSyscallInfo("msgsnd", Hex, Hex, Hex, Hex), 97 unix.SYS_MSGRCV: makeSyscallInfo("msgrcv", Hex, Hex, Hex, Hex, Hex), 98 unix.SYS_MSGCTL: makeSyscallInfo("msgctl", Hex, Hex, Hex), 99 unix.SYS_FCNTL: makeSyscallInfo("fcntl", Hex, Hex, Hex), 100 unix.SYS_FLOCK: makeSyscallInfo("flock", Hex, Hex), 101 unix.SYS_FSYNC: makeSyscallInfo("fsync", Hex), 102 unix.SYS_FDATASYNC: makeSyscallInfo("fdatasync", Hex), 103 unix.SYS_TRUNCATE: makeSyscallInfo("truncate", Path, Hex), 104 unix.SYS_FTRUNCATE: makeSyscallInfo("ftruncate", Hex, Hex), 105 unix.SYS_GETDENTS: makeSyscallInfo("getdents", Hex, Hex, Hex), 106 unix.SYS_GETCWD: makeSyscallInfo("getcwd", PostPath, Hex), 107 unix.SYS_CHDIR: makeSyscallInfo("chdir", Path), 108 unix.SYS_FCHDIR: makeSyscallInfo("fchdir", Hex), 109 unix.SYS_RENAME: makeSyscallInfo("rename", Path, Path), 110 unix.SYS_MKDIR: makeSyscallInfo("mkdir", Path, Oct), 111 unix.SYS_RMDIR: makeSyscallInfo("rmdir", Path), 112 unix.SYS_CREAT: makeSyscallInfo("creat", Path, Oct), 113 unix.SYS_LINK: makeSyscallInfo("link", Path, Path), 114 unix.SYS_UNLINK: makeSyscallInfo("unlink", Path), 115 unix.SYS_SYMLINK: makeSyscallInfo("symlink", Path, Path), 116 unix.SYS_READLINK: makeSyscallInfo("readlink", Path, ReadBuffer, Hex), 117 unix.SYS_CHMOD: makeSyscallInfo("chmod", Path, Mode), 118 unix.SYS_FCHMOD: makeSyscallInfo("fchmod", Hex, Mode), 119 unix.SYS_CHOWN: makeSyscallInfo("chown", Path, Hex, Hex), 120 unix.SYS_FCHOWN: makeSyscallInfo("fchown", Hex, Hex, Hex), 121 unix.SYS_LCHOWN: makeSyscallInfo("lchown", Hex, Hex, Hex), 122 unix.SYS_UMASK: makeSyscallInfo("umask", Hex), 123 unix.SYS_GETTIMEOFDAY: makeSyscallInfo("gettimeofday", Timeval, Hex), 124 unix.SYS_GETRLIMIT: makeSyscallInfo("getrlimit", Hex, Hex), 125 unix.SYS_GETRUSAGE: makeSyscallInfo("getrusage", Hex, Rusage), 126 unix.SYS_SYSINFO: makeSyscallInfo("sysinfo", Hex), 127 unix.SYS_TIMES: makeSyscallInfo("times", Hex), 128 unix.SYS_PTRACE: makeSyscallInfo("ptrace", PtraceRequest, Hex, Hex, Hex), 129 unix.SYS_GETUID: makeSyscallInfo("getuid"), 130 unix.SYS_SYSLOG: makeSyscallInfo("syslog", Hex, Hex, Hex), 131 unix.SYS_GETGID: makeSyscallInfo("getgid"), 132 unix.SYS_SETUID: makeSyscallInfo("setuid", Hex), 133 unix.SYS_SETGID: makeSyscallInfo("setgid", Hex), 134 unix.SYS_GETEUID: makeSyscallInfo("geteuid"), 135 unix.SYS_GETEGID: makeSyscallInfo("getegid"), 136 unix.SYS_SETPGID: makeSyscallInfo("setpgid", Hex, Hex), 137 unix.SYS_GETPPID: makeSyscallInfo("getppid"), 138 unix.SYS_GETPGRP: makeSyscallInfo("getpgrp"), 139 unix.SYS_SETSID: makeSyscallInfo("setsid"), 140 unix.SYS_SETREUID: makeSyscallInfo("setreuid", Hex, Hex), 141 unix.SYS_SETREGID: makeSyscallInfo("setregid", Hex, Hex), 142 unix.SYS_GETGROUPS: makeSyscallInfo("getgroups", Hex, Hex), 143 unix.SYS_SETGROUPS: makeSyscallInfo("setgroups", Hex, Hex), 144 unix.SYS_SETRESUID: makeSyscallInfo("setresuid", Hex, Hex, Hex), 145 unix.SYS_GETRESUID: makeSyscallInfo("getresuid", Hex, Hex, Hex), 146 unix.SYS_SETRESGID: makeSyscallInfo("setresgid", Hex, Hex, Hex), 147 unix.SYS_GETRESGID: makeSyscallInfo("getresgid", Hex, Hex, Hex), 148 unix.SYS_GETPGID: makeSyscallInfo("getpgid", Hex), 149 unix.SYS_SETFSUID: makeSyscallInfo("setfsuid", Hex), 150 unix.SYS_SETFSGID: makeSyscallInfo("setfsgid", Hex), 151 unix.SYS_GETSID: makeSyscallInfo("getsid", Hex), 152 unix.SYS_CAPGET: makeSyscallInfo("capget", Hex, Hex), 153 unix.SYS_CAPSET: makeSyscallInfo("capset", Hex, Hex), 154 unix.SYS_RT_SIGPENDING: makeSyscallInfo("rt_sigpending", Hex), 155 unix.SYS_RT_SIGTIMEDWAIT: makeSyscallInfo("rt_sigtimedwait", Hex, Hex, Timespec, Hex), 156 unix.SYS_RT_SIGQUEUEINFO: makeSyscallInfo("rt_sigqueueinfo", Hex, Hex, Hex), 157 unix.SYS_RT_SIGSUSPEND: makeSyscallInfo("rt_sigsuspend", Hex), 158 unix.SYS_SIGALTSTACK: makeSyscallInfo("sigaltstack", Hex, Hex), 159 unix.SYS_UTIME: makeSyscallInfo("utime", Path, Utimbuf), 160 unix.SYS_MKNOD: makeSyscallInfo("mknod", Path, Mode, Hex), 161 unix.SYS_USELIB: makeSyscallInfo("uselib", Hex), 162 unix.SYS_PERSONALITY: makeSyscallInfo("personality", Hex), 163 unix.SYS_USTAT: makeSyscallInfo("ustat", Hex, Hex), 164 unix.SYS_STATFS: makeSyscallInfo("statfs", Path, Hex), 165 unix.SYS_FSTATFS: makeSyscallInfo("fstatfs", Hex, Hex), 166 unix.SYS_SYSFS: makeSyscallInfo("sysfs", Hex, Hex, Hex), 167 unix.SYS_GETPRIORITY: makeSyscallInfo("getpriority", Hex, Hex), 168 unix.SYS_SETPRIORITY: makeSyscallInfo("setpriority", Hex, Hex, Hex), 169 unix.SYS_SCHED_SETPARAM: makeSyscallInfo("sched_setparam", Hex, Hex), 170 unix.SYS_SCHED_GETPARAM: makeSyscallInfo("sched_getparam", Hex, Hex), 171 unix.SYS_SCHED_SETSCHEDULER: makeSyscallInfo("sched_setscheduler", Hex, Hex, Hex), 172 unix.SYS_SCHED_GETSCHEDULER: makeSyscallInfo("sched_getscheduler", Hex), 173 unix.SYS_SCHED_GET_PRIORITY_MAX: makeSyscallInfo("sched_get_priority_max", Hex), 174 unix.SYS_SCHED_GET_PRIORITY_MIN: makeSyscallInfo("sched_get_priority_min", Hex), 175 unix.SYS_SCHED_RR_GET_INTERVAL: makeSyscallInfo("sched_rr_get_interval", Hex, Hex), 176 unix.SYS_MLOCK: makeSyscallInfo("mlock", Hex, Hex), 177 unix.SYS_MUNLOCK: makeSyscallInfo("munlock", Hex, Hex), 178 unix.SYS_MLOCKALL: makeSyscallInfo("mlockall", Hex), 179 unix.SYS_MUNLOCKALL: makeSyscallInfo("munlockall"), 180 unix.SYS_VHANGUP: makeSyscallInfo("vhangup"), 181 unix.SYS_MODIFY_LDT: makeSyscallInfo("modify_ldt", Hex, Hex, Hex), 182 unix.SYS_PIVOT_ROOT: makeSyscallInfo("pivot_root", Hex, Hex), 183 unix.SYS__SYSCTL: makeSyscallInfo("_sysctl", Hex), 184 unix.SYS_PRCTL: makeSyscallInfo("prctl", Hex, Hex, Hex, Hex, Hex), 185 unix.SYS_ARCH_PRCTL: makeSyscallInfo("arch_prctl", Hex, Hex), 186 unix.SYS_ADJTIMEX: makeSyscallInfo("adjtimex", Hex), 187 unix.SYS_SETRLIMIT: makeSyscallInfo("setrlimit", Hex, Hex), 188 unix.SYS_CHROOT: makeSyscallInfo("chroot", Path), 189 unix.SYS_SYNC: makeSyscallInfo("sync"), 190 unix.SYS_ACCT: makeSyscallInfo("acct", Hex), 191 unix.SYS_SETTIMEOFDAY: makeSyscallInfo("settimeofday", Timeval, Hex), 192 unix.SYS_MOUNT: makeSyscallInfo("mount", Path, Path, Path, Hex, Path), 193 unix.SYS_UMOUNT2: makeSyscallInfo("umount2", Path, Hex), 194 unix.SYS_SWAPON: makeSyscallInfo("swapon", Hex, Hex), 195 unix.SYS_SWAPOFF: makeSyscallInfo("swapoff", Hex), 196 unix.SYS_REBOOT: makeSyscallInfo("reboot", Hex, Hex, Hex, Hex), 197 unix.SYS_SETHOSTNAME: makeSyscallInfo("sethostname", Hex, Hex), 198 unix.SYS_SETDOMAINNAME: makeSyscallInfo("setdomainname", Hex, Hex), 199 unix.SYS_IOPL: makeSyscallInfo("iopl", Hex), 200 unix.SYS_IOPERM: makeSyscallInfo("ioperm", Hex, Hex, Hex), 201 unix.SYS_CREATE_MODULE: makeSyscallInfo("create_module", Path, Hex), 202 unix.SYS_INIT_MODULE: makeSyscallInfo("init_module", Hex, Hex, Hex), 203 unix.SYS_DELETE_MODULE: makeSyscallInfo("delete_module", Hex, Hex), 204 unix.SYS_GET_KERNEL_SYMS: makeSyscallInfo("get_kernel_syms", Hex), 205 // unix.SYS_QUERY_MODULE:query_module (only present in Linux < 2.6) 206 unix.SYS_QUOTACTL: makeSyscallInfo("quotactl", Hex, Hex, Hex, Hex), 207 unix.SYS_NFSSERVCTL: makeSyscallInfo("nfsservctl", Hex, Hex, Hex), 208 // unix.SYS_GETPMSG:getpmsg (not implemented in the Linux kernel) 209 // unix.SYS_PUTPMSG:putpmsg (not implemented in the Linux kernel) 210 // unix.SYSCALL:afs_syscall (not implemented in the Linux kernel) 211 // unix.SYS_TUXCALL:tuxcall (not implemented in the Linux kernel) 212 // unix.SYS_SECURITY:security (not implemented in the Linux kernel) 213 unix.SYS_GETTID: makeSyscallInfo("gettid"), 214 unix.SYS_READAHEAD: makeSyscallInfo("readahead", Hex, Hex, Hex), 215 unix.SYS_SETXATTR: makeSyscallInfo("setxattr", Path, Path, Hex, Hex, Hex), 216 unix.SYS_LSETXATTR: makeSyscallInfo("lsetxattr", Path, Path, Hex, Hex, Hex), 217 unix.SYS_FSETXATTR: makeSyscallInfo("fsetxattr", Hex, Path, Hex, Hex, Hex), 218 unix.SYS_GETXATTR: makeSyscallInfo("getxattr", Path, Path, Hex, Hex), 219 unix.SYS_LGETXATTR: makeSyscallInfo("lgetxattr", Path, Path, Hex, Hex), 220 unix.SYS_FGETXATTR: makeSyscallInfo("fgetxattr", Hex, Path, Hex, Hex), 221 unix.SYS_LISTXATTR: makeSyscallInfo("listxattr", Path, Path, Hex), 222 unix.SYS_LLISTXATTR: makeSyscallInfo("llistxattr", Path, Path, Hex), 223 unix.SYS_FLISTXATTR: makeSyscallInfo("flistxattr", Hex, Path, Hex), 224 unix.SYS_REMOVEXATTR: makeSyscallInfo("removexattr", Path, Path), 225 unix.SYS_LREMOVEXATTR: makeSyscallInfo("lremovexattr", Path, Path), 226 unix.SYS_FREMOVEXATTR: makeSyscallInfo("fremovexattr", Hex, Path), 227 unix.SYS_TKILL: makeSyscallInfo("tkill", Hex, Hex), 228 unix.SYS_TIME: makeSyscallInfo("time", Hex), 229 unix.SYS_FUTEX: makeSyscallInfo("futex", Hex, FutexOp, Hex, Timespec, Hex, Hex), 230 unix.SYS_SCHED_SETAFFINITY: makeSyscallInfo("sched_setaffinity", Hex, Hex, Hex), 231 unix.SYS_SCHED_GETAFFINITY: makeSyscallInfo("sched_getaffinity", Hex, Hex, Hex), 232 unix.SYS_SET_THREAD_AREA: makeSyscallInfo("set_thread_area", Hex), 233 unix.SYS_IO_SETUP: makeSyscallInfo("io_setup", Hex, Hex), 234 unix.SYS_IO_DESTROY: makeSyscallInfo("io_destroy", Hex), 235 unix.SYS_IO_GETEVENTS: makeSyscallInfo("io_getevents", Hex, Hex, Hex, Hex, Timespec), 236 unix.SYS_IO_SUBMIT: makeSyscallInfo("io_submit", Hex, Hex, Hex), 237 unix.SYS_IO_CANCEL: makeSyscallInfo("io_cancel", Hex, Hex, Hex), 238 unix.SYS_GET_THREAD_AREA: makeSyscallInfo("get_thread_area", Hex), 239 unix.SYS_LOOKUP_DCOOKIE: makeSyscallInfo("lookup_dcookie", Hex, Hex, Hex), 240 unix.SYS_EPOLL_CREATE: makeSyscallInfo("epoll_create", Hex), 241 // unix.SYS_EPOLL_CTL_OLD:epoll_ctl_old (not implemented in the Linux kernel) 242 // unix.SYS_EPOLL_WAIT_OLD:epoll_wait_old (not implemented in the Linux kernel) 243 unix.SYS_REMAP_FILE_PAGES: makeSyscallInfo("remap_file_pages", Hex, Hex, Hex, Hex, Hex), 244 unix.SYS_GETDENTS64: makeSyscallInfo("getdents64", Hex, Hex, Hex), 245 unix.SYS_SET_TID_ADDRESS: makeSyscallInfo("set_tid_address", Hex), 246 unix.SYS_RESTART_SYSCALL: makeSyscallInfo("restart_syscall"), 247 unix.SYS_SEMTIMEDOP: makeSyscallInfo("semtimedop", Hex, Hex, Hex, Hex), 248 unix.SYS_FADVISE64: makeSyscallInfo("fadvise64", Hex, Hex, Hex, Hex), 249 unix.SYS_TIMER_CREATE: makeSyscallInfo("timer_create", Hex, Hex, Hex), 250 unix.SYS_TIMER_SETTIME: makeSyscallInfo("timer_settime", Hex, Hex, ItimerSpec, PostItimerSpec), 251 unix.SYS_TIMER_GETTIME: makeSyscallInfo("timer_gettime", Hex, PostItimerSpec), 252 unix.SYS_TIMER_GETOVERRUN: makeSyscallInfo("timer_getoverrun", Hex), 253 unix.SYS_TIMER_DELETE: makeSyscallInfo("timer_delete", Hex), 254 unix.SYS_CLOCK_SETTIME: makeSyscallInfo("clock_settime", Hex, Timespec), 255 unix.SYS_CLOCK_GETTIME: makeSyscallInfo("clock_gettime", Hex, PostTimespec), 256 unix.SYS_CLOCK_GETRES: makeSyscallInfo("clock_getres", Hex, PostTimespec), 257 unix.SYS_CLOCK_NANOSLEEP: makeSyscallInfo("clock_nanosleep", Hex, Hex, Timespec, PostTimespec), 258 unix.SYS_EXIT_GROUP: makeSyscallInfo("exit_group", Hex), 259 unix.SYS_EPOLL_WAIT: makeSyscallInfo("epoll_wait", Hex, Hex, Hex, Hex), 260 unix.SYS_EPOLL_CTL: makeSyscallInfo("epoll_ctl", Hex, Hex, Hex, Hex), 261 unix.SYS_TGKILL: makeSyscallInfo("tgkill", Hex, Hex, Hex), 262 unix.SYS_UTIMES: makeSyscallInfo("utimes", Path, Timeval), 263 // unix.SYS_VSERVER:vserver (not implemented in the Linux kernel) 264 unix.SYS_MBIND: makeSyscallInfo("mbind", Hex, Hex, Hex, Hex, Hex, Hex), 265 unix.SYS_SET_MEMPOLICY: makeSyscallInfo("set_mempolicy", Hex, Hex, Hex), 266 unix.SYS_GET_MEMPOLICY: makeSyscallInfo("get_mempolicy", Hex, Hex, Hex, Hex, Hex), 267 unix.SYS_MQ_OPEN: makeSyscallInfo("mq_open", Hex, Hex, Hex, Hex), 268 unix.SYS_MQ_UNLINK: makeSyscallInfo("mq_unlink", Hex), 269 unix.SYS_MQ_TIMEDSEND: makeSyscallInfo("mq_timedsend", Hex, Hex, Hex, Hex, Hex), 270 unix.SYS_MQ_TIMEDRECEIVE: makeSyscallInfo("mq_timedreceive", Hex, Hex, Hex, Hex, Hex), 271 unix.SYS_MQ_NOTIFY: makeSyscallInfo("mq_notify", Hex, Hex), 272 unix.SYS_MQ_GETSETATTR: makeSyscallInfo("mq_getsetattr", Hex, Hex, Hex), 273 unix.SYS_KEXEC_LOAD: makeSyscallInfo("kexec_load", Hex, Hex, Hex, Hex), 274 unix.SYS_WAITID: makeSyscallInfo("waitid", Hex, Hex, Hex, Hex, Rusage), 275 unix.SYS_ADD_KEY: makeSyscallInfo("add_key", Hex, Hex, Hex, Hex, Hex), 276 unix.SYS_REQUEST_KEY: makeSyscallInfo("request_key", Hex, Hex, Hex, Hex), 277 unix.SYS_KEYCTL: makeSyscallInfo("keyctl", Hex, Hex, Hex, Hex, Hex), 278 unix.SYS_IOPRIO_SET: makeSyscallInfo("ioprio_set", Hex, Hex, Hex), 279 unix.SYS_IOPRIO_GET: makeSyscallInfo("ioprio_get", Hex, Hex), 280 unix.SYS_INOTIFY_INIT: makeSyscallInfo("inotify_init"), 281 unix.SYS_INOTIFY_ADD_WATCH: makeSyscallInfo("inotify_add_watch", Hex, Hex, Hex), 282 unix.SYS_INOTIFY_RM_WATCH: makeSyscallInfo("inotify_rm_watch", Hex, Hex), 283 unix.SYS_MIGRATE_PAGES: makeSyscallInfo("migrate_pages", Hex, Hex, Hex, Hex), 284 unix.SYS_OPENAT: makeSyscallInfo("openat", Hex, Path, OpenFlags, Mode), 285 unix.SYS_MKDIRAT: makeSyscallInfo("mkdirat", Hex, Path, Hex), 286 unix.SYS_MKNODAT: makeSyscallInfo("mknodat", Hex, Path, Mode, Hex), 287 unix.SYS_FCHOWNAT: makeSyscallInfo("fchownat", Hex, Path, Hex, Hex, Hex), 288 unix.SYS_FUTIMESAT: makeSyscallInfo("futimesat", Hex, Path, Hex), 289 unix.SYS_NEWFSTATAT: makeSyscallInfo("newfstatat", Hex, Path, Stat, Hex), 290 unix.SYS_UNLINKAT: makeSyscallInfo("unlinkat", Hex, Path, Hex), 291 unix.SYS_RENAMEAT: makeSyscallInfo("renameat", Hex, Path, Hex, Path), 292 unix.SYS_LINKAT: makeSyscallInfo("linkat", Hex, Path, Hex, Path, Hex), 293 unix.SYS_SYMLINKAT: makeSyscallInfo("symlinkat", Path, Hex, Path), 294 unix.SYS_READLINKAT: makeSyscallInfo("readlinkat", Hex, Path, ReadBuffer, Hex), 295 unix.SYS_FCHMODAT: makeSyscallInfo("fchmodat", Hex, Path, Mode), 296 unix.SYS_FACCESSAT: makeSyscallInfo("faccessat", Hex, Path, Oct, Hex), 297 unix.SYS_PSELECT6: makeSyscallInfo("pselect6", Hex, Hex, Hex, Hex, Hex, Hex), 298 unix.SYS_PPOLL: makeSyscallInfo("ppoll", Hex, Hex, Timespec, Hex, Hex), 299 unix.SYS_UNSHARE: makeSyscallInfo("unshare", Hex), 300 unix.SYS_SET_ROBUST_LIST: makeSyscallInfo("set_robust_list", Hex, Hex), 301 unix.SYS_GET_ROBUST_LIST: makeSyscallInfo("get_robust_list", Hex, Hex, Hex), 302 unix.SYS_SPLICE: makeSyscallInfo("splice", Hex, Hex, Hex, Hex, Hex, Hex), 303 unix.SYS_TEE: makeSyscallInfo("tee", Hex, Hex, Hex, Hex), 304 unix.SYS_SYNC_FILE_RANGE: makeSyscallInfo("sync_file_range", Hex, Hex, Hex, Hex), 305 unix.SYS_VMSPLICE: makeSyscallInfo("vmsplice", Hex, Hex, Hex, Hex), 306 unix.SYS_MOVE_PAGES: makeSyscallInfo("move_pages", Hex, Hex, Hex, Hex, Hex, Hex), 307 unix.SYS_UTIMENSAT: makeSyscallInfo("utimensat", Hex, Path, UTimeTimespec, Hex), 308 unix.SYS_EPOLL_PWAIT: makeSyscallInfo("epoll_pwait", Hex, Hex, Hex, Hex, Hex, Hex), 309 unix.SYS_SIGNALFD: makeSyscallInfo("signalfd", Hex, Hex, Hex), 310 unix.SYS_TIMERFD_CREATE: makeSyscallInfo("timerfd_create", Hex, Hex), 311 unix.SYS_EVENTFD: makeSyscallInfo("eventfd", Hex), 312 unix.SYS_FALLOCATE: makeSyscallInfo("fallocate", Hex, Hex, Hex, Hex), 313 unix.SYS_TIMERFD_SETTIME: makeSyscallInfo("timerfd_settime", Hex, Hex, ItimerSpec, PostItimerSpec), 314 unix.SYS_TIMERFD_GETTIME: makeSyscallInfo("timerfd_gettime", Hex, PostItimerSpec), 315 unix.SYS_ACCEPT4: makeSyscallInfo("accept4", Hex, PostSockAddr, SockLen, SockFlags), 316 unix.SYS_SIGNALFD4: makeSyscallInfo("signalfd4", Hex, Hex, Hex, Hex), 317 unix.SYS_EVENTFD2: makeSyscallInfo("eventfd2", Hex, Hex), 318 unix.SYS_EPOLL_CREATE1: makeSyscallInfo("epoll_create1", Hex), 319 unix.SYS_DUP3: makeSyscallInfo("dup3", Hex, Hex, Hex), 320 unix.SYS_PIPE2: makeSyscallInfo("pipe2", PipeFDs, Hex), 321 unix.SYS_INOTIFY_INIT1: makeSyscallInfo("inotify_init1", Hex), 322 unix.SYS_PREADV: makeSyscallInfo("preadv", Hex, ReadIOVec, Hex, Hex), 323 unix.SYS_PWRITEV: makeSyscallInfo("pwritev", Hex, WriteIOVec, Hex, Hex), 324 unix.SYS_RT_TGSIGQUEUEINFO: makeSyscallInfo("rt_tgsigqueueinfo", Hex, Hex, Hex, Hex), 325 unix.SYS_PERF_EVENT_OPEN: makeSyscallInfo("perf_event_open", Hex, Hex, Hex, Hex, Hex), 326 unix.SYS_RECVMMSG: makeSyscallInfo("recvmmsg", Hex, Hex, Hex, Hex, Hex), 327 unix.SYS_FANOTIFY_INIT: makeSyscallInfo("fanotify_init", Hex, Hex), 328 unix.SYS_FANOTIFY_MARK: makeSyscallInfo("fanotify_mark", Hex, Hex, Hex, Hex, Hex), 329 unix.SYS_PRLIMIT64: makeSyscallInfo("prlimit64", Hex, Hex, Hex, Hex), 330 unix.SYS_NAME_TO_HANDLE_AT: makeSyscallInfo("name_to_handle_at", Hex, Hex, Hex, Hex, Hex), 331 unix.SYS_OPEN_BY_HANDLE_AT: makeSyscallInfo("open_by_handle_at", Hex, Hex, Hex), 332 unix.SYS_CLOCK_ADJTIME: makeSyscallInfo("clock_adjtime", Hex, Hex), 333 unix.SYS_SYNCFS: makeSyscallInfo("syncfs", Hex), 334 unix.SYS_SENDMMSG: makeSyscallInfo("sendmmsg", Hex, Hex, Hex, Hex), 335 unix.SYS_SETNS: makeSyscallInfo("setns", Hex, Hex), 336 unix.SYS_GETCPU: makeSyscallInfo("getcpu", Hex, Hex, Hex), 337 unix.SYS_PROCESS_VM_READV: makeSyscallInfo("process_vm_readv", Hex, ReadIOVec, Hex, IOVec, Hex, Hex), 338 unix.SYS_PROCESS_VM_WRITEV: makeSyscallInfo("process_vm_writev", Hex, IOVec, Hex, WriteIOVec, Hex, Hex), 339 unix.SYS_KCMP: makeSyscallInfo("kcmp", Hex, Hex, Hex, Hex, Hex), 340 unix.SYS_FINIT_MODULE: makeSyscallInfo("finit_module", Hex, Hex, Hex), 341 unix.SYS_SCHED_SETATTR: makeSyscallInfo("sched_setattr", Hex, Hex, Hex), 342 unix.SYS_SCHED_GETATTR: makeSyscallInfo("sched_getattr", Hex, Hex, Hex), 343 unix.SYS_RENAMEAT2: makeSyscallInfo("renameat2", Hex, Path, Hex, Path, Hex), 344 unix.SYS_SECCOMP: makeSyscallInfo("seccomp", Hex, Hex, Hex), 345 } 346 347 // FillArgs pulls the correct registers to populate system call arguments 348 // and the system call number into a TraceRecord. Note that the system 349 // call number is not technically an argument. This is good, in a sense, 350 // since it makes the function arguments end up in "the right place" 351 // from the point of view of the caller. The performance improvement is 352 // negligible, as you can see by a look at the GNU runtime. 353 func (s *SyscallEvent) FillArgs() { 354 s.Args = SyscallArguments{ 355 {uintptr(s.Regs.Rdi)}, 356 {uintptr(s.Regs.Rsi)}, 357 {uintptr(s.Regs.Rdx)}, 358 {uintptr(s.Regs.R10)}, 359 {uintptr(s.Regs.R8)}, 360 {uintptr(s.Regs.R9)}} 361 s.Sysno = int(uint32(s.Regs.Orig_rax)) 362 } 363 364 // FillRet fills the TraceRecord with the result values from the registers. 365 func (s *SyscallEvent) FillRet() { 366 s.Ret = [2]SyscallArgument{{uintptr(s.Regs.Rax)}, {uintptr(s.Regs.Rdx)}} 367 if errno := int(s.Regs.Rax); errno < 0 { 368 s.Errno = unix.Errno(-errno) 369 } 370 } 371 372 // Signal table (taken from Go runtime, but adding all-caps signal names) 373 var signals = [...]string{ 374 unix.SIGHUP: "SIGHUP (hangup)", 375 unix.SIGINT: "SIGINT (interrupt)", 376 unix.SIGQUIT: "SIGQUIT (quit)", 377 unix.SIGILL: "SIGILL (illegal instruction)", 378 unix.SIGTRAP: "SIGTRAP (trace/breakpoint trap)", 379 unix.SIGABRT: "SIGABRT (aborted)", 380 unix.SIGBUS: "SIGBUS (bus error)", 381 unix.SIGFPE: "SIGFPE (floating point exception)", 382 unix.SIGKILL: "SIGKILL (killed)", 383 unix.SIGUSR1: "SIGUSR1 (user defined signal 1)", 384 unix.SIGSEGV: "SIGSEGV (segmentation fault)", 385 unix.SIGUSR2: "SIGUSR2 (user defined signal 2)", 386 unix.SIGPIPE: "SIGPIPE (broken pipe)", 387 unix.SIGALRM: "SIGALRM (alarm clock)", 388 unix.SIGTERM: "SIGTERM (terminated)", 389 16: "SIGSTKFLT (stack fault)", 390 17: "SIGCHLD (child exited)", 391 18: "SIGCONT (continued)", 392 19: "SIGSTOP (stopped)", 393 20: "SIGTSTP (stopped)", 394 21: "SIGTTIN (stopped - tty input)", 395 22: "SIGTTOU (stopped - tty output)", 396 23: "SIGURG (urgent I/O condition)", 397 24: "SIGXCPU (CPU time limit exceeded)", 398 25: "SIGXFSZ (file size limit exceeded)", 399 26: "SIGVTALRM (virtual timer expired)", 400 27: "SIGPROF (profiling timer expired)", 401 28: "SIGWINCH (window changed)", 402 29: "SIGPOLL (I/O possible)", 403 30: "SIGPWR (power failure)", 404 31: "SIGSYS (bad system call)", 405 }