1 // SPDX-License-Identifier: GPL-2.0 2 3 #include <linux/linkage.h> 4 #include <linux/errno.h> 5 6 #include <asm/unistd.h> 7 8 /* we can't #include <linux/syscalls.h> here, 9 but tell gcc to not warn with -Wmissing-prototypes */ 10 asmlinkage long sys_ni_syscall(void); 11 12 /* 13 * Non-implemented system calls get redirected here. 14 */ 15 asmlinkage long sys_ni_syscall(void) 16 { 17 return -ENOSYS; 18 } 19 20 #define COND_SYSCALL(name) cond_syscall(sys_##name) 21 #define COND_SYSCALL_COMPAT(name) cond_syscall(compat_sys_##name) 22 23 /* 24 * This list is kept in the same order as include/uapi/asm-generic/unistd.h. 25 * Architecture specific entries go below, followed by deprecated or obsolete 26 * system calls. 27 */ 28 29 COND_SYSCALL(io_setup); 30 COND_SYSCALL_COMPAT(io_setup); 31 COND_SYSCALL(io_destroy); 32 COND_SYSCALL(io_submit); 33 COND_SYSCALL_COMPAT(io_submit); 34 COND_SYSCALL(io_cancel); 35 COND_SYSCALL(io_getevents); 36 COND_SYSCALL_COMPAT(io_getevents); 37 38 /* fs/xattr.c */ 39 40 /* fs/dcache.c */ 41 42 /* fs/cookies.c */ 43 COND_SYSCALL(lookup_dcookie); 44 COND_SYSCALL_COMPAT(lookup_dcookie); 45 46 /* fs/eventfd.c */ 47 COND_SYSCALL(eventfd2); 48 49 /* fs/eventfd.c */ 50 COND_SYSCALL(epoll_create1); 51 COND_SYSCALL(epoll_ctl); 52 COND_SYSCALL(epoll_pwait); 53 COND_SYSCALL_COMPAT(epoll_pwait); 54 55 /* fs/fcntl.c */ 56 57 /* fs/inotify_user.c */ 58 COND_SYSCALL(inotify_init1); 59 COND_SYSCALL(inotify_add_watch); 60 COND_SYSCALL(inotify_rm_watch); 61 62 /* fs/ioctl.c */ 63 64 /* fs/ioprio.c */ 65 COND_SYSCALL(ioprio_set); 66 COND_SYSCALL(ioprio_get); 67 68 /* fs/locks.c */ 69 COND_SYSCALL(flock); 70 71 /* fs/namei.c */ 72 73 /* fs/namespace.c */ 74 75 /* fs/nfsctl.c */ 76 77 /* fs/open.c */ 78 79 /* fs/pipe.c */ 80 81 /* fs/quota.c */ 82 COND_SYSCALL(quotactl); 83 84 /* fs/readdir.c */ 85 86 /* fs/read_write.c */ 87 88 /* fs/sendfile.c */ 89 90 /* fs/select.c */ 91 92 /* fs/signalfd.c */ 93 COND_SYSCALL(signalfd4); 94 COND_SYSCALL_COMPAT(signalfd4); 95 96 /* fs/splice.c */ 97 98 /* fs/stat.c */ 99 100 /* fs/sync.c */ 101 102 /* fs/timerfd.c */ 103 COND_SYSCALL(timerfd_create); 104 COND_SYSCALL(timerfd_settime); 105 COND_SYSCALL_COMPAT(timerfd_settime); 106 COND_SYSCALL(timerfd_gettime); 107 COND_SYSCALL_COMPAT(timerfd_gettime); 108 109 /* fs/utimes.c */ 110 111 /* kernel/acct.c */ 112 COND_SYSCALL(acct); 113 114 /* kernel/capability.c */ 115 COND_SYSCALL(capget); 116 COND_SYSCALL(capset); 117 118 /* kernel/exec_domain.c */ 119 120 /* kernel/exit.c */ 121 122 /* kernel/fork.c */ 123 124 /* kernel/futex.c */ 125 COND_SYSCALL(futex); 126 COND_SYSCALL_COMPAT(futex); 127 COND_SYSCALL(set_robust_list); 128 COND_SYSCALL_COMPAT(set_robust_list); 129 COND_SYSCALL(get_robust_list); 130 COND_SYSCALL_COMPAT(get_robust_list); 131 132 /* kernel/hrtimer.c */ 133 134 /* kernel/itimer.c */ 135 136 /* kernel/kexec.c */ 137 COND_SYSCALL(kexec_load); 138 COND_SYSCALL_COMPAT(kexec_load); 139 140 /* kernel/module.c */ 141 COND_SYSCALL(init_module); 142 COND_SYSCALL(delete_module); 143 144 /* kernel/posix-timers.c */ 145 146 /* kernel/printk.c */ 147 COND_SYSCALL(syslog); 148 149 /* kernel/ptrace.c */ 150 151 /* kernel/sched/core.c */ 152 153 /* kernel/signal.c */ 154 155 /* kernel/sys.c */ 156 COND_SYSCALL(setregid); 157 COND_SYSCALL(setgid); 158 COND_SYSCALL(setreuid); 159 COND_SYSCALL(setuid); 160 COND_SYSCALL(setresuid); 161 COND_SYSCALL(getresuid); 162 COND_SYSCALL(setresgid); 163 COND_SYSCALL(getresgid); 164 COND_SYSCALL(setfsuid); 165 COND_SYSCALL(setfsgid); 166 COND_SYSCALL(setgroups); 167 COND_SYSCALL(getgroups); 168 169 /* kernel/time.c */ 170 171 /* kernel/timer.c */ 172 173 /* ipc/mqueue.c */ 174 COND_SYSCALL(mq_open); 175 COND_SYSCALL_COMPAT(mq_open); 176 COND_SYSCALL(mq_unlink); 177 COND_SYSCALL(mq_timedsend); 178 COND_SYSCALL_COMPAT(mq_timedsend); 179 COND_SYSCALL(mq_timedreceive); 180 COND_SYSCALL_COMPAT(mq_timedreceive); 181 COND_SYSCALL(mq_notify); 182 COND_SYSCALL_COMPAT(mq_notify); 183 COND_SYSCALL(mq_getsetattr); 184 COND_SYSCALL_COMPAT(mq_getsetattr); 185 186 /* ipc/msg.c */ 187 COND_SYSCALL(msgget); 188 COND_SYSCALL(msgctl); 189 COND_SYSCALL_COMPAT(msgctl); 190 COND_SYSCALL(msgrcv); 191 COND_SYSCALL_COMPAT(msgrcv); 192 COND_SYSCALL(msgsnd); 193 COND_SYSCALL_COMPAT(msgsnd); 194 195 /* ipc/sem.c */ 196 COND_SYSCALL(semget); 197 COND_SYSCALL(semctl); 198 COND_SYSCALL_COMPAT(semctl); 199 COND_SYSCALL(semtimedop); 200 COND_SYSCALL_COMPAT(semtimedop); 201 COND_SYSCALL(semop); 202 203 /* ipc/shm.c */ 204 COND_SYSCALL(shmget); 205 COND_SYSCALL(shmctl); 206 COND_SYSCALL_COMPAT(shmctl); 207 COND_SYSCALL(shmat); 208 COND_SYSCALL_COMPAT(shmat); 209 COND_SYSCALL(shmdt); 210 211 /* net/socket.c */ 212 COND_SYSCALL(socket); 213 COND_SYSCALL(socketpair); 214 COND_SYSCALL(bind); 215 COND_SYSCALL(listen); 216 COND_SYSCALL(accept); 217 COND_SYSCALL(connect); 218 COND_SYSCALL(getsockname); 219 COND_SYSCALL(getpeername); 220 COND_SYSCALL(setsockopt); 221 COND_SYSCALL_COMPAT(setsockopt); 222 COND_SYSCALL(getsockopt); 223 COND_SYSCALL_COMPAT(getsockopt); 224 COND_SYSCALL(sendto); 225 COND_SYSCALL(shutdown); 226 COND_SYSCALL(recvfrom); 227 COND_SYSCALL_COMPAT(recvfrom); 228 COND_SYSCALL(sendmsg); 229 COND_SYSCALL_COMPAT(sendmsg); 230 COND_SYSCALL(recvmsg); 231 COND_SYSCALL_COMPAT(recvmsg); 232 233 /* mm/filemap.c */ 234 235 /* mm/nommu.c, also with MMU */ 236 COND_SYSCALL(mremap); 237 238 /* security/keys/keyctl.c */ 239 COND_SYSCALL(add_key); 240 COND_SYSCALL(request_key); 241 COND_SYSCALL(keyctl); 242 COND_SYSCALL_COMPAT(keyctl); 243 244 /* arch/example/kernel/sys_example.c */ 245 246 /* mm/fadvise.c */ 247 COND_SYSCALL(fadvise64_64); 248 249 /* mm/, CONFIG_MMU only */ 250 COND_SYSCALL(swapon); 251 COND_SYSCALL(swapoff); 252 COND_SYSCALL(mprotect); 253 COND_SYSCALL(msync); 254 COND_SYSCALL(mlock); 255 COND_SYSCALL(munlock); 256 COND_SYSCALL(mlockall); 257 COND_SYSCALL(munlockall); 258 COND_SYSCALL(mincore); 259 COND_SYSCALL(madvise); 260 COND_SYSCALL(remap_file_pages); 261 COND_SYSCALL(mbind); 262 COND_SYSCALL_COMPAT(mbind); 263 COND_SYSCALL(get_mempolicy); 264 COND_SYSCALL_COMPAT(get_mempolicy); 265 COND_SYSCALL(set_mempolicy); 266 COND_SYSCALL_COMPAT(set_mempolicy); 267 COND_SYSCALL(migrate_pages); 268 COND_SYSCALL_COMPAT(migrate_pages); 269 COND_SYSCALL(move_pages); 270 COND_SYSCALL_COMPAT(move_pages); 271 272 COND_SYSCALL(perf_event_open); 273 COND_SYSCALL(accept4); 274 COND_SYSCALL(recvmmsg); 275 COND_SYSCALL_COMPAT(recvmmsg); 276 277 /* 278 * Architecture specific syscalls: see further below 279 */ 280 281 /* fanotify */ 282 COND_SYSCALL(fanotify_init); 283 COND_SYSCALL(fanotify_mark); 284 285 /* open by handle */ 286 COND_SYSCALL(name_to_handle_at); 287 COND_SYSCALL(open_by_handle_at); 288 COND_SYSCALL_COMPAT(open_by_handle_at); 289 290 COND_SYSCALL(sendmmsg); 291 COND_SYSCALL_COMPAT(sendmmsg); 292 COND_SYSCALL(process_vm_readv); 293 COND_SYSCALL_COMPAT(process_vm_readv); 294 COND_SYSCALL(process_vm_writev); 295 COND_SYSCALL_COMPAT(process_vm_writev); 296 297 /* compare kernel pointers */ 298 COND_SYSCALL(kcmp); 299 300 COND_SYSCALL(finit_module); 301 302 /* operate on Secure Computing state */ 303 COND_SYSCALL(seccomp); 304 305 COND_SYSCALL(memfd_create); 306 307 /* access BPF programs and maps */ 308 COND_SYSCALL(bpf); 309 310 /* execveat */ 311 COND_SYSCALL(execveat); 312 313 COND_SYSCALL(userfaultfd); 314 315 /* membarrier */ 316 COND_SYSCALL(membarrier); 317 318 COND_SYSCALL(mlock2); 319 320 COND_SYSCALL(copy_file_range); 321 322 /* memory protection keys */ 323 COND_SYSCALL(pkey_mprotect); 324 COND_SYSCALL(pkey_alloc); 325 COND_SYSCALL(pkey_free); 326 327 328 /* 329 * Architecture specific weak syscall entries. 330 */ 331 332 /* pciconfig: alpha, arm, arm64, ia64, sparc */ 333 COND_SYSCALL(pciconfig_read); 334 COND_SYSCALL(pciconfig_write); 335 COND_SYSCALL(pciconfig_iobase); 336 337 /* sys_socketcall: arm, mips, x86, ... */ 338 COND_SYSCALL(socketcall); 339 COND_SYSCALL_COMPAT(socketcall); 340 341 /* compat syscalls for arm64, x86, ... */ 342 COND_SYSCALL_COMPAT(sysctl); 343 COND_SYSCALL_COMPAT(fanotify_mark); 344 345 /* x86 */ 346 COND_SYSCALL(vm86old); 347 COND_SYSCALL(modify_ldt); 348 COND_SYSCALL_COMPAT(quotactl32); 349 COND_SYSCALL(vm86); 350 COND_SYSCALL(kexec_file_load); 351 352 /* s390 */ 353 COND_SYSCALL(s390_pci_mmio_read); 354 COND_SYSCALL(s390_pci_mmio_write); 355 COND_SYSCALL_COMPAT(s390_ipc); 356 357 /* powerpc */ 358 cond_syscall(ppc_rtas); 359 COND_SYSCALL(spu_run); 360 COND_SYSCALL(spu_create); 361 COND_SYSCALL(subpage_prot); 362 363 364 /* 365 * Deprecated system calls which are still defined in 366 * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch 367 */ 368 369 /* __ARCH_WANT_SYSCALL_NO_FLAGS */ 370 COND_SYSCALL(epoll_create); 371 COND_SYSCALL(inotify_init); 372 COND_SYSCALL(eventfd); 373 COND_SYSCALL(signalfd); 374 COND_SYSCALL_COMPAT(signalfd); 375 376 /* __ARCH_WANT_SYSCALL_OFF_T */ 377 COND_SYSCALL(fadvise64); 378 379 /* __ARCH_WANT_SYSCALL_DEPRECATED */ 380 COND_SYSCALL(epoll_wait); 381 COND_SYSCALL(recv); 382 COND_SYSCALL_COMPAT(recv); 383 COND_SYSCALL(send); 384 COND_SYSCALL(bdflush); 385 COND_SYSCALL(uselib); 386 387 388 /* 389 * The syscalls below are not found in include/uapi/asm-generic/unistd.h 390 */ 391 392 /* obsolete: SGETMASK_SYSCALL */ 393 COND_SYSCALL(sgetmask); 394 COND_SYSCALL(ssetmask); 395 396 /* obsolete: SYSFS_SYSCALL */ 397 COND_SYSCALL(sysfs); 398 399 /* obsolete: __ARCH_WANT_SYS_IPC */ 400 COND_SYSCALL(ipc); 401 COND_SYSCALL_COMPAT(ipc); 402 403 /* obsolete: UID16 */ 404 COND_SYSCALL(chown16); 405 COND_SYSCALL(fchown16); 406 COND_SYSCALL(getegid16); 407 COND_SYSCALL(geteuid16); 408 COND_SYSCALL(getgid16); 409 COND_SYSCALL(getgroups16); 410 COND_SYSCALL(getresgid16); 411 COND_SYSCALL(getresuid16); 412 COND_SYSCALL(getuid16); 413 COND_SYSCALL(lchown16); 414 COND_SYSCALL(setfsgid16); 415 COND_SYSCALL(setfsuid16); 416 COND_SYSCALL(setgid16); 417 COND_SYSCALL(setgroups16); 418 COND_SYSCALL(setregid16); 419 COND_SYSCALL(setresgid16); 420 COND_SYSCALL(setresuid16); 421 COND_SYSCALL(setreuid16); 422 COND_SYSCALL(setuid16); 423