1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2013 Dmitry Chagin 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29 #include <sys/cdefs.h> 30 __FBSDID("$FreeBSD$"); 31 32 #include <sys/param.h> 33 #include <sys/kernel.h> 34 #include <sys/sdt.h> 35 #include <sys/systm.h> 36 #include <sys/proc.h> 37 38 /* 39 * Including linux vs linux32 here is arbitrary -- the syscall args structures 40 * (proto.h) are not dereferenced by the DUMMY stub implementations, and 41 * suitable for use by both native and compat32 entrypoints. 42 */ 43 #include <machine/../linux/linux.h> 44 #include <machine/../linux/linux_proto.h> 45 46 #include <compat/linux/linux_dtrace.h> 47 #include <compat/linux/linux_util.h> 48 49 /* DTrace init */ 50 LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); 51 52 UNIMPLEMENTED(afs_syscall); 53 UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ 54 UNIMPLEMENTED(epoll_ctl_old); 55 UNIMPLEMENTED(epoll_wait_old); 56 UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ 57 UNIMPLEMENTED(getpmsg); 58 UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ 59 UNIMPLEMENTED(putpmsg); 60 UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ 61 UNIMPLEMENTED(security); 62 UNIMPLEMENTED(vserver); 63 64 DUMMY(setfsuid); 65 DUMMY(setfsgid); 66 DUMMY(vhangup); 67 DUMMY(pivot_root); 68 DUMMY(adjtimex); 69 DUMMY(swapoff); 70 DUMMY(init_module); 71 DUMMY(delete_module); 72 DUMMY(lookup_dcookie); 73 DUMMY(remap_file_pages); 74 DUMMY(mbind); 75 DUMMY(get_mempolicy); 76 DUMMY(set_mempolicy); 77 DUMMY(kexec_load); 78 /* Linux 2.6.11: */ 79 DUMMY(add_key); 80 DUMMY(request_key); 81 DUMMY(keyctl); 82 /* Linux 2.6.13: */ 83 DUMMY(ioprio_set); 84 DUMMY(ioprio_get); 85 DUMMY(inotify_add_watch); 86 DUMMY(inotify_rm_watch); 87 /* Linux 2.6.16: */ 88 DUMMY(migrate_pages); 89 DUMMY(unshare); 90 /* Linux 2.6.17: */ 91 DUMMY(tee); 92 DUMMY(vmsplice); 93 /* Linux 2.6.18: */ 94 DUMMY(move_pages); 95 /* Linux 2.6.27: */ 96 DUMMY(signalfd4); 97 DUMMY(inotify_init1); 98 /* Linux 2.6.31: */ 99 DUMMY(perf_event_open); 100 /* Linux 2.6.36: */ 101 DUMMY(fanotify_init); 102 DUMMY(fanotify_mark); 103 /* Linux 2.6.39: */ 104 DUMMY(clock_adjtime); 105 /* Linux 3.0: */ 106 DUMMY(setns); 107 /* Linux 3.2: */ 108 DUMMY(process_vm_readv); 109 DUMMY(process_vm_writev); 110 /* Linux 3.5: */ 111 DUMMY(kcmp); 112 /* Linux 3.8: */ 113 DUMMY(finit_module); 114 DUMMY(sched_setattr); 115 DUMMY(sched_getattr); 116 /* Linux 3.17: */ 117 DUMMY(seccomp); 118 /* Linux 3.18: */ 119 DUMMY(bpf); 120 /* Linux 3.19: */ 121 DUMMY(execveat); 122 /* Linux 4.2: */ 123 DUMMY(userfaultfd); 124 /* Linux 4.3: */ 125 DUMMY(membarrier); 126 /* Linux 4.4: */ 127 DUMMY(mlock2); 128 /* Linux 4.6: */ 129 DUMMY(preadv2); 130 DUMMY(pwritev2); 131 /* Linux 4.8: */ 132 DUMMY(pkey_mprotect); 133 DUMMY(pkey_alloc); 134 DUMMY(pkey_free); 135 DUMMY(open_tree); 136 DUMMY(move_mount); 137 DUMMY(fsopen); 138 DUMMY(fsconfig); 139 DUMMY(fsmount); 140 DUMMY(fspick); 141 DUMMY(pidfd_open); 142 DUMMY(clone3); 143 DUMMY(close_range); 144 DUMMY(openat2); 145 DUMMY(pidfd_getfd); 146 DUMMY(faccessat2); 147 DUMMY(process_madvise); 148 DUMMY(epoll_pwait2); 149 DUMMY(mount_setattr); 150 /* Linux 4.11: */ 151 DUMMY(statx); 152 /* Linux 4.18: */ 153 DUMMY(io_pgetevents); 154 DUMMY(rseq); 155 /* Linux 5.0: */ 156 DUMMY(pidfd_send_signal); 157 DUMMY(io_uring_setup); 158 DUMMY(io_uring_enter); 159 DUMMY(io_uring_register); 160 161 #define DUMMY_XATTR(s) \ 162 int \ 163 linux_ ## s ## xattr( \ 164 struct thread *td, struct linux_ ## s ## xattr_args *arg) \ 165 { \ 166 \ 167 return (EOPNOTSUPP); \ 168 } 169 DUMMY_XATTR(set); 170 DUMMY_XATTR(lset); 171 DUMMY_XATTR(fset); 172 DUMMY_XATTR(get); 173 DUMMY_XATTR(lget); 174 DUMMY_XATTR(fget); 175 DUMMY_XATTR(list); 176 DUMMY_XATTR(llist); 177 DUMMY_XATTR(flist); 178 DUMMY_XATTR(remove); 179 DUMMY_XATTR(lremove); 180 DUMMY_XATTR(fremove); 181