1 /*- 2 * Copyright (c) 2013 Dmitry Chagin 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer 10 * in this position and unchanged. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27 #include <sys/cdefs.h> 28 __FBSDID("$FreeBSD$"); 29 30 #include "opt_compat.h" 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(mincore); 63 DUMMY(sendfile); 64 DUMMY(syslog); 65 DUMMY(setfsuid); 66 DUMMY(setfsgid); 67 DUMMY(sysfs); 68 DUMMY(vhangup); 69 DUMMY(pivot_root); 70 DUMMY(adjtimex); 71 DUMMY(swapoff); 72 DUMMY(init_module); 73 DUMMY(delete_module); 74 DUMMY(quotactl); 75 DUMMY(lookup_dcookie); 76 DUMMY(remap_file_pages); 77 DUMMY(semtimedop); 78 DUMMY(mbind); 79 DUMMY(get_mempolicy); 80 DUMMY(set_mempolicy); 81 DUMMY(mq_open); 82 DUMMY(mq_unlink); 83 DUMMY(mq_timedsend); 84 DUMMY(mq_timedreceive); 85 DUMMY(mq_notify); 86 DUMMY(mq_getsetattr); 87 DUMMY(kexec_load); 88 /* linux 2.6.11: */ 89 DUMMY(add_key); 90 DUMMY(request_key); 91 DUMMY(keyctl); 92 /* linux 2.6.13: */ 93 DUMMY(ioprio_set); 94 DUMMY(ioprio_get); 95 DUMMY(inotify_init); 96 DUMMY(inotify_add_watch); 97 DUMMY(inotify_rm_watch); 98 /* linux 2.6.16: */ 99 DUMMY(migrate_pages); 100 DUMMY(unshare); 101 /* linux 2.6.17: */ 102 DUMMY(splice); 103 DUMMY(tee); 104 DUMMY(sync_file_range); 105 DUMMY(vmsplice); 106 /* linux 2.6.18: */ 107 DUMMY(move_pages); 108 /* linux 2.6.22: */ 109 DUMMY(signalfd); 110 /* linux 2.6.27: */ 111 DUMMY(signalfd4); 112 DUMMY(inotify_init1); 113 /* linux 2.6.31: */ 114 DUMMY(perf_event_open); 115 /* linux 2.6.38: */ 116 DUMMY(fanotify_init); 117 DUMMY(fanotify_mark); 118 /* linux 2.6.39: */ 119 DUMMY(name_to_handle_at); 120 DUMMY(open_by_handle_at); 121 DUMMY(clock_adjtime); 122 /* linux 3.0: */ 123 DUMMY(setns); 124 DUMMY(getcpu); 125 /* linux 3.2: */ 126 DUMMY(process_vm_readv); 127 DUMMY(process_vm_writev); 128 /* linux 3.5: */ 129 DUMMY(kcmp); 130 /* linux 3.8: */ 131 DUMMY(finit_module); 132 DUMMY(sched_setattr); 133 DUMMY(sched_getattr); 134 /* linux 3.14: */ 135 DUMMY(renameat2); 136 /* linux 3.15: */ 137 DUMMY(seccomp); 138 DUMMY(getrandom); 139 DUMMY(memfd_create); 140 DUMMY(kexec_file_load); 141 /* linux 3.18: */ 142 DUMMY(bpf); 143 /* linux 3.19: */ 144 DUMMY(execveat); 145 /* linux 4.2: */ 146 DUMMY(userfaultfd); 147 /* linux 4.3: */ 148 DUMMY(membarrier); 149 /* linux 4.4: */ 150 DUMMY(mlock2); 151 /* linux 4.5: */ 152 DUMMY(copy_file_range); 153 /* linux 4.6: */ 154 DUMMY(preadv2); 155 DUMMY(pwritev2); 156 /* linux 4.8: */ 157 DUMMY(pkey_mprotect); 158 DUMMY(pkey_alloc); 159 DUMMY(pkey_free); 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 (ENOATTR); \ 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