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