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