cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

sys_ni.c (10386B)


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