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