blob: 9791364925dc1b27ff8a086355954c925e88a70f [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);
46COND_SYSCALL_COMPAT(io_getevents);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010047
48/* fs/xattr.c */
49
50/* fs/dcache.c */
51
52/* fs/cookies.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010053COND_SYSCALL(lookup_dcookie);
54COND_SYSCALL_COMPAT(lookup_dcookie);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010055
56/* fs/eventfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010057COND_SYSCALL(eventfd2);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010058
59/* fs/eventfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010060COND_SYSCALL(epoll_create1);
61COND_SYSCALL(epoll_ctl);
62COND_SYSCALL(epoll_pwait);
63COND_SYSCALL_COMPAT(epoll_pwait);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010064
65/* fs/fcntl.c */
66
67/* fs/inotify_user.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010068COND_SYSCALL(inotify_init1);
69COND_SYSCALL(inotify_add_watch);
70COND_SYSCALL(inotify_rm_watch);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010071
72/* fs/ioctl.c */
73
74/* fs/ioprio.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010075COND_SYSCALL(ioprio_set);
76COND_SYSCALL(ioprio_get);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010077
78/* fs/locks.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010079COND_SYSCALL(flock);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010080
81/* fs/namei.c */
82
83/* fs/namespace.c */
84
85/* fs/nfsctl.c */
86
87/* fs/open.c */
88
89/* fs/pipe.c */
90
91/* fs/quota.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +010092COND_SYSCALL(quotactl);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +010093
94/* fs/readdir.c */
95
96/* fs/read_write.c */
97
98/* fs/sendfile.c */
99
100/* fs/select.c */
101
102/* fs/signalfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100103COND_SYSCALL(signalfd4);
104COND_SYSCALL_COMPAT(signalfd4);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100105
106/* fs/splice.c */
107
108/* fs/stat.c */
109
110/* fs/sync.c */
111
112/* fs/timerfd.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100113COND_SYSCALL(timerfd_create);
114COND_SYSCALL(timerfd_settime);
115COND_SYSCALL_COMPAT(timerfd_settime);
116COND_SYSCALL(timerfd_gettime);
117COND_SYSCALL_COMPAT(timerfd_gettime);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100118
119/* fs/utimes.c */
120
121/* kernel/acct.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100122COND_SYSCALL(acct);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100123
124/* kernel/capability.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100125COND_SYSCALL(capget);
126COND_SYSCALL(capset);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100127
128/* kernel/exec_domain.c */
129
130/* kernel/exit.c */
131
132/* kernel/fork.c */
133
134/* kernel/futex.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100135COND_SYSCALL(futex);
136COND_SYSCALL_COMPAT(futex);
137COND_SYSCALL(set_robust_list);
138COND_SYSCALL_COMPAT(set_robust_list);
139COND_SYSCALL(get_robust_list);
140COND_SYSCALL_COMPAT(get_robust_list);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100141
142/* kernel/hrtimer.c */
143
144/* kernel/itimer.c */
145
146/* kernel/kexec.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100147COND_SYSCALL(kexec_load);
148COND_SYSCALL_COMPAT(kexec_load);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100149
150/* kernel/module.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100151COND_SYSCALL(init_module);
152COND_SYSCALL(delete_module);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100153
154/* kernel/posix-timers.c */
155
156/* kernel/printk.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100157COND_SYSCALL(syslog);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100158
159/* kernel/ptrace.c */
160
161/* kernel/sched/core.c */
162
163/* kernel/signal.c */
164
165/* kernel/sys.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100166COND_SYSCALL(setregid);
167COND_SYSCALL(setgid);
168COND_SYSCALL(setreuid);
169COND_SYSCALL(setuid);
170COND_SYSCALL(setresuid);
171COND_SYSCALL(getresuid);
172COND_SYSCALL(setresgid);
173COND_SYSCALL(getresgid);
174COND_SYSCALL(setfsuid);
175COND_SYSCALL(setfsgid);
176COND_SYSCALL(setgroups);
177COND_SYSCALL(getgroups);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100178
179/* kernel/time.c */
180
181/* kernel/timer.c */
182
183/* ipc/mqueue.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100184COND_SYSCALL(mq_open);
185COND_SYSCALL_COMPAT(mq_open);
186COND_SYSCALL(mq_unlink);
187COND_SYSCALL(mq_timedsend);
188COND_SYSCALL_COMPAT(mq_timedsend);
189COND_SYSCALL(mq_timedreceive);
190COND_SYSCALL_COMPAT(mq_timedreceive);
191COND_SYSCALL(mq_notify);
192COND_SYSCALL_COMPAT(mq_notify);
193COND_SYSCALL(mq_getsetattr);
194COND_SYSCALL_COMPAT(mq_getsetattr);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100195
196/* ipc/msg.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100197COND_SYSCALL(msgget);
198COND_SYSCALL(msgctl);
199COND_SYSCALL_COMPAT(msgctl);
200COND_SYSCALL(msgrcv);
201COND_SYSCALL_COMPAT(msgrcv);
202COND_SYSCALL(msgsnd);
203COND_SYSCALL_COMPAT(msgsnd);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100204
205/* ipc/sem.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100206COND_SYSCALL(semget);
207COND_SYSCALL(semctl);
208COND_SYSCALL_COMPAT(semctl);
209COND_SYSCALL(semtimedop);
210COND_SYSCALL_COMPAT(semtimedop);
211COND_SYSCALL(semop);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100212
213/* ipc/shm.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100214COND_SYSCALL(shmget);
215COND_SYSCALL(shmctl);
216COND_SYSCALL_COMPAT(shmctl);
217COND_SYSCALL(shmat);
218COND_SYSCALL_COMPAT(shmat);
219COND_SYSCALL(shmdt);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100220
221/* net/socket.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100222COND_SYSCALL(socket);
223COND_SYSCALL(socketpair);
224COND_SYSCALL(bind);
225COND_SYSCALL(listen);
226COND_SYSCALL(accept);
227COND_SYSCALL(connect);
228COND_SYSCALL(getsockname);
229COND_SYSCALL(getpeername);
230COND_SYSCALL(setsockopt);
231COND_SYSCALL_COMPAT(setsockopt);
232COND_SYSCALL(getsockopt);
233COND_SYSCALL_COMPAT(getsockopt);
234COND_SYSCALL(sendto);
235COND_SYSCALL(shutdown);
236COND_SYSCALL(recvfrom);
237COND_SYSCALL_COMPAT(recvfrom);
238COND_SYSCALL(sendmsg);
239COND_SYSCALL_COMPAT(sendmsg);
240COND_SYSCALL(recvmsg);
241COND_SYSCALL_COMPAT(recvmsg);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100242
243/* mm/filemap.c */
244
245/* mm/nommu.c, also with MMU */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100246COND_SYSCALL(mremap);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100247
248/* security/keys/keyctl.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100249COND_SYSCALL(add_key);
250COND_SYSCALL(request_key);
251COND_SYSCALL(keyctl);
252COND_SYSCALL_COMPAT(keyctl);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100253
254/* arch/example/kernel/sys_example.c */
255
256/* mm/fadvise.c */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100257COND_SYSCALL(fadvise64_64);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100258
259/* mm/, CONFIG_MMU only */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100260COND_SYSCALL(swapon);
261COND_SYSCALL(swapoff);
262COND_SYSCALL(mprotect);
263COND_SYSCALL(msync);
264COND_SYSCALL(mlock);
265COND_SYSCALL(munlock);
266COND_SYSCALL(mlockall);
267COND_SYSCALL(munlockall);
268COND_SYSCALL(mincore);
269COND_SYSCALL(madvise);
270COND_SYSCALL(remap_file_pages);
271COND_SYSCALL(mbind);
272COND_SYSCALL_COMPAT(mbind);
273COND_SYSCALL(get_mempolicy);
274COND_SYSCALL_COMPAT(get_mempolicy);
275COND_SYSCALL(set_mempolicy);
276COND_SYSCALL_COMPAT(set_mempolicy);
277COND_SYSCALL(migrate_pages);
278COND_SYSCALL_COMPAT(migrate_pages);
279COND_SYSCALL(move_pages);
280COND_SYSCALL_COMPAT(move_pages);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100281
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100282COND_SYSCALL(perf_event_open);
283COND_SYSCALL(accept4);
284COND_SYSCALL(recvmmsg);
285COND_SYSCALL_COMPAT(recvmmsg);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100286
287/*
288 * Architecture specific syscalls: see further below
289 */
290
291/* fanotify */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100292COND_SYSCALL(fanotify_init);
293COND_SYSCALL(fanotify_mark);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100294
295/* open by handle */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100296COND_SYSCALL(name_to_handle_at);
297COND_SYSCALL(open_by_handle_at);
298COND_SYSCALL_COMPAT(open_by_handle_at);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100299
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100300COND_SYSCALL(sendmmsg);
301COND_SYSCALL_COMPAT(sendmmsg);
302COND_SYSCALL(process_vm_readv);
303COND_SYSCALL_COMPAT(process_vm_readv);
304COND_SYSCALL(process_vm_writev);
305COND_SYSCALL_COMPAT(process_vm_writev);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100306
307/* compare kernel pointers */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100308COND_SYSCALL(kcmp);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100309
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100310COND_SYSCALL(finit_module);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100311
312/* operate on Secure Computing state */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100313COND_SYSCALL(seccomp);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100314
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100315COND_SYSCALL(memfd_create);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100316
317/* access BPF programs and maps */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100318COND_SYSCALL(bpf);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100319
320/* execveat */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100321COND_SYSCALL(execveat);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100322
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100323COND_SYSCALL(userfaultfd);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100324
325/* membarrier */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100326COND_SYSCALL(membarrier);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100327
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100328COND_SYSCALL(mlock2);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100329
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100330COND_SYSCALL(copy_file_range);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100331
332/* memory protection keys */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100333COND_SYSCALL(pkey_mprotect);
334COND_SYSCALL(pkey_alloc);
335COND_SYSCALL(pkey_free);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100336
337
338/*
339 * Architecture specific weak syscall entries.
340 */
341
342/* pciconfig: alpha, arm, arm64, ia64, sparc */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100343COND_SYSCALL(pciconfig_read);
344COND_SYSCALL(pciconfig_write);
345COND_SYSCALL(pciconfig_iobase);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100346
347/* sys_socketcall: arm, mips, x86, ... */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100348COND_SYSCALL(socketcall);
349COND_SYSCALL_COMPAT(socketcall);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100350
351/* compat syscalls for arm64, x86, ... */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100352COND_SYSCALL_COMPAT(sysctl);
353COND_SYSCALL_COMPAT(fanotify_mark);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100354
355/* x86 */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100356COND_SYSCALL(vm86old);
357COND_SYSCALL(modify_ldt);
358COND_SYSCALL_COMPAT(quotactl32);
359COND_SYSCALL(vm86);
360COND_SYSCALL(kexec_file_load);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100361
362/* s390 */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100363COND_SYSCALL(s390_pci_mmio_read);
364COND_SYSCALL(s390_pci_mmio_write);
365COND_SYSCALL_COMPAT(s390_ipc);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100366
367/* powerpc */
368cond_syscall(ppc_rtas);
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100369COND_SYSCALL(spu_run);
370COND_SYSCALL(spu_create);
371COND_SYSCALL(subpage_prot);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100372
373
374/*
375 * Deprecated system calls which are still defined in
376 * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch
377 */
378
379/* __ARCH_WANT_SYSCALL_NO_FLAGS */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100380COND_SYSCALL(epoll_create);
381COND_SYSCALL(inotify_init);
382COND_SYSCALL(eventfd);
383COND_SYSCALL(signalfd);
384COND_SYSCALL_COMPAT(signalfd);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100385
386/* __ARCH_WANT_SYSCALL_OFF_T */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100387COND_SYSCALL(fadvise64);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100388
389/* __ARCH_WANT_SYSCALL_DEPRECATED */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100390COND_SYSCALL(epoll_wait);
391COND_SYSCALL(recv);
392COND_SYSCALL_COMPAT(recv);
393COND_SYSCALL(send);
394COND_SYSCALL(bdflush);
395COND_SYSCALL(uselib);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100396
397
398/*
399 * The syscalls below are not found in include/uapi/asm-generic/unistd.h
400 */
401
402/* obsolete: SGETMASK_SYSCALL */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100403COND_SYSCALL(sgetmask);
404COND_SYSCALL(ssetmask);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100405
406/* obsolete: SYSFS_SYSCALL */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100407COND_SYSCALL(sysfs);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100408
409/* obsolete: __ARCH_WANT_SYS_IPC */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100410COND_SYSCALL(ipc);
411COND_SYSCALL_COMPAT(ipc);
Dominik Brodowski70dd4b32018-03-06 19:53:01 +0100412
413/* obsolete: UID16 */
Dominik Brodowski67a7acd2018-03-04 19:06:35 +0100414COND_SYSCALL(chown16);
415COND_SYSCALL(fchown16);
416COND_SYSCALL(getegid16);
417COND_SYSCALL(geteuid16);
418COND_SYSCALL(getgid16);
419COND_SYSCALL(getgroups16);
420COND_SYSCALL(getresgid16);
421COND_SYSCALL(getresuid16);
422COND_SYSCALL(getuid16);
423COND_SYSCALL(lchown16);
424COND_SYSCALL(setfsgid16);
425COND_SYSCALL(setfsuid16);
426COND_SYSCALL(setgid16);
427COND_SYSCALL(setgroups16);
428COND_SYSCALL(setregid16);
429COND_SYSCALL(setresgid16);
430COND_SYSCALL(setresuid16);
431COND_SYSCALL(setreuid16);
432COND_SYSCALL(setuid16);