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