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