Date: Thu, 10 Jun 2021 09:30:59 GMT From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 540206069cb6 - stable/12 - Direct commit: MFC r367395 (e9b13c6612fea4e74f0c9c543e21d29d91a24dff) by cem: Message-ID: <202106100930.15A9Ux5W030120@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=540206069cb6c0449a00745c57b74d19f4b216b8 commit 540206069cb6c0449a00745c57b74d19f4b216b8 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2021-06-10 09:22:43 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2021-06-10 09:22:43 +0000 Direct commit: MFC r367395 (e9b13c6612fea4e74f0c9c543e21d29d91a24dff) by cem: linux(4): Deduplicate unimpl/dummy syscall handlers No functional change. Reviewed by: emaste, trasz Differential Revision: https://reviews.freebsd.org/D27099 --- sys/amd64/linux/linux_dummy.c | 192 --------------------- sys/amd64/linux/linux_dummy_machdep.c | 74 ++++++++ sys/amd64/linux32/linux32_dummy.c | 119 ------------- sys/arm64/linux/linux_dummy_machdep.c | 63 +++++++ sys/{arm64 => compat}/linux/linux_dummy.c | 24 +-- sys/conf/files.amd64 | 2 + sys/conf/files.i386 | 4 +- .../linux/{linux_dummy.c => linux_dummy_machdep.c} | 131 +------------- sys/modules/linux/Makefile | 6 + sys/modules/linux64/Makefile | 8 +- sys/modules/linux_common/Makefile | 2 +- sys/x86/linux/linux_dummy_x86.c | 69 ++++++++ 12 files changed, 242 insertions(+), 452 deletions(-) diff --git a/sys/amd64/linux/linux_dummy.c b/sys/amd64/linux/linux_dummy.c deleted file mode 100644 index ee21b4da212b..000000000000 --- a/sys/amd64/linux/linux_dummy.c +++ /dev/null @@ -1,192 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2013 Dmitry Chagin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/sdt.h> -#include <sys/systm.h> -#include <sys/proc.h> - -#include <amd64/linux/linux.h> -#include <amd64/linux/linux_proto.h> -#include <compat/linux/linux_dtrace.h> -#include <compat/linux/linux_util.h> - -/* DTrace init */ -LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); - -UNIMPLEMENTED(afs_syscall); -UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(epoll_ctl_old); -UNIMPLEMENTED(epoll_wait_old); -UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(get_thread_area); -UNIMPLEMENTED(getpmsg); -UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ -UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ -UNIMPLEMENTED(tuxcall); -UNIMPLEMENTED(security); -UNIMPLEMENTED(set_thread_area); -UNIMPLEMENTED(uselib); -UNIMPLEMENTED(vserver); - -DUMMY(sendfile); -DUMMY(setfsuid); -DUMMY(setfsgid); -DUMMY(sysfs); -DUMMY(vhangup); -DUMMY(modify_ldt); -DUMMY(pivot_root); -DUMMY(adjtimex); -DUMMY(swapoff); -DUMMY(init_module); -DUMMY(ioperm); -DUMMY(delete_module); -DUMMY(quotactl); -DUMMY(readahead); -DUMMY(io_setup); -DUMMY(io_destroy); -DUMMY(io_getevents); -DUMMY(io_submit); -DUMMY(io_cancel); -DUMMY(lookup_dcookie); -DUMMY(remap_file_pages); -DUMMY(restart_syscall); -DUMMY(semtimedop); -DUMMY(mbind); -DUMMY(get_mempolicy); -DUMMY(set_mempolicy); -DUMMY(mq_open); -DUMMY(mq_unlink); -DUMMY(mq_timedsend); -DUMMY(mq_timedreceive); -DUMMY(mq_notify); -DUMMY(mq_getsetattr); -DUMMY(kexec_load); -/* Linux 2.6.11: */ -DUMMY(add_key); -DUMMY(request_key); -DUMMY(keyctl); -/* Linux 2.6.13: */ -DUMMY(ioprio_set); -DUMMY(ioprio_get); -DUMMY(inotify_init); -DUMMY(inotify_add_watch); -DUMMY(inotify_rm_watch); -/* Linux 2.6.16: */ -DUMMY(migrate_pages); -DUMMY(unshare); -/* Linux 2.6.17: */ -DUMMY(tee); -DUMMY(vmsplice); -/* Linux 2.6.18: */ -DUMMY(move_pages); -/* Linux 2.6.22: */ -DUMMY(signalfd); -/* Linux 2.6.27: */ -DUMMY(signalfd4); -DUMMY(inotify_init1); -/* Linux 2.6.31: */ -DUMMY(perf_event_open); -/* Linux 2.6.36: */ -DUMMY(fanotify_init); -DUMMY(fanotify_mark); -/* Linux 2.6.39: */ -DUMMY(name_to_handle_at); -DUMMY(open_by_handle_at); -DUMMY(clock_adjtime); -/* Linux 3.0: */ -DUMMY(setns); -/* Linux 3.2: */ -DUMMY(process_vm_readv); -DUMMY(process_vm_writev); -/* Linux 3.5: */ -DUMMY(kcmp); -/* Linux 3.8: */ -DUMMY(finit_module); -DUMMY(sched_setattr); -DUMMY(sched_getattr); -/* Linux 3.15: */ -DUMMY(kexec_file_load); -/* Linux 3.17: */ -DUMMY(memfd_create); -DUMMY(seccomp); -/* Linux 3.18: */ -DUMMY(bpf); -/* Linux 3.19: */ -DUMMY(execveat); -/* Linux 4.2: */ -DUMMY(userfaultfd); -/* Linux 4.3: */ -DUMMY(membarrier); -/* Linux 4.4: */ -DUMMY(mlock2); -/* Linux 4.5: */ -DUMMY(copy_file_range); -/* Linux 4.6: */ -DUMMY(preadv2); -DUMMY(pwritev2); -/* Linux 4.8: */ -DUMMY(pkey_mprotect); -DUMMY(pkey_alloc); -DUMMY(pkey_free); -/* Linux 4.11: */ -DUMMY(statx); -/* Linux 4.18: */ -DUMMY(io_pgetevents); -DUMMY(rseq); -/* Linux 5.0: */ -DUMMY(pidfd_send_signal); -DUMMY(io_uring_setup); -DUMMY(io_uring_enter); -DUMMY(io_uring_register); - -#define DUMMY_XATTR(s) \ -int \ -linux_ ## s ## xattr( \ - struct thread *td, struct linux_ ## s ## xattr_args *arg) \ -{ \ - \ - return (EOPNOTSUPP); \ -} -DUMMY_XATTR(set); -DUMMY_XATTR(lset); -DUMMY_XATTR(fset); -DUMMY_XATTR(get); -DUMMY_XATTR(lget); -DUMMY_XATTR(fget); -DUMMY_XATTR(list); -DUMMY_XATTR(llist); -DUMMY_XATTR(flist); -DUMMY_XATTR(remove); -DUMMY_XATTR(lremove); -DUMMY_XATTR(fremove); diff --git a/sys/amd64/linux/linux_dummy_machdep.c b/sys/amd64/linux/linux_dummy_machdep.c new file mode 100644 index 000000000000..aba79b69d55d --- /dev/null +++ b/sys/amd64/linux/linux_dummy_machdep.c @@ -0,0 +1,74 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2013 Dmitry Chagin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/param.h> +#include <sys/kernel.h> +#include <sys/sdt.h> +#include <sys/systm.h> +#include <sys/proc.h> + +#include <amd64/linux/linux.h> +#include <amd64/linux/linux_proto.h> +#include <compat/linux/linux_dtrace.h> +#include <compat/linux/linux_util.h> + +/* DTrace init */ +LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); + +/* + * Before adding new stubs to this file, please check if a stub can be added to + * the machine-independent code in sys/compat/linux/linux_dummy.c (or + * sys/x86/linux/linux_dummy_x86.c). + */ + +UNIMPLEMENTED(get_thread_area); +UNIMPLEMENTED(set_thread_area); +UNIMPLEMENTED(uselib); + +DUMMY(modify_ldt); + +DUMMY(ioperm); +DUMMY(io_setup); +DUMMY(io_destroy); +DUMMY(io_getevents); +DUMMY(io_submit); +DUMMY(io_cancel); +DUMMY(mq_open); +DUMMY(mq_unlink); +DUMMY(mq_timedsend); +DUMMY(mq_timedreceive); +DUMMY(mq_notify); +DUMMY(mq_getsetattr); +DUMMY(readahead); +DUMMY(restart_syscall); +DUMMY(semtimedop); +/* Linux 3.15: */ +DUMMY(kexec_file_load); diff --git a/sys/amd64/linux32/linux32_dummy.c b/sys/amd64/linux32/linux32_dummy.c index 97a8aa0d3ddd..5eb54fefd276 100644 --- a/sys/amd64/linux32/linux32_dummy.c +++ b/sys/amd64/linux32/linux32_dummy.c @@ -43,123 +43,29 @@ __FBSDID("$FreeBSD$"); /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); -UNIMPLEMENTED(afs_syscall); UNIMPLEMENTED(break); -UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(ftime); -UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(getpmsg); UNIMPLEMENTED(gtty); UNIMPLEMENTED(stty); UNIMPLEMENTED(lock); UNIMPLEMENTED(mpx); -UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ UNIMPLEMENTED(prof); UNIMPLEMENTED(profil); -UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ UNIMPLEMENTED(ulimit); -UNIMPLEMENTED(vserver); DUMMY(stime); DUMMY(olduname); DUMMY(uname); -DUMMY(vhangup); -DUMMY(swapoff); -DUMMY(adjtimex); -DUMMY(init_module); -DUMMY(delete_module); -DUMMY(quotactl); DUMMY(bdflush); -DUMMY(sysfs); -DUMMY(sendfile); -DUMMY(setfsuid); -DUMMY(setfsgid); -DUMMY(pivot_root); DUMMY(ptrace); -DUMMY(lookup_dcookie); -DUMMY(remap_file_pages); -DUMMY(mbind); -DUMMY(get_mempolicy); -DUMMY(set_mempolicy); DUMMY(mq_open); DUMMY(mq_unlink); DUMMY(mq_timedsend); DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); -DUMMY(kexec_load); -/* Linux 2.6.11: */ -DUMMY(add_key); -DUMMY(request_key); -DUMMY(keyctl); -/* Linux 2.6.13: */ -DUMMY(ioprio_set); -DUMMY(ioprio_get); -DUMMY(inotify_init); -DUMMY(inotify_add_watch); -DUMMY(inotify_rm_watch); -/* Linux 2.6.16: */ -DUMMY(migrate_pages); -DUMMY(unshare); -/* Linux 2.6.17: */ -DUMMY(tee); -DUMMY(vmsplice); -/* Linux 2.6.18: */ -DUMMY(move_pages); -/* Linux 2.6.22: */ -DUMMY(signalfd); -/* Linux 2.6.27: */ -DUMMY(signalfd4); -DUMMY(inotify_init1); -/* Linux 2.6.31: */ -DUMMY(perf_event_open); -/* Linux 2.6.36: */ -DUMMY(fanotify_init); -DUMMY(fanotify_mark); -/* Linux 2.6.39: */ -DUMMY(name_to_handle_at); -DUMMY(open_by_handle_at); -DUMMY(clock_adjtime); -/* Linux 3.0: */ -DUMMY(setns); -/* Linux 3.2: */ -DUMMY(process_vm_readv); -DUMMY(process_vm_writev); -/* Linux 3.5: */ -DUMMY(kcmp); -/* Linux 3.8: */ -DUMMY(finit_module); -DUMMY(sched_setattr); -DUMMY(sched_getattr); -/* Linux 3.17: */ -DUMMY(memfd_create); -DUMMY(seccomp); -/* Linux 3.18: */ -DUMMY(bpf); -/* Linux 3.19: */ -DUMMY(execveat); -/* Linux 4.2: */ -DUMMY(userfaultfd); -/* Linux 4.3: */ -DUMMY(membarrier); -/* Linux 4.4: */ -DUMMY(mlock2); -/* Linux 4.5: */ -DUMMY(copy_file_range); -/* Linux 4.6: */ -DUMMY(preadv2); -DUMMY(pwritev2); -/* Linux 4.8: */ -DUMMY(pkey_mprotect); -DUMMY(pkey_alloc); -DUMMY(pkey_free); /* Linux 4.11: */ -DUMMY(statx); DUMMY(arch_prctl); -/* Linux 4.18: */ -DUMMY(io_pgetevents); -DUMMY(rseq); /* Linux 5.0: */ DUMMY(clock_gettime64); DUMMY(clock_settime64); @@ -181,28 +87,3 @@ DUMMY(semtimedop_time64); DUMMY(rt_sigtimedwait_time64); DUMMY(futex_time64); DUMMY(sched_rr_get_interval_time64); -DUMMY(pidfd_send_signal); -DUMMY(io_uring_setup); -DUMMY(io_uring_enter); -DUMMY(io_uring_register); - -#define DUMMY_XATTR(s) \ -int \ -linux_ ## s ## xattr( \ - struct thread *td, struct linux_ ## s ## xattr_args *arg) \ -{ \ - \ - return (EOPNOTSUPP); \ -} -DUMMY_XATTR(set); -DUMMY_XATTR(lset); -DUMMY_XATTR(fset); -DUMMY_XATTR(get); -DUMMY_XATTR(lget); -DUMMY_XATTR(fget); -DUMMY_XATTR(list); -DUMMY_XATTR(llist); -DUMMY_XATTR(flist); -DUMMY_XATTR(remove); -DUMMY_XATTR(lremove); -DUMMY_XATTR(fremove); diff --git a/sys/arm64/linux/linux_dummy_machdep.c b/sys/arm64/linux/linux_dummy_machdep.c new file mode 100644 index 000000000000..b006809740d7 --- /dev/null +++ b/sys/arm64/linux/linux_dummy_machdep.c @@ -0,0 +1,63 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2013 Dmitry Chagin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include "opt_compat.h" + +#include <sys/param.h> +#include <sys/kernel.h> +#include <sys/sdt.h> +#include <sys/systm.h> +#include <sys/proc.h> + +#include <arm64/linux/linux.h> +#include <arm64/linux/linux_proto.h> +#include <compat/linux/linux_dtrace.h> +#include <compat/linux/linux_util.h> + +/* DTrace init */ +LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); + +/* + * Before adding new stubs to this file, please check if a stub can be added to + * the machine-independent code in sys/compat/linux/linux_dummy.c. + */ + +UNIMPLEMENTED(get_thread_area); +UNIMPLEMENTED(set_thread_area); +UNIMPLEMENTED(uselib); + +DUMMY(mq_open); +DUMMY(mq_unlink); +DUMMY(mq_timedsend); +DUMMY(mq_timedreceive); +DUMMY(mq_notify); +DUMMY(mq_getsetattr); +DUMMY(semtimedop); diff --git a/sys/arm64/linux/linux_dummy.c b/sys/compat/linux/linux_dummy.c similarity index 90% rename from sys/arm64/linux/linux_dummy.c rename to sys/compat/linux/linux_dummy.c index 92a0feb94f73..1003b7d4c6e4 100644 --- a/sys/arm64/linux/linux_dummy.c +++ b/sys/compat/linux/linux_dummy.c @@ -37,14 +37,17 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/proc.h> -#include <arm64/linux/linux.h> -#include <arm64/linux/linux_proto.h> +#ifdef COMPAT_LINUX32 +#include <machine/../linux32/linux.h> +#include <machine/../linux32/linux32_proto.h> +#else +#include <machine/../linux/linux.h> +#include <machine/../linux/linux_proto.h> +#endif + #include <compat/linux/linux_dtrace.h> #include <compat/linux/linux_util.h> -// LINUXTODO: deduplicate arm64 dummy against other archs? -// LINUXTODO: review/update/add unimplemented syscalls - /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); @@ -53,15 +56,11 @@ UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(epoll_ctl_old); UNIMPLEMENTED(epoll_wait_old); UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(get_thread_area); UNIMPLEMENTED(getpmsg); UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ UNIMPLEMENTED(putpmsg); UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ UNIMPLEMENTED(security); -UNIMPLEMENTED(set_thread_area); -UNIMPLEMENTED(tuxcall); -UNIMPLEMENTED(uselib); UNIMPLEMENTED(vserver); DUMMY(sendfile); @@ -75,16 +74,9 @@ DUMMY(init_module); DUMMY(delete_module); DUMMY(lookup_dcookie); DUMMY(remap_file_pages); -DUMMY(semtimedop); DUMMY(mbind); DUMMY(get_mempolicy); DUMMY(set_mempolicy); -DUMMY(mq_open); -DUMMY(mq_unlink); -DUMMY(mq_timedsend); -DUMMY(mq_timedreceive); -DUMMY(mq_notify); -DUMMY(mq_getsetattr); DUMMY(kexec_load); /* Linux 2.6.11: */ DUMMY(add_key); diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index b78d99336b03..5effa0f5f9c6 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -714,6 +714,7 @@ amd64/linux32/linux32_support.s optional compat_linux32 \ dependency "linux32_assym.h" amd64/linux32/linux32_sysent.c optional compat_linux32 amd64/linux32/linux32_sysvec.c optional compat_linux32 +compat/linux/linux_dummy.c optional compat_linux32 compat/linux/linux_emul.c optional compat_linux32 compat/linux/linux_errno.c optional compat_linux32 compat/linux/linux_file.c optional compat_linux32 @@ -737,6 +738,7 @@ compat/linux/linux_vdso.c optional compat_linux32 compat/linux/linux_common.c optional compat_linux32 compat/linux/linux_event.c optional compat_linux32 compat/linux/linux.c optional compat_linux32 +x86/linux/linux_dummy_x86.c optional compat_linux32 dev/amr/amr_linux.c optional compat_linux32 amr dev/mfi/mfi_linux.c optional compat_linux32 mfi # diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 8077a7bafa0f..ffbb8c314e3e 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -86,6 +86,7 @@ cddl/dev/dtrace/x86/dis_tables.c optional dtrace_fbt | dtraceall compile-with cddl/dev/dtrace/x86/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}" compat/linprocfs/linprocfs.c optional linprocfs compat/linsysfs/linsysfs.c optional linsysfs +compat/linux/linux_dummy.c optional compat_linux compat/linux/linux_event.c optional compat_linux compat/linux/linux_emul.c optional compat_linux compat/linux/linux_errno.c optional compat_linux @@ -542,7 +543,7 @@ i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2 i386/ibcs2/imgact_coff.c optional ibcs2 i386/linux/imgact_linux.c optional compat_linux i386/linux/linux_copyout.c optional compat_linux -i386/linux/linux_dummy.c optional compat_linux +i386/linux/linux_dummy_machdep.c optional compat_linux i386/linux/linux_machdep.c optional compat_linux i386/linux/linux_ptrace.c optional compat_linux i386/linux/linux_sysent.c optional compat_linux @@ -608,6 +609,7 @@ x86/isa/isa.c optional isa x86/isa/isa_dma.c optional isa x86/isa/nmi.c standard x86/isa/orm.c optional isa +x86/linux/linux_dummy_x86.c optional compat_linux x86/pci/pci_bus.c optional pci x86/pci/qpi.c optional pci x86/x86/autoconf.c standard diff --git a/sys/i386/linux/linux_dummy.c b/sys/i386/linux/linux_dummy_machdep.c similarity index 50% rename from sys/i386/linux/linux_dummy.c rename to sys/i386/linux/linux_dummy_machdep.c index 05c873529c15..dfcc691a3582 100644 --- a/sys/i386/linux/linux_dummy.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -43,119 +43,31 @@ __FBSDID("$FreeBSD$"); /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); -UNIMPLEMENTED(afs_syscall); +/* + * Before adding new stubs to this file, please check if a stub can be added to + * the machine-independent code in sys/compat/linux/linux_dummy.c (or + * sys/x86/linux/linux_dummy_x86.c). + */ + UNIMPLEMENTED(break); -UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(ftime); -UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(getpmsg); UNIMPLEMENTED(gtty); UNIMPLEMENTED(stty); UNIMPLEMENTED(lock); UNIMPLEMENTED(mpx); -UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ UNIMPLEMENTED(prof); UNIMPLEMENTED(profil); -UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ UNIMPLEMENTED(ulimit); -UNIMPLEMENTED(vserver); -DUMMY(stime); +DUMMY(bdflush); DUMMY(fstat); DUMMY(olduname); +DUMMY(stime); DUMMY(uname); -DUMMY(vhangup); -DUMMY(vm86old); -DUMMY(swapoff); -DUMMY(adjtimex); -DUMMY(init_module); -DUMMY(delete_module); -DUMMY(quotactl); -DUMMY(bdflush); -DUMMY(sysfs); DUMMY(vm86); -DUMMY(sendfile); /* different semantics */ -DUMMY(setfsuid); -DUMMY(setfsgid); -DUMMY(pivot_root); -DUMMY(lookup_dcookie); -DUMMY(remap_file_pages); -DUMMY(mbind); -DUMMY(get_mempolicy); -DUMMY(set_mempolicy); -DUMMY(kexec_load); -/* Linux 2.6.11: */ -DUMMY(add_key); -DUMMY(request_key); -DUMMY(keyctl); -/* Linux 2.6.13: */ -DUMMY(ioprio_set); -DUMMY(ioprio_get); -DUMMY(inotify_init); -DUMMY(inotify_add_watch); -DUMMY(inotify_rm_watch); -/* Linux 2.6.16: */ -DUMMY(migrate_pages); -DUMMY(unshare); -/* Linux 2.6.17: */ -DUMMY(tee); -DUMMY(vmsplice); -/* Linux 2.6.18: */ -DUMMY(move_pages); -/* Linux 2.6.22: */ -DUMMY(signalfd); -/* Linux 2.6.27: */ -DUMMY(signalfd4); -DUMMY(inotify_init1); -/* Linux 2.6.31: */ -DUMMY(perf_event_open); -/* Linux 2.6.36: */ -DUMMY(fanotify_init); -DUMMY(fanotify_mark); -/* Linux 2.6.39: */ -DUMMY(name_to_handle_at); -DUMMY(open_by_handle_at); -DUMMY(clock_adjtime); -/* Linux 3.0: */ -DUMMY(setns); -/* Linux 3.2: */ -DUMMY(process_vm_readv); -DUMMY(process_vm_writev); -/* Linux 3.5: */ -DUMMY(kcmp); -/* Linux 3.8: */ -DUMMY(finit_module); -DUMMY(sched_setattr); -DUMMY(sched_getattr); -/* Linux 3.17: */ -DUMMY(memfd_create); -DUMMY(seccomp); -/* Linux 3.18: */ -DUMMY(bpf); -/* Linux 3.19: */ -DUMMY(execveat); -/* Linux 4.2: */ -DUMMY(userfaultfd); -/* Linux 4.3: */ -DUMMY(membarrier); -/* Linux 4.4: */ -DUMMY(mlock2); -/* Linux 4.5: */ -DUMMY(copy_file_range); -/* Linux 4.6: */ -DUMMY(preadv2); -DUMMY(pwritev2); -/* Linux 4.8: */ -DUMMY(pkey_mprotect); -DUMMY(pkey_alloc); -DUMMY(pkey_free); +DUMMY(vm86old); /* Linux 4.11: */ -DUMMY(statx); DUMMY(arch_prctl); -/* Linux 4.18: */ -DUMMY(io_pgetevents); -DUMMY(rseq); /* Linux 5.0: */ DUMMY(clock_gettime64); DUMMY(clock_settime64); @@ -177,28 +89,3 @@ DUMMY(semtimedop_time64); DUMMY(rt_sigtimedwait_time64); DUMMY(futex_time64); DUMMY(sched_rr_get_interval_time64); -DUMMY(pidfd_send_signal); -DUMMY(io_uring_setup); -DUMMY(io_uring_enter); -DUMMY(io_uring_register); - -#define DUMMY_XATTR(s) \ -int \ -linux_ ## s ## xattr( \ - struct thread *td, struct linux_ ## s ## xattr_args *arg) \ -{ \ - \ - return (EOPNOTSUPP); \ -} -DUMMY_XATTR(set); -DUMMY_XATTR(lset); -DUMMY_XATTR(fset); -DUMMY_XATTR(get); -DUMMY_XATTR(lget); -DUMMY_XATTR(fget); -DUMMY_XATTR(list); -DUMMY_XATTR(llist); -DUMMY_XATTR(flist); -DUMMY_XATTR(remove); -DUMMY_XATTR(lremove); -DUMMY_XATTR(fremove); diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile index 7065c1f0f6cd..3092c5d81d80 100644 --- a/sys/modules/linux/Makefile +++ b/sys/modules/linux/Makefile @@ -6,6 +6,9 @@ CFLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 .endif .PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE_CPUARCH}/linux${SFX} +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +.PATH: ${SRCTOP}/sys/x86/linux +.endif VDSO= linux${SFX}_vdso @@ -18,6 +21,9 @@ SRCS= linux_fork.c linux${SFX}_dummy.c linux_file.c linux_event.c \ linux_timer.c linux_vdso.c \ opt_inet6.h opt_compat.h opt_posix.h opt_usb.h vnode_if.h \ device_if.h bus_if.h +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +SRCS+= linux_dummy_x86.c +.endif .if ${MACHINE_CPUARCH} == "amd64" SRCS+= linux${SFX}_support.s .else diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile index 046eeeda30f2..ec1aee563aa3 100644 --- a/sys/modules/linux64/Makefile +++ b/sys/modules/linux64/Makefile @@ -1,11 +1,14 @@ # $FreeBSD$ .PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +.PATH: ${SRCTOP}/sys/x86/linux +.endif VDSO= linux_vdso KMOD= linux64 -SRCS= linux_fork.c linux_dummy.c linux_file.c linux_event.c \ +SRCS= linux_fork.c linux_dummy_machdep.c linux_file.c linux_event.c \ linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \ linux_machdep.c linux_misc.c linux_ptrace.c linux_signal.c \ linux_socket.c linux_stats.c linux_sysctl.c linux_sysent.c \ @@ -13,6 +16,9 @@ SRCS= linux_fork.c linux_dummy.c linux_file.c linux_event.c \ opt_compat.h opt_inet6.h opt_posix.h opt_usb.h \ vnode_if.h device_if.h bus_if.h \ linux_support.s +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +SRCS+= linux_dummy_x86.c +.endif DPSRCS= assym.inc linux_genassym.c # XXX: for assym.inc diff --git a/sys/modules/linux_common/Makefile b/sys/modules/linux_common/Makefile index 5b49a7409997..b4b71a709b70 100644 --- a/sys/modules/linux_common/Makefile +++ b/sys/modules/linux_common/Makefile @@ -4,7 +4,7 @@ KMOD= linux_common SRCS= linux_common.c linux_mib.c linux_mmap.c linux_util.c linux_emul.c \ - linux_errno.c \ + linux_dummy.c linux_errno.c \ linux.c device_if.h vnode_if.h bus_if.h opt_inet6.h EXPORT_SYMS= diff --git a/sys/x86/linux/linux_dummy_x86.c b/sys/x86/linux/linux_dummy_x86.c new file mode 100644 index 000000000000..1defe4e9674e --- /dev/null +++ b/sys/x86/linux/linux_dummy_x86.c @@ -0,0 +1,69 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2013 Dmitry Chagin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include "opt_compat.h" + +#include <sys/param.h> +#include <sys/kernel.h> +#include <sys/sdt.h> +#include <sys/systm.h> +#include <sys/proc.h> + +#ifdef COMPAT_LINUX32 +#include <machine/../linux32/linux.h> +#include <machine/../linux32/linux32_proto.h> +#else +#include <machine/../linux/linux.h> +#include <machine/../linux/linux_proto.h> +#endif + +#include <compat/linux/linux_dtrace.h> +#include <compat/linux/linux_util.h> + +/* DTrace init */ +LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); + +DUMMY(sysfs); +DUMMY(quotactl); +/* Linux 2.6.13: */ +DUMMY(inotify_init); +/* Linux 2.6.22: */ +DUMMY(signalfd); +/* Linux 4.11: */ +DUMMY(statx); +/* Linux 4.18: */ +DUMMY(io_pgetevents); +DUMMY(rseq); +/* Linux 5.0: */ +DUMMY(pidfd_send_signal); +DUMMY(io_uring_setup); +DUMMY(io_uring_enter); +DUMMY(io_uring_register);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106100930.15A9Ux5W030120>