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