Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jun 2021 09:31:00 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: a2760a540fbf - stable/12 - linux(4): Fix loadable modules after r367395
Message-ID:  <202106100931.15A9V00V030460@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=a2760a540fbf38584798a057d43adb659e0bb50e

commit a2760a540fbf38584798a057d43adb659e0bb50e
Author:     Conrad Meyer <cem@FreeBSD.org>
AuthorDate: 2020-11-06 22:04:57 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2021-06-10 09:23:48 +0000

    linux(4): Fix loadable modules after r367395
    
    Move dtrace SDT definitions into linux_common module code.  Also, build
    linux_dummy.c into the linux_common kld -- we don't need separate
    versions of these stubs for 32- and 64-bit emulation.
    
    Reported by:    several
    PR:             250897
    Discussed with: emaste, trasz
    Tested by:      John Kennedy, Yasuhiro KIMURA, Oleg Sidorkin
    X-MFC-With:     r367395
    Differential Revision:  https://reviews.freebsd.org/D27124
    
    (cherry picked from commit 76b2bfeda42bbb686c74d3608dbc9b84b8e22e29)
---
 sys/compat/linux/linux_common.c | 15 +++++++++++++++
 sys/compat/linux/linux_dummy.c  | 12 +++++-------
 sys/compat/linux/linux_misc.c   | 13 -------------
 sys/conf/files.i386             |  1 +
 4 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/sys/compat/linux/linux_common.c b/sys/compat/linux/linux_common.c
index a6c780bd5e10..6eebfb91d002 100644
--- a/sys/compat/linux/linux_common.c
+++ b/sys/compat/linux/linux_common.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysctl.h>
 
 #include <compat/linux/linux.h>
+#include <compat/linux/linux_dtrace.h>
 #include <compat/linux/linux_emul.h>
 #include <compat/linux/linux_ioctl.h>
 #include <compat/linux/linux_mib.h>
@@ -49,6 +50,20 @@ FEATURE(linuxulator_v4l2, "V4L2 ioctl wrapper support in the linuxulator");
 
 MODULE_VERSION(linux_common, 1);
 
+/**
+ * Special DTrace provider for the linuxulator.
+ *
+ * In this file we define the provider for the entire linuxulator. All
+ * modules (= files of the linuxulator) use it.
+ *
+ * We define a different name depending on the emulated bitsize, see
+ * ../../<ARCH>/linux{,32}/linux.h, e.g.:
+ *      native bitsize          = linuxulator
+ *      amd64, 32bit emulation  = linuxulator32
+ */
+LIN_SDT_PROVIDER_DEFINE(linuxulator);
+LIN_SDT_PROVIDER_DEFINE(linuxulator32);
+
 SET_DECLARE(linux_device_handler_set, struct linux_device_handler);
 
 TAILQ_HEAD(, linux_ioctl_handler_element) linux_ioctl_handlers =
diff --git a/sys/compat/linux/linux_dummy.c b/sys/compat/linux/linux_dummy.c
index 1003b7d4c6e4..39e0d0a914b9 100644
--- a/sys/compat/linux/linux_dummy.c
+++ b/sys/compat/linux/linux_dummy.c
@@ -29,21 +29,19 @@
 #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
+/*
+ * Including linux vs linux32 here is arbitrary -- the syscall args structures
+ * (proto.h) are not dereferenced by the DUMMY stub implementations, and
+ * suitable for use by both native and compat32 entrypoints.
+ */
 #include <machine/../linux/linux.h>
 #include <machine/../linux/linux_proto.h>
-#endif
 
 #include <compat/linux/linux_dtrace.h>
 #include <compat/linux/linux_util.h>
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index af3e774f3505..d436aadf0035 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -99,19 +99,6 @@ __FBSDID("$FreeBSD$");
 #include <compat/linux/linux_emul.h>
 #include <compat/linux/linux_misc.h>
 
-/**
- * Special DTrace provider for the linuxulator.
- *
- * In this file we define the provider for the entire linuxulator. All
- * modules (= files of the linuxulator) use it.
- *
- * We define a different name depending on the emulated bitsize, see
- * ../../<ARCH>/linux{,32}/linux.h, e.g.:
- *      native bitsize          = linuxulator
- *      amd64, 32bit emulation  = linuxulator32
- */
-LIN_SDT_PROVIDER_DEFINE(LINUX_DTRACE);
-
 int stclohz;				/* Statistics clock frequency */
 
 static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = {
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index ffbb8c314e3e..aa26d29c02f9 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_common.c	optional compat_linux
 compat/linux/linux_dummy.c	optional compat_linux
 compat/linux/linux_event.c	optional compat_linux
 compat/linux/linux_emul.c	optional compat_linux



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106100931.15A9V00V030460>