blob: 1bb6604dc19fc5817c67dd3b22763e03eef50966 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002
3#include <linux/linkage.h>
4#include <linux/errno.h>
5
6#include <asm/unistd.h>
7
Dominik Brodowski7303e302018-04-05 11:53:03 +02008#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
Adrian Bunk0732a552007-10-16 23:29:25 -070013/* 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070017/*
18 * Non-implemented system calls get redirected here.
19 */
20asmlinkage long sys_ni_syscall(void)
21{
22 return -ENOSYS;
23}
24
Dominik Brodowski7303e302018-04-05 11:53:03 +020025#ifndef COND_SYSCALL
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010026#define COND_SYSCALL(name) cond_syscall(sys_##name)
Dominik Brodowski7303e302018-04-05 11:53:03 +020027#endif /* COND_SYSCALL */
28
29#ifndef COND_SYSCALL_COMPAT
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010030#define COND_SYSCALL_COMPAT(name) cond_syscall(compat_sys_##name)
Dominik Brodowski7303e302018-04-05 11:53:03 +020031#endif /* COND_SYSCALL_COMPAT */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010032
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010033/*
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
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010039COND_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);
Christoph Hellwig7a074e92018-05-02 19:51:00 +020046COND_SYSCALL(io_pgetevents);
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010047COND_SYSCALL_COMPAT(io_getevents);
Christoph Hellwig7a074e92018-05-02 19:51:00 +020048COND_SYSCALL_COMPAT(io_pgetevents);
Jens Axboe2b188cc2019-01-07 10:46:33 -070049COND_SYSCALL(io_uring_setup);
50COND_SYSCALL(io_uring_enter);
Jens Axboeedafcce2019-01-09 09:16:05 -070051COND_SYSCALL(io_uring_register);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010052
53/* fs/xattr.c */
54
55/* fs/dcache.c */
56
57/* fs/cookies.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010058COND_SYSCALL(lookup_dcookie);
59COND_SYSCALL_COMPAT(lookup_dcookie);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010060
61/* fs/eventfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010062COND_SYSCALL(eventfd2);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010063
64/* fs/eventfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010065COND_SYSCALL(epoll_create1);
66COND_SYSCALL(epoll_ctl);
67COND_SYSCALL(epoll_pwait);
68COND_SYSCALL_COMPAT(epoll_pwait);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010069
70/* fs/fcntl.c */
71
72/* fs/inotify_user.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010073COND_SYSCALL(inotify_init1);
74COND_SYSCALL(inotify_add_watch);
75COND_SYSCALL(inotify_rm_watch);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010076
77/* fs/ioctl.c */
78
79/* fs/ioprio.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010080COND_SYSCALL(ioprio_set);
81COND_SYSCALL(ioprio_get);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010082
83/* fs/locks.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010084COND_SYSCALL(flock);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010085
86/* fs/namei.c */
87
88/* fs/namespace.c */
89
90/* fs/nfsctl.c */
91
92/* fs/open.c */
93
94/* fs/pipe.c */
95
96/* fs/quota.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010097COND_SYSCALL(quotactl);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010098
99/* fs/readdir.c */
100
101/* fs/read_write.c */
102
103/* fs/sendfile.c */
104
105/* fs/select.c */
106
107/* fs/signalfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100108COND_SYSCALL(signalfd4);
109COND_SYSCALL_COMPAT(signalfd4);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100110
111/* fs/splice.c */
112
113/* fs/stat.c */
114
115/* fs/sync.c */
116
117/* fs/timerfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100118COND_SYSCALL(timerfd_create);
119COND_SYSCALL(timerfd_settime);
120COND_SYSCALL_COMPAT(timerfd_settime);
121COND_SYSCALL(timerfd_gettime);
122COND_SYSCALL_COMPAT(timerfd_gettime);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100123
124/* fs/utimes.c */
125
126/* kernel/acct.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100127COND_SYSCALL(acct);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100128
129/* kernel/capability.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100130COND_SYSCALL(capget);
131COND_SYSCALL(capset);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100132
133/* kernel/exec_domain.c */
134
135/* kernel/exit.c */
136
137/* kernel/fork.c */
138
139/* kernel/futex.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100140COND_SYSCALL(futex);
141COND_SYSCALL_COMPAT(futex);
142COND_SYSCALL(set_robust_list);
143COND_SYSCALL_COMPAT(set_robust_list);
144COND_SYSCALL(get_robust_list);
145COND_SYSCALL_COMPAT(get_robust_list);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100146
147/* kernel/hrtimer.c */
148
149/* kernel/itimer.c */
150
151/* kernel/kexec.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100152COND_SYSCALL(kexec_load);
153COND_SYSCALL_COMPAT(kexec_load);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100154
155/* kernel/module.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100156COND_SYSCALL(init_module);
157COND_SYSCALL(delete_module);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100158
159/* kernel/posix-timers.c */
160
161/* kernel/printk.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100162COND_SYSCALL(syslog);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100163
164/* kernel/ptrace.c */
165
166/* kernel/sched/core.c */
167
168/* kernel/signal.c */
169
170/* kernel/sys.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100171COND_SYSCALL(setregid);
172COND_SYSCALL(setgid);
173COND_SYSCALL(setreuid);
174COND_SYSCALL(setuid);
175COND_SYSCALL(setresuid);
176COND_SYSCALL(getresuid);
177COND_SYSCALL(setresgid);
178COND_SYSCALL(getresgid);
179COND_SYSCALL(setfsuid);
180COND_SYSCALL(setfsgid);
181COND_SYSCALL(setgroups);
182COND_SYSCALL(getgroups);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100183
184/* kernel/time.c */
185
186/* kernel/timer.c */
187
188/* ipc/mqueue.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100189COND_SYSCALL(mq_open);
190COND_SYSCALL_COMPAT(mq_open);
191COND_SYSCALL(mq_unlink);
192COND_SYSCALL(mq_timedsend);
193COND_SYSCALL_COMPAT(mq_timedsend);
194COND_SYSCALL(mq_timedreceive);
195COND_SYSCALL_COMPAT(mq_timedreceive);
196COND_SYSCALL(mq_notify);
197COND_SYSCALL_COMPAT(mq_notify);
198COND_SYSCALL(mq_getsetattr);
199COND_SYSCALL_COMPAT(mq_getsetattr);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100200
201/* ipc/msg.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100202COND_SYSCALL(msgget);
203COND_SYSCALL(msgctl);
204COND_SYSCALL_COMPAT(msgctl);
205COND_SYSCALL(msgrcv);
206COND_SYSCALL_COMPAT(msgrcv);
207COND_SYSCALL(msgsnd);
208COND_SYSCALL_COMPAT(msgsnd);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100209
210/* ipc/sem.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100211COND_SYSCALL(semget);
212COND_SYSCALL(semctl);
213COND_SYSCALL_COMPAT(semctl);
214COND_SYSCALL(semtimedop);
215COND_SYSCALL_COMPAT(semtimedop);
216COND_SYSCALL(semop);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100217
218/* ipc/shm.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100219COND_SYSCALL(shmget);
220COND_SYSCALL(shmctl);
221COND_SYSCALL_COMPAT(shmctl);
222COND_SYSCALL(shmat);
223COND_SYSCALL_COMPAT(shmat);
224COND_SYSCALL(shmdt);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100225
226/* net/socket.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100227COND_SYSCALL(socket);
228COND_SYSCALL(socketpair);
229COND_SYSCALL(bind);
230COND_SYSCALL(listen);
231COND_SYSCALL(accept);
232COND_SYSCALL(connect);
233COND_SYSCALL(getsockname);
234COND_SYSCALL(getpeername);
235COND_SYSCALL(setsockopt);
236COND_SYSCALL_COMPAT(setsockopt);
237COND_SYSCALL(getsockopt);
238COND_SYSCALL_COMPAT(getsockopt);
239COND_SYSCALL(sendto);
240COND_SYSCALL(shutdown);
241COND_SYSCALL(recvfrom);
242COND_SYSCALL_COMPAT(recvfrom);
243COND_SYSCALL(sendmsg);
244COND_SYSCALL_COMPAT(sendmsg);
245COND_SYSCALL(recvmsg);
246COND_SYSCALL_COMPAT(recvmsg);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100247
248/* mm/filemap.c */
249
250/* mm/nommu.c, also with MMU */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100251COND_SYSCALL(mremap);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100252
253/* security/keys/keyctl.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100254COND_SYSCALL(add_key);
255COND_SYSCALL(request_key);
256COND_SYSCALL(keyctl);
257COND_SYSCALL_COMPAT(keyctl);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100258
259/* arch/example/kernel/sys_example.c */
260
261/* mm/fadvise.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100262COND_SYSCALL(fadvise64_64);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100263
264/* mm/, CONFIG_MMU only */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100265COND_SYSCALL(swapon);
266COND_SYSCALL(swapoff);
267COND_SYSCALL(mprotect);
268COND_SYSCALL(msync);
269COND_SYSCALL(mlock);
270COND_SYSCALL(munlock);
271COND_SYSCALL(mlockall);
272COND_SYSCALL(munlockall);
273COND_SYSCALL(mincore);
274COND_SYSCALL(madvise);
275COND_SYSCALL(remap_file_pages);
276COND_SYSCALL(mbind);
277COND_SYSCALL_COMPAT(mbind);
278COND_SYSCALL(get_mempolicy);
279COND_SYSCALL_COMPAT(get_mempolicy);
280COND_SYSCALL(set_mempolicy);
281COND_SYSCALL_COMPAT(set_mempolicy);
282COND_SYSCALL(migrate_pages);
283COND_SYSCALL_COMPAT(migrate_pages);
284COND_SYSCALL(move_pages);
285COND_SYSCALL_COMPAT(move_pages);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100286
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100287COND_SYSCALL(perf_event_open);
288COND_SYSCALL(accept4);
289COND_SYSCALL(recvmmsg);
Arnd Bergmanne11d4282018-04-18 13:43:52 +0200290COND_SYSCALL(recvmmsg_time32);
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100291COND_SYSCALL_COMPAT(recvmmsg);
Arnd Bergmanne11d4282018-04-18 13:43:52 +0200292COND_SYSCALL_COMPAT(recvmmsg_time64);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100293
294/*
295 * Architecture specific syscalls: see further below
296 */
297
298/* fanotify */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100299COND_SYSCALL(fanotify_init);
300COND_SYSCALL(fanotify_mark);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100301
302/* open by handle */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100303COND_SYSCALL(name_to_handle_at);
304COND_SYSCALL(open_by_handle_at);
305COND_SYSCALL_COMPAT(open_by_handle_at);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100306
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100307COND_SYSCALL(sendmmsg);
308COND_SYSCALL_COMPAT(sendmmsg);
309COND_SYSCALL(process_vm_readv);
310COND_SYSCALL_COMPAT(process_vm_readv);
311COND_SYSCALL(process_vm_writev);
312COND_SYSCALL_COMPAT(process_vm_writev);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100313
314/* compare kernel pointers */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100315COND_SYSCALL(kcmp);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100316
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100317COND_SYSCALL(finit_module);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100318
319/* operate on Secure Computing state */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100320COND_SYSCALL(seccomp);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100321
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100322COND_SYSCALL(memfd_create);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100323
324/* access BPF programs and maps */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100325COND_SYSCALL(bpf);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100326
327/* execveat */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100328COND_SYSCALL(execveat);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100329
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100330COND_SYSCALL(userfaultfd);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100331
332/* membarrier */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100333COND_SYSCALL(membarrier);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100334
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100335COND_SYSCALL(mlock2);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100336
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100337COND_SYSCALL(copy_file_range);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100338
339/* memory protection keys */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100340COND_SYSCALL(pkey_mprotect);
341COND_SYSCALL(pkey_alloc);
342COND_SYSCALL(pkey_free);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100343
344
345/*
346 * Architecture specific weak syscall entries.
347 */
348
349/* pciconfig: alpha, arm, arm64, ia64, sparc */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100350COND_SYSCALL(pciconfig_read);
351COND_SYSCALL(pciconfig_write);
352COND_SYSCALL(pciconfig_iobase);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100353
354/* sys_socketcall: arm, mips, x86, ... */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100355COND_SYSCALL(socketcall);
356COND_SYSCALL_COMPAT(socketcall);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100357
358/* compat syscalls for arm64, x86, ... */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100359COND_SYSCALL_COMPAT(sysctl);
360COND_SYSCALL_COMPAT(fanotify_mark);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100361
362/* x86 */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100363COND_SYSCALL(vm86old);
364COND_SYSCALL(modify_ldt);
365COND_SYSCALL_COMPAT(quotactl32);
366COND_SYSCALL(vm86);
367COND_SYSCALL(kexec_file_load);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100368
369/* s390 */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100370COND_SYSCALL(s390_pci_mmio_read);
371COND_SYSCALL(s390_pci_mmio_write);
372COND_SYSCALL_COMPAT(s390_ipc);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100373
374/* powerpc */
Al Viro4c392e62018-05-02 23:20:48 +1000375COND_SYSCALL(rtas);
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100376COND_SYSCALL(spu_run);
377COND_SYSCALL(spu_create);
378COND_SYSCALL(subpage_prot);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100379
380
381/*
382 * Deprecated system calls which are still defined in
383 * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch
384 */
385
386/* __ARCH_WANT_SYSCALL_NO_FLAGS */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100387COND_SYSCALL(epoll_create);
388COND_SYSCALL(inotify_init);
389COND_SYSCALL(eventfd);
390COND_SYSCALL(signalfd);
391COND_SYSCALL_COMPAT(signalfd);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100392
393/* __ARCH_WANT_SYSCALL_OFF_T */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100394COND_SYSCALL(fadvise64);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100395
396/* __ARCH_WANT_SYSCALL_DEPRECATED */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100397COND_SYSCALL(epoll_wait);
398COND_SYSCALL(recv);
399COND_SYSCALL_COMPAT(recv);
400COND_SYSCALL(send);
401COND_SYSCALL(bdflush);
402COND_SYSCALL(uselib);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100403
404
405/*
406 * The syscalls below are not found in include/uapi/asm-generic/unistd.h
407 */
408
409/* obsolete: SGETMASK_SYSCALL */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100410COND_SYSCALL(sgetmask);
411COND_SYSCALL(ssetmask);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100412
413/* obsolete: SYSFS_SYSCALL */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100414COND_SYSCALL(sysfs);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100415
416/* obsolete: __ARCH_WANT_SYS_IPC */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100417COND_SYSCALL(ipc);
418COND_SYSCALL_COMPAT(ipc);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100419
420/* obsolete: UID16 */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100421COND_SYSCALL(chown16);
422COND_SYSCALL(fchown16);
423COND_SYSCALL(getegid16);
424COND_SYSCALL(geteuid16);
425COND_SYSCALL(getgid16);
426COND_SYSCALL(getgroups16);
427COND_SYSCALL(getresgid16);
428COND_SYSCALL(getresuid16);
429COND_SYSCALL(getuid16);
430COND_SYSCALL(lchown16);
431COND_SYSCALL(setfsgid16);
432COND_SYSCALL(setfsuid16);
433COND_SYSCALL(setgid16);
434COND_SYSCALL(setgroups16);
435COND_SYSCALL(setregid16);
436COND_SYSCALL(setresgid16);
437COND_SYSCALL(setresuid16);
438COND_SYSCALL(setreuid16);
439COND_SYSCALL(setuid16);
Mathieu Desnoyersd7822b12018-06-02 08:43:54 -0400440
441/* restartable sequence */
442COND_SYSCALL(rseq);