sys_ni.c 8.81 KB
Newer Older
1
// SPDX-License-Identifier: GPL-2.0
Linus Torvalds's avatar
Linus Torvalds committed
2 3 4 5 6 7

#include <linux/linkage.h>
#include <linux/errno.h>

#include <asm/unistd.h>

8 9 10 11 12
#ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER
/* Architectures may override COND_SYSCALL and COND_SYSCALL_COMPAT */
#include <asm/syscall_wrapper.h>
#endif /* CONFIG_ARCH_HAS_SYSCALL_WRAPPER */

13 14 15 16
/*  we can't #include <linux/syscalls.h> here,
    but tell gcc to not warn with -Wmissing-prototypes  */
asmlinkage long sys_ni_syscall(void);

Linus Torvalds's avatar
Linus Torvalds committed
17 18 19 20 21 22 23 24
/*
 * Non-implemented system calls get redirected here.
 */
asmlinkage long sys_ni_syscall(void)
{
	return -ENOSYS;
}

25
#ifndef COND_SYSCALL
26
#define COND_SYSCALL(name) cond_syscall(sys_##name)
27 28 29
#endif /* COND_SYSCALL */

#ifndef COND_SYSCALL_COMPAT
30
#define COND_SYSCALL_COMPAT(name) cond_syscall(compat_sys_##name)
31
#endif /* COND_SYSCALL_COMPAT */
32

33 34 35 36 37 38
/*
 * This list is kept in the same order as include/uapi/asm-generic/unistd.h.
 * Architecture specific entries go below, followed by deprecated or obsolete
 * system calls.
 */

39 40 41 42 43 44 45
COND_SYSCALL(io_setup);
COND_SYSCALL_COMPAT(io_setup);
COND_SYSCALL(io_destroy);
COND_SYSCALL(io_submit);
COND_SYSCALL_COMPAT(io_submit);
COND_SYSCALL(io_cancel);
COND_SYSCALL(io_getevents);
46
COND_SYSCALL(io_pgetevents);
47
COND_SYSCALL_COMPAT(io_getevents);
48
COND_SYSCALL_COMPAT(io_pgetevents);
49 50 51 52 53 54

/* fs/xattr.c */

/* fs/dcache.c */

/* fs/cookies.c */
55 56
COND_SYSCALL(lookup_dcookie);
COND_SYSCALL_COMPAT(lookup_dcookie);
57 58

/* fs/eventfd.c */
59
COND_SYSCALL(eventfd2);
60 61

/* fs/eventfd.c */
62 63 64 65
COND_SYSCALL(epoll_create1);
COND_SYSCALL(epoll_ctl);
COND_SYSCALL(epoll_pwait);
COND_SYSCALL_COMPAT(epoll_pwait);
66 67 68 69

/* fs/fcntl.c */

/* fs/inotify_user.c */
70 71 72
COND_SYSCALL(inotify_init1);
COND_SYSCALL(inotify_add_watch);
COND_SYSCALL(inotify_rm_watch);
73 74 75 76

/* fs/ioctl.c */

/* fs/ioprio.c */
77 78
COND_SYSCALL(ioprio_set);
COND_SYSCALL(ioprio_get);
79 80

/* fs/locks.c */
81
COND_SYSCALL(flock);
82 83 84 85 86 87 88 89 90 91 92 93

/* fs/namei.c */

/* fs/namespace.c */

/* fs/nfsctl.c */

/* fs/open.c */

/* fs/pipe.c */

/* fs/quota.c */
94
COND_SYSCALL(quotactl);
95 96 97 98 99 100 101 102 103 104

/* fs/readdir.c */

/* fs/read_write.c */

/* fs/sendfile.c */

/* fs/select.c */

/* fs/signalfd.c */
105 106
COND_SYSCALL(signalfd4);
COND_SYSCALL_COMPAT(signalfd4);
107 108 109 110 111 112 113 114

/* fs/splice.c */

/* fs/stat.c */

/* fs/sync.c */

/* fs/timerfd.c */
115 116 117 118 119
COND_SYSCALL(timerfd_create);
COND_SYSCALL(timerfd_settime);
COND_SYSCALL_COMPAT(timerfd_settime);
COND_SYSCALL(timerfd_gettime);
COND_SYSCALL_COMPAT(timerfd_gettime);
120 121 122 123

/* fs/utimes.c */

/* kernel/acct.c */
124
COND_SYSCALL(acct);
125 126

/* kernel/capability.c */
127 128
COND_SYSCALL(capget);
COND_SYSCALL(capset);
129 130 131 132 133 134 135 136

/* kernel/exec_domain.c */

/* kernel/exit.c */

/* kernel/fork.c */

/* kernel/futex.c */
137 138 139 140 141 142
COND_SYSCALL(futex);
COND_SYSCALL_COMPAT(futex);
COND_SYSCALL(set_robust_list);
COND_SYSCALL_COMPAT(set_robust_list);
COND_SYSCALL(get_robust_list);
COND_SYSCALL_COMPAT(get_robust_list);
143 144 145 146 147 148

/* kernel/hrtimer.c */

/* kernel/itimer.c */

/* kernel/kexec.c */
149 150
COND_SYSCALL(kexec_load);
COND_SYSCALL_COMPAT(kexec_load);
151 152

/* kernel/module.c */
153 154
COND_SYSCALL(init_module);
COND_SYSCALL(delete_module);
155 156 157 158

/* kernel/posix-timers.c */

/* kernel/printk.c */
159
COND_SYSCALL(syslog);
160 161 162 163 164 165 166 167

/* kernel/ptrace.c */

/* kernel/sched/core.c */

/* kernel/signal.c */

/* kernel/sys.c */
168 169 170 171 172 173 174 175 176 177 178 179
COND_SYSCALL(setregid);
COND_SYSCALL(setgid);
COND_SYSCALL(setreuid);
COND_SYSCALL(setuid);
COND_SYSCALL(setresuid);
COND_SYSCALL(getresuid);
COND_SYSCALL(setresgid);
COND_SYSCALL(getresgid);
COND_SYSCALL(setfsuid);
COND_SYSCALL(setfsgid);
COND_SYSCALL(setgroups);
COND_SYSCALL(getgroups);
180 181 182 183 184 185

/* kernel/time.c */

/* kernel/timer.c */

/* ipc/mqueue.c */
186 187 188 189 190 191 192 193 194 195 196
COND_SYSCALL(mq_open);
COND_SYSCALL_COMPAT(mq_open);
COND_SYSCALL(mq_unlink);
COND_SYSCALL(mq_timedsend);
COND_SYSCALL_COMPAT(mq_timedsend);
COND_SYSCALL(mq_timedreceive);
COND_SYSCALL_COMPAT(mq_timedreceive);
COND_SYSCALL(mq_notify);
COND_SYSCALL_COMPAT(mq_notify);
COND_SYSCALL(mq_getsetattr);
COND_SYSCALL_COMPAT(mq_getsetattr);
197 198

/* ipc/msg.c */
199 200 201 202 203 204 205
COND_SYSCALL(msgget);
COND_SYSCALL(msgctl);
COND_SYSCALL_COMPAT(msgctl);
COND_SYSCALL(msgrcv);
COND_SYSCALL_COMPAT(msgrcv);
COND_SYSCALL(msgsnd);
COND_SYSCALL_COMPAT(msgsnd);
206 207

/* ipc/sem.c */
208 209 210 211 212 213
COND_SYSCALL(semget);
COND_SYSCALL(semctl);
COND_SYSCALL_COMPAT(semctl);
COND_SYSCALL(semtimedop);
COND_SYSCALL_COMPAT(semtimedop);
COND_SYSCALL(semop);
214 215

/* ipc/shm.c */
216 217 218 219 220 221
COND_SYSCALL(shmget);
COND_SYSCALL(shmctl);
COND_SYSCALL_COMPAT(shmctl);
COND_SYSCALL(shmat);
COND_SYSCALL_COMPAT(shmat);
COND_SYSCALL(shmdt);
222 223

/* net/socket.c */
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
COND_SYSCALL(socket);
COND_SYSCALL(socketpair);
COND_SYSCALL(bind);
COND_SYSCALL(listen);
COND_SYSCALL(accept);
COND_SYSCALL(connect);
COND_SYSCALL(getsockname);
COND_SYSCALL(getpeername);
COND_SYSCALL(setsockopt);
COND_SYSCALL_COMPAT(setsockopt);
COND_SYSCALL(getsockopt);
COND_SYSCALL_COMPAT(getsockopt);
COND_SYSCALL(sendto);
COND_SYSCALL(shutdown);
COND_SYSCALL(recvfrom);
COND_SYSCALL_COMPAT(recvfrom);
COND_SYSCALL(sendmsg);
COND_SYSCALL_COMPAT(sendmsg);
COND_SYSCALL(recvmsg);
COND_SYSCALL_COMPAT(recvmsg);
244 245 246 247

/* mm/filemap.c */

/* mm/nommu.c, also with MMU */
248
COND_SYSCALL(mremap);
249 250

/* security/keys/keyctl.c */
251 252 253 254
COND_SYSCALL(add_key);
COND_SYSCALL(request_key);
COND_SYSCALL(keyctl);
COND_SYSCALL_COMPAT(keyctl);
Linus Torvalds's avatar
Linus Torvalds committed
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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
COND_SYSCALL(swapon);
COND_SYSCALL(swapoff);
COND_SYSCALL(mprotect);
COND_SYSCALL(msync);
COND_SYSCALL(mlock);
COND_SYSCALL(munlock);
COND_SYSCALL(mlockall);
COND_SYSCALL(munlockall);
COND_SYSCALL(mincore);
COND_SYSCALL(madvise);
COND_SYSCALL(remap_file_pages);
COND_SYSCALL(mbind);
COND_SYSCALL_COMPAT(mbind);
COND_SYSCALL(get_mempolicy);
COND_SYSCALL_COMPAT(get_mempolicy);
COND_SYSCALL(set_mempolicy);
COND_SYSCALL_COMPAT(set_mempolicy);
COND_SYSCALL(migrate_pages);
COND_SYSCALL_COMPAT(migrate_pages);
COND_SYSCALL(move_pages);
COND_SYSCALL_COMPAT(move_pages);

COND_SYSCALL(perf_event_open);
COND_SYSCALL(accept4);
COND_SYSCALL(recvmmsg);
COND_SYSCALL_COMPAT(recvmmsg);
288 289 290 291

/*
 * Architecture specific syscalls: see further below
 */
292

293
/* fanotify */
294 295
COND_SYSCALL(fanotify_init);
COND_SYSCALL(fanotify_mark);
296 297

/* open by handle */
298 299 300
COND_SYSCALL(name_to_handle_at);
COND_SYSCALL(open_by_handle_at);
COND_SYSCALL_COMPAT(open_by_handle_at);
301

302 303 304 305 306 307
COND_SYSCALL(sendmmsg);
COND_SYSCALL_COMPAT(sendmmsg);
COND_SYSCALL(process_vm_readv);
COND_SYSCALL_COMPAT(process_vm_readv);
COND_SYSCALL(process_vm_writev);
COND_SYSCALL_COMPAT(process_vm_writev);
308

309
/* compare kernel pointers */
310
COND_SYSCALL(kcmp);
311

312
COND_SYSCALL(finit_module);
313

314
/* operate on Secure Computing state */
315
COND_SYSCALL(seccomp);
316

317
COND_SYSCALL(memfd_create);
318

319
/* access BPF programs and maps */
320
COND_SYSCALL(bpf);
321 322

/* execveat */
323
COND_SYSCALL(execveat);
324

325
COND_SYSCALL(userfaultfd);
326

327
/* membarrier */
328
COND_SYSCALL(membarrier);
329

330
COND_SYSCALL(mlock2);
331

332
COND_SYSCALL(copy_file_range);
333

334
/* memory protection keys */
335 336 337
COND_SYSCALL(pkey_mprotect);
COND_SYSCALL(pkey_alloc);
COND_SYSCALL(pkey_free);
338 339 340 341 342 343 344


/*
 * Architecture specific weak syscall entries.
 */

/* pciconfig: alpha, arm, arm64, ia64, sparc */
345 346 347
COND_SYSCALL(pciconfig_read);
COND_SYSCALL(pciconfig_write);
COND_SYSCALL(pciconfig_iobase);
348 349

/* sys_socketcall: arm, mips, x86, ... */
350 351
COND_SYSCALL(socketcall);
COND_SYSCALL_COMPAT(socketcall);
352 353

/* compat syscalls for arm64, x86, ... */
354 355
COND_SYSCALL_COMPAT(sysctl);
COND_SYSCALL_COMPAT(fanotify_mark);
356 357

/* x86 */
358 359 360 361 362
COND_SYSCALL(vm86old);
COND_SYSCALL(modify_ldt);
COND_SYSCALL_COMPAT(quotactl32);
COND_SYSCALL(vm86);
COND_SYSCALL(kexec_file_load);
363 364

/* s390 */
365 366 367
COND_SYSCALL(s390_pci_mmio_read);
COND_SYSCALL(s390_pci_mmio_write);
COND_SYSCALL_COMPAT(s390_ipc);
368 369

/* powerpc */
370
COND_SYSCALL(rtas);
371 372 373
COND_SYSCALL(spu_run);
COND_SYSCALL(spu_create);
COND_SYSCALL(subpage_prot);
374 375 376 377 378 379 380 381


/*
 * Deprecated system calls which are still defined in
 * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch
 */

/* __ARCH_WANT_SYSCALL_NO_FLAGS */
382 383 384 385 386
COND_SYSCALL(epoll_create);
COND_SYSCALL(inotify_init);
COND_SYSCALL(eventfd);
COND_SYSCALL(signalfd);
COND_SYSCALL_COMPAT(signalfd);
387 388

/* __ARCH_WANT_SYSCALL_OFF_T */
389
COND_SYSCALL(fadvise64);
390 391

/* __ARCH_WANT_SYSCALL_DEPRECATED */
392 393 394 395 396 397
COND_SYSCALL(epoll_wait);
COND_SYSCALL(recv);
COND_SYSCALL_COMPAT(recv);
COND_SYSCALL(send);
COND_SYSCALL(bdflush);
COND_SYSCALL(uselib);
398 399 400 401 402 403 404


/*
 * The syscalls below are not found in include/uapi/asm-generic/unistd.h
 */

/* obsolete: SGETMASK_SYSCALL */
405 406
COND_SYSCALL(sgetmask);
COND_SYSCALL(ssetmask);
407 408

/* obsolete: SYSFS_SYSCALL */
409
COND_SYSCALL(sysfs);
410 411

/* obsolete: __ARCH_WANT_SYS_IPC */
412 413
COND_SYSCALL(ipc);
COND_SYSCALL_COMPAT(ipc);
414 415

/* obsolete: UID16 */
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
COND_SYSCALL(chown16);
COND_SYSCALL(fchown16);
COND_SYSCALL(getegid16);
COND_SYSCALL(geteuid16);
COND_SYSCALL(getgid16);
COND_SYSCALL(getgroups16);
COND_SYSCALL(getresgid16);
COND_SYSCALL(getresuid16);
COND_SYSCALL(getuid16);
COND_SYSCALL(lchown16);
COND_SYSCALL(setfsgid16);
COND_SYSCALL(setfsuid16);
COND_SYSCALL(setgid16);
COND_SYSCALL(setgroups16);
COND_SYSCALL(setregid16);
COND_SYSCALL(setresgid16);
COND_SYSCALL(setresuid16);
COND_SYSCALL(setreuid16);
COND_SYSCALL(setuid16);
435 436 437

/* restartable sequence */
COND_SYSCALL(rseq);