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 #include <amd64/linux/linux.h> 39 #include <amd64/linux/linux_proto.h> 40 #include <compat/linux/linux_dtrace.h> 41 #include <compat/linux/linux_util.h> 42 43 /* DTrace init */ 44 LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); 45 46 UNIMPLEMENTED(afs_syscall); 47 UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ 48 UNIMPLEMENTED(epoll_ctl_old); 49 UNIMPLEMENTED(epoll_wait_old); 50 UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ 51 UNIMPLEMENTED(get_thread_area); 52 UNIMPLEMENTED(getpmsg); 53 UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ 54 UNIMPLEMENTED(putpmsg); 55 UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ 56 UNIMPLEMENTED(security); 57 UNIMPLEMENTED(set_thread_area); 58 UNIMPLEMENTED(tuxcall); 59 UNIMPLEMENTED(uselib); 60 UNIMPLEMENTED(vserver); 61 62 DUMMY(sendfile); 63 DUMMY(syslog); 64 DUMMY(setfsuid); 65 DUMMY(setfsgid); 66 DUMMY(sysfs); 67 DUMMY(vhangup); 68 DUMMY(pivot_root); 69 DUMMY(adjtimex); 70 DUMMY(swapoff); 71 DUMMY(init_module); 72 DUMMY(delete_module); 73 DUMMY(quotactl); 74 DUMMY(lookup_dcookie); 75 DUMMY(remap_file_pages); 76 DUMMY(semtimedop); 77 DUMMY(mbind); 78 DUMMY(get_mempolicy); 79 DUMMY(set_mempolicy); 80 DUMMY(mq_open); 81 DUMMY(mq_unlink); 82 DUMMY(mq_timedsend); 83 DUMMY(mq_timedreceive); 84 DUMMY(mq_notify); 85 DUMMY(mq_getsetattr); 86 DUMMY(kexec_load); 87 /* Linux 2.6.11: */ 88 DUMMY(add_key); 89 DUMMY(request_key); 90 DUMMY(keyctl); 91 /* Linux 2.6.13: */ 92 DUMMY(ioprio_set); 93 DUMMY(ioprio_get); 94 DUMMY(inotify_init); 95 DUMMY(inotify_add_watch); 96 DUMMY(inotify_rm_watch); 97 /* Linux 2.6.16: */ 98 DUMMY(migrate_pages); 99 DUMMY(unshare); 100 /* Linux 2.6.17: */ 101 DUMMY(splice); 102 DUMMY(tee); 103 DUMMY(sync_file_range); 104 DUMMY(vmsplice); 105 /* Linux 2.6.18: */ 106 DUMMY(move_pages); 107 /* Linux 2.6.22: */ 108 DUMMY(signalfd); 109 /* Linux 2.6.27: */ 110 DUMMY(signalfd4); 111 DUMMY(inotify_init1); 112 /* Linux 2.6.31: */ 113 DUMMY(perf_event_open); 114 /* Linux 2.6.38: */ 115 DUMMY(fanotify_init); 116 DUMMY(fanotify_mark); 117 /* Linux 2.6.39: */ 118 DUMMY(name_to_handle_at); 119 DUMMY(open_by_handle_at); 120 DUMMY(clock_adjtime); 121 /* Linux 3.0: */ 122 DUMMY(setns); 123 DUMMY(getcpu); 124 /* Linux 3.2: */ 125 DUMMY(process_vm_readv); 126 DUMMY(process_vm_writev); 127 /* Linux 3.5: */ 128 DUMMY(kcmp); 129 /* Linux 3.8: */ 130 DUMMY(finit_module); 131 DUMMY(sched_setattr); 132 DUMMY(sched_getattr); 133 /* Linux 3.14: */ 134 DUMMY(renameat2); 135 /* Linux 3.15: */ 136 DUMMY(seccomp); 137 DUMMY(memfd_create); 138 DUMMY(kexec_file_load); 139 /* Linux 3.18: */ 140 DUMMY(bpf); 141 /* Linux 3.19: */ 142 DUMMY(execveat); 143 /* Linux 4.2: */ 144 DUMMY(userfaultfd); 145 /* Linux 4.3: */ 146 DUMMY(membarrier); 147 /* Linux 4.4: */ 148 DUMMY(mlock2); 149 /* Linux 4.5: */ 150 DUMMY(copy_file_range); 151 /* Linux 4.6: */ 152 DUMMY(preadv2); 153 DUMMY(pwritev2); 154 /* Linux 4.8: */ 155 DUMMY(pkey_mprotect); 156 DUMMY(pkey_alloc); 157 DUMMY(pkey_free); 158 /* Linux 4.11: */ 159 DUMMY(statx); 160 /* Linux 4.18: */ 161 DUMMY(io_pgetevents); 162 DUMMY(rseq); 163 /* Linux 5.0: */ 164 DUMMY(pidfd_send_signal); 165 DUMMY(io_uring_setup); 166 DUMMY(io_uring_enter); 167 DUMMY(io_uring_register); 168 169 #define DUMMY_XATTR(s) \ 170 int \ 171 linux_ ## s ## xattr( \ 172 struct thread *td, struct linux_ ## s ## xattr_args *arg) \ 173 { \ 174 \ 175 return (EOPNOTSUPP); \ 176 } 177 DUMMY_XATTR(set); 178 DUMMY_XATTR(lset); 179 DUMMY_XATTR(fset); 180 DUMMY_XATTR(get); 181 DUMMY_XATTR(lget); 182 DUMMY_XATTR(fget); 183 DUMMY_XATTR(list); 184 DUMMY_XATTR(llist); 185 DUMMY_XATTR(flist); 186 DUMMY_XATTR(remove); 187 DUMMY_XATTR(lremove); 188 DUMMY_XATTR(fremove); 189