blob: df556175be506902ae501f9bd2b0ddd01483c34c [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);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010049
50/* fs/xattr.c */
51
52/* fs/dcache.c */
53
54/* fs/cookies.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010055COND_SYSCALL(lookup_dcookie);
56COND_SYSCALL_COMPAT(lookup_dcookie);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010057
58/* fs/eventfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010059COND_SYSCALL(eventfd2);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010060
61/* fs/eventfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010062COND_SYSCALL(epoll_create1);
63COND_SYSCALL(epoll_ctl);
64COND_SYSCALL(epoll_pwait);
65COND_SYSCALL_COMPAT(epoll_pwait);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010066
67/* fs/fcntl.c */
68
69/* fs/inotify_user.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010070COND_SYSCALL(inotify_init1);
71COND_SYSCALL(inotify_add_watch);
72COND_SYSCALL(inotify_rm_watch);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010073
74/* fs/ioctl.c */
75
76/* fs/ioprio.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010077COND_SYSCALL(ioprio_set);
78COND_SYSCALL(ioprio_get);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010079
80/* fs/locks.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010081COND_SYSCALL(flock);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010082
83/* fs/namei.c */
84
85/* fs/namespace.c */
86
87/* fs/nfsctl.c */
88
89/* fs/open.c */
90
91/* fs/pipe.c */
92
93/* fs/quota.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010094COND_SYSCALL(quotactl);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010095
96/* fs/readdir.c */
97
98/* fs/read_write.c */
99
100/* fs/sendfile.c */
101
102/* fs/select.c */
103
104/* fs/signalfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100105COND_SYSCALL(signalfd4);
106COND_SYSCALL_COMPAT(signalfd4);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100107
108/* fs/splice.c */
109
110/* fs/stat.c */
111
112/* fs/sync.c */
113
114/* fs/timerfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100115COND_SYSCALL(timerfd_create);
116COND_SYSCALL(timerfd_settime);
117COND_SYSCALL_COMPAT(timerfd_settime);
118COND_SYSCALL(timerfd_gettime);
119COND_SYSCALL_COMPAT(timerfd_gettime);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100120
121/* fs/utimes.c */
122
123/* kernel/acct.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100124COND_SYSCALL(acct);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100125
126/* kernel/capability.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100127COND_SYSCALL(capget);
128COND_SYSCALL(capset);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100129
130/* kernel/exec_domain.c */
131
132/* kernel/exit.c */
133
134/* kernel/fork.c */
135
136/* kernel/futex.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100137COND_SYSCALL(futex);
138COND_SYSCALL_COMPAT(futex);
139COND_SYSCALL(set_robust_list);
140COND_SYSCALL_COMPAT(set_robust_list);
141COND_SYSCALL(get_robust_list);
142COND_SYSCALL_COMPAT(get_robust_list);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100143
144/* kernel/hrtimer.c */
145
146/* kernel/itimer.c */
147
148/* kernel/kexec.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100149COND_SYSCALL(kexec_load);
150COND_SYSCALL_COMPAT(kexec_load);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100151
152/* kernel/module.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100153COND_SYSCALL(init_module);
154COND_SYSCALL(delete_module);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100155
156/* kernel/posix-timers.c */
157
158/* kernel/printk.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100159COND_SYSCALL(syslog);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100160
161/* kernel/ptrace.c */
162
163/* kernel/sched/core.c */
164
165/* kernel/signal.c */
166
167/* kernel/sys.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100168COND_SYSCALL(setregid);
169COND_SYSCALL(setgid);
170COND_SYSCALL(setreuid);
171COND_SYSCALL(setuid);
172COND_SYSCALL(setresuid);
173COND_SYSCALL(getresuid);
174COND_SYSCALL(setresgid);
175COND_SYSCALL(getresgid);
176COND_SYSCALL(setfsuid);
177COND_SYSCALL(setfsgid);
178COND_SYSCALL(setgroups);
179COND_SYSCALL(getgroups);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100180
181/* kernel/time.c */
182
183/* kernel/timer.c */
184
185/* ipc/mqueue.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100186COND_SYSCALL(mq_open);
187COND_SYSCALL_COMPAT(mq_open);
188COND_SYSCALL(mq_unlink);
189COND_SYSCALL(mq_timedsend);
190COND_SYSCALL_COMPAT(mq_timedsend);
191COND_SYSCALL(mq_timedreceive);
192COND_SYSCALL_COMPAT(mq_timedreceive);
193COND_SYSCALL(mq_notify);
194COND_SYSCALL_COMPAT(mq_notify);
195COND_SYSCALL(mq_getsetattr);
196COND_SYSCALL_COMPAT(mq_getsetattr);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100197
198/* ipc/msg.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100199COND_SYSCALL(msgget);
200COND_SYSCALL(msgctl);
201COND_SYSCALL_COMPAT(msgctl);
202COND_SYSCALL(msgrcv);
203COND_SYSCALL_COMPAT(msgrcv);
204COND_SYSCALL(msgsnd);
205COND_SYSCALL_COMPAT(msgsnd);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100206
207/* ipc/sem.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100208COND_SYSCALL(semget);
209COND_SYSCALL(semctl);
210COND_SYSCALL_COMPAT(semctl);
211COND_SYSCALL(semtimedop);
212COND_SYSCALL_COMPAT(semtimedop);
213COND_SYSCALL(semop);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100214
215/* ipc/shm.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100216COND_SYSCALL(shmget);
217COND_SYSCALL(shmctl);
218COND_SYSCALL_COMPAT(shmctl);
219COND_SYSCALL(shmat);
220COND_SYSCALL_COMPAT(shmat);
221COND_SYSCALL(shmdt);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100222
223/* net/socket.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100224COND_SYSCALL(socket);
225COND_SYSCALL(socketpair);
226COND_SYSCALL(bind);
227COND_SYSCALL(listen);
228COND_SYSCALL(accept);
229COND_SYSCALL(connect);
230COND_SYSCALL(getsockname);
231COND_SYSCALL(getpeername);
232COND_SYSCALL(setsockopt);
233COND_SYSCALL_COMPAT(setsockopt);
234COND_SYSCALL(getsockopt);
235COND_SYSCALL_COMPAT(getsockopt);
236COND_SYSCALL(sendto);
237COND_SYSCALL(shutdown);
238COND_SYSCALL(recvfrom);
239COND_SYSCALL_COMPAT(recvfrom);
240COND_SYSCALL(sendmsg);
241COND_SYSCALL_COMPAT(sendmsg);
242COND_SYSCALL(recvmsg);
243COND_SYSCALL_COMPAT(recvmsg);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100244
245/* mm/filemap.c */
246
247/* mm/nommu.c, also with MMU */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100248COND_SYSCALL(mremap);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100249
250/* security/keys/keyctl.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100251COND_SYSCALL(add_key);
252COND_SYSCALL(request_key);
253COND_SYSCALL(keyctl);
254COND_SYSCALL_COMPAT(keyctl);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100255
256/* arch/example/kernel/sys_example.c */
257
258/* mm/fadvise.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100259COND_SYSCALL(fadvise64_64);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100260
261/* mm/, CONFIG_MMU only */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100262COND_SYSCALL(swapon);
263COND_SYSCALL(swapoff);
264COND_SYSCALL(mprotect);
265COND_SYSCALL(msync);
266COND_SYSCALL(mlock);
267COND_SYSCALL(munlock);
268COND_SYSCALL(mlockall);
269COND_SYSCALL(munlockall);
270COND_SYSCALL(mincore);
271COND_SYSCALL(madvise);
272COND_SYSCALL(remap_file_pages);
273COND_SYSCALL(mbind);
274COND_SYSCALL_COMPAT(mbind);
275COND_SYSCALL(get_mempolicy);
276COND_SYSCALL_COMPAT(get_mempolicy);
277COND_SYSCALL(set_mempolicy);
278COND_SYSCALL_COMPAT(set_mempolicy);
279COND_SYSCALL(migrate_pages);
280COND_SYSCALL_COMPAT(migrate_pages);
281COND_SYSCALL(move_pages);
282COND_SYSCALL_COMPAT(move_pages);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100283
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100284COND_SYSCALL(perf_event_open);
285COND_SYSCALL(accept4);
286COND_SYSCALL(recvmmsg);
287COND_SYSCALL_COMPAT(recvmmsg);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100288
289/*
290 * Architecture specific syscalls: see further below
291 */
292
293/* fanotify */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100294COND_SYSCALL(fanotify_init);
295COND_SYSCALL(fanotify_mark);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100296
297/* open by handle */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100298COND_SYSCALL(name_to_handle_at);
299COND_SYSCALL(open_by_handle_at);
300COND_SYSCALL_COMPAT(open_by_handle_at);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100301
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100302COND_SYSCALL(sendmmsg);
303COND_SYSCALL_COMPAT(sendmmsg);
304COND_SYSCALL(process_vm_readv);
305COND_SYSCALL_COMPAT(process_vm_readv);
306COND_SYSCALL(process_vm_writev);
307COND_SYSCALL_COMPAT(process_vm_writev);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100308
309/* compare kernel pointers */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100310COND_SYSCALL(kcmp);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100311
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100312COND_SYSCALL(finit_module);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100313
314/* operate on Secure Computing state */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100315COND_SYSCALL(seccomp);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100316
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100317COND_SYSCALL(memfd_create);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100318
319/* access BPF programs and maps */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100320COND_SYSCALL(bpf);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100321
322/* execveat */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100323COND_SYSCALL(execveat);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100324
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100325COND_SYSCALL(userfaultfd);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100326
327/* membarrier */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100328COND_SYSCALL(membarrier);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100329
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100330COND_SYSCALL(mlock2);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100331
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100332COND_SYSCALL(copy_file_range);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100333
334/* memory protection keys */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100335COND_SYSCALL(pkey_mprotect);
336COND_SYSCALL(pkey_alloc);
337COND_SYSCALL(pkey_free);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100338
339
340/*
341 * Architecture specific weak syscall entries.
342 */
343
344/* pciconfig: alpha, arm, arm64, ia64, sparc */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100345COND_SYSCALL(pciconfig_read);
346COND_SYSCALL(pciconfig_write);
347COND_SYSCALL(pciconfig_iobase);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100348
349/* sys_socketcall: arm, mips, x86, ... */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100350COND_SYSCALL(socketcall);
351COND_SYSCALL_COMPAT(socketcall);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100352
353/* compat syscalls for arm64, x86, ... */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100354COND_SYSCALL_COMPAT(sysctl);
355COND_SYSCALL_COMPAT(fanotify_mark);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100356
357/* x86 */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100358COND_SYSCALL(vm86old);
359COND_SYSCALL(modify_ldt);
360COND_SYSCALL_COMPAT(quotactl32);
361COND_SYSCALL(vm86);
362COND_SYSCALL(kexec_file_load);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100363
364/* s390 */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100365COND_SYSCALL(s390_pci_mmio_read);
366COND_SYSCALL(s390_pci_mmio_write);
367COND_SYSCALL_COMPAT(s390_ipc);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100368
369/* powerpc */
Al Viro4c392e62018-05-02 23:20:48 +1000370COND_SYSCALL(rtas);
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100371COND_SYSCALL(spu_run);
372COND_SYSCALL(spu_create);
373COND_SYSCALL(subpage_prot);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100374
375
376/*
377 * Deprecated system calls which are still defined in
378 * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch
379 */
380
381/* __ARCH_WANT_SYSCALL_NO_FLAGS */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100382COND_SYSCALL(epoll_create);
383COND_SYSCALL(inotify_init);
384COND_SYSCALL(eventfd);
385COND_SYSCALL(signalfd);
386COND_SYSCALL_COMPAT(signalfd);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100387
388/* __ARCH_WANT_SYSCALL_OFF_T */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100389COND_SYSCALL(fadvise64);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100390
391/* __ARCH_WANT_SYSCALL_DEPRECATED */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100392COND_SYSCALL(epoll_wait);
393COND_SYSCALL(recv);
394COND_SYSCALL_COMPAT(recv);
395COND_SYSCALL(send);
396COND_SYSCALL(bdflush);
397COND_SYSCALL(uselib);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100398
399
400/*
401 * The syscalls below are not found in include/uapi/asm-generic/unistd.h
402 */
403
404/* obsolete: SGETMASK_SYSCALL */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100405COND_SYSCALL(sgetmask);
406COND_SYSCALL(ssetmask);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100407
408/* obsolete: SYSFS_SYSCALL */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100409COND_SYSCALL(sysfs);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100410
411/* obsolete: __ARCH_WANT_SYS_IPC */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100412COND_SYSCALL(ipc);
413COND_SYSCALL_COMPAT(ipc);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100414
415/* obsolete: UID16 */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100416COND_SYSCALL(chown16);
417COND_SYSCALL(fchown16);
418COND_SYSCALL(getegid16);
419COND_SYSCALL(geteuid16);
420COND_SYSCALL(getgid16);
421COND_SYSCALL(getgroups16);
422COND_SYSCALL(getresgid16);
423COND_SYSCALL(getresuid16);
424COND_SYSCALL(getuid16);
425COND_SYSCALL(lchown16);
426COND_SYSCALL(setfsgid16);
427COND_SYSCALL(setfsuid16);
428COND_SYSCALL(setgid16);
429COND_SYSCALL(setgroups16);
430COND_SYSCALL(setregid16);
431COND_SYSCALL(setresgid16);
432COND_SYSCALL(setresuid16);
433COND_SYSCALL(setreuid16);
434COND_SYSCALL(setuid16);
Mathieu Desnoyersd7822b12018-06-02 08:43:54 -0400435
436/* restartable sequence */
437COND_SYSCALL(rseq);