|
Andreas Gruenbacher |
c2d682 |
From: Andreas Gruenbacher <agruen@suse.de>
|
|
Michal Kubecek |
b493de |
Subject: SUSE/external support flag in modules
|
|
Jeff Mahoney |
d3dcd1 |
Patch-mainline: Never, SLES feature
|
|
Michal Kubecek |
df31cd |
References: bsc#148091 bsc#974406
|
|
Kurt Garloff |
7ecd9d |
|
|
Andreas Gruenbacher |
c2d682 |
Upon module load, check if a module is supported, and set the
|
|
Olaf Hering |
dfd91f |
N (TAINT_NO_SUPPORT) or X (TAINT_EXTERNAL_SUPPORT) tail flags
|
|
Andreas Gruenbacher |
c2d682 |
for unsupported or externally suported modules.
|
|
Kurt Garloff |
7ecd9d |
|
|
Michal Kubecek |
0c612f |
Function get_next_line() was removed by mainline commit 75893572d453
|
|
Michal Kubecek |
0c612f |
("modpost: remove get_next_text() and make {grab,release_}file static"),
|
|
Michal Kubecek |
0c612f |
restore it.
|
|
Michal Kubecek |
0c612f |
|
|
Jeff Mahoney |
d3dcd1 |
Contributions by:
|
|
Jeff Mahoney |
d3dcd1 |
Michal Marek, Michal Suchanek, Jeff Mahoney
|
|
Jeff Mahoney |
6b77d3 |
|
|
Andreas Gruenbacher |
c2d682 |
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
|
|
Jeff Mahoney |
6b77d3 |
---
|
|
Michal Kubecek |
8fc2af |
.../admin-guide/kernel-parameters.txt | 8 +
|
|
Michal Kubecek |
8fc2af |
Documentation/admin-guide/sysctl/kernel.rst | 41 ++---
|
|
Michal Kubecek |
8fc2af |
Documentation/admin-guide/tainted-kernels.rst | 48 ++---
|
|
Michal Kubecek |
8fc2af |
Makefile | 5 +
|
|
Michal Kubecek |
8fc2af |
include/linux/module.h | 3 +
|
|
Michal Kubecek |
8fc2af |
include/linux/panic.h | 18 ++
|
|
Michal Kubecek |
8fc2af |
init/Kconfig.suse | 18 ++
|
|
Michal Kubecek |
8fc2af |
kernel/ksysfs.c | 27 +++
|
|
Michal Kubecek |
8fc2af |
kernel/module/main.c | 49 ++++++
|
|
Michal Kubecek |
8fc2af |
kernel/module/sysfs.c | 29 +++
|
|
Michal Kubecek |
8fc2af |
kernel/panic.c | 3 +
|
|
Michal Kubecek |
8fc2af |
kernel/sysctl.c | 9 +
|
|
Michal Kubecek |
8fc2af |
scripts/Makefile.modpost | 6 +
|
|
Michal Kubecek |
8fc2af |
scripts/mod/modpost.c | 166 +++++++++++++++++-
|
|
Michal Kubecek |
c35dc3 |
14 files changed, 386 insertions(+), 44 deletions(-)
|
|
Greg Kroah-Hartman |
0688a2 |
|
|
Jeff Mahoney |
c901e2 |
--- a/Documentation/admin-guide/kernel-parameters.txt
|
|
Jeff Mahoney |
c901e2 |
+++ b/Documentation/admin-guide/kernel-parameters.txt
|
|
Michal Kubecek |
769d7a |
@@ -6471,6 +6471,14 @@
|
|
Jeff Mahoney |
a95ebd |
unknown_nmi_panic
|
|
Jeff Mahoney |
adf9d1 |
[X86] Cause panic on unknown NMI.
|
|
Hubert Mantel |
4f4392 |
|
|
Hubert Mantel |
4f4392 |
+ unsupported Allow loading of unsupported kernel modules:
|
|
Hubert Mantel |
4f4392 |
+ 0 = only allow supported modules,
|
|
Hubert Mantel |
4f4392 |
+ 1 = warn when loading unsupported modules,
|
|
Hubert Mantel |
4f4392 |
+ 2 = don't warn.
|
|
Greg Kroah-Hartman |
7952cb |
+
|
|
Jeff Mahoney |
776164 |
+ CONFIG_SUSE_KERNEL_SUPPORTED must be enabled for this
|
|
Jeff Mahoney |
776164 |
+ to have any effect.
|
|
Jeff Mahoney |
776164 |
+
|
|
Jeff Mahoney |
eccefc |
usbcore.authorized_default=
|
|
Jeff Mahoney |
eccefc |
[USB] Default USB device authorization:
|
|
Jeff Mahoney |
eccefc |
(default -1 = authorized except for wireless USB,
|
|
Michal Kubecek |
0a6d0d |
--- a/Documentation/admin-guide/sysctl/kernel.rst
|
|
Michal Kubecek |
0a6d0d |
+++ b/Documentation/admin-guide/sysctl/kernel.rst
|
|
Michal Kubecek |
769d7a |
@@ -1393,26 +1393,27 @@ tainted
|
|
Michal Kubecek |
0692bf |
Non-zero if the kernel has been tainted. Numeric values, which can be
|
|
Michal Kubecek |
0692bf |
ORed together. The letters are seen in "Tainted" line of Oops reports.
|
|
Michal Kubecek |
0692bf |
|
|
Michal Kubecek |
0692bf |
-====== ===== ==============================================================
|
|
Michal Kubecek |
0692bf |
- 1 `(P)` proprietary module was loaded
|
|
Michal Kubecek |
0692bf |
- 2 `(F)` module was force loaded
|
|
Michal Kubecek |
acbbbf |
- 4 `(S)` kernel running on an out of specification system
|
|
Michal Kubecek |
0692bf |
- 8 `(R)` module was force unloaded
|
|
Michal Kubecek |
0692bf |
- 16 `(M)` processor reported a Machine Check Exception (MCE)
|
|
Michal Kubecek |
0692bf |
- 32 `(B)` bad page referenced or some unexpected page flags
|
|
Michal Kubecek |
0692bf |
- 64 `(U)` taint requested by userspace application
|
|
Michal Kubecek |
0692bf |
- 128 `(D)` kernel died recently, i.e. there was an OOPS or BUG
|
|
Michal Kubecek |
0692bf |
- 256 `(A)` an ACPI table was overridden by user
|
|
Michal Kubecek |
0692bf |
- 512 `(W)` kernel issued warning
|
|
Michal Kubecek |
0692bf |
- 1024 `(C)` staging driver was loaded
|
|
Michal Kubecek |
0692bf |
- 2048 `(I)` workaround for bug in platform firmware applied
|
|
Michal Kubecek |
0692bf |
- 4096 `(O)` externally-built ("out-of-tree") module was loaded
|
|
Michal Kubecek |
0692bf |
- 8192 `(E)` unsigned module was loaded
|
|
Michal Kubecek |
0692bf |
- 16384 `(L)` soft lockup occurred
|
|
Michal Kubecek |
0692bf |
- 32768 `(K)` kernel has been live patched
|
|
Michal Suchanek |
a4999e |
- 65536 `(X)` Auxiliary taint, defined and used by for distros
|
|
Michal Kubecek |
0692bf |
-131072 `(T)` The kernel was built with the struct randomization plugin
|
|
Michal Kubecek |
0692bf |
-====== ===== ==============================================================
|
|
Michal Kubecek |
0692bf |
+========== ===== ==========================================================
|
|
Michal Kubecek |
0692bf |
+ 1 `(P)` proprietary module was loaded
|
|
Michal Kubecek |
0692bf |
+ 2 `(F)` module was force loaded
|
|
Jeff Mahoney |
d3dcd1 |
+ 4 `(S)` kernel running on an out of specification system
|
|
Michal Kubecek |
0692bf |
+ 8 `(R)` module was force unloaded
|
|
Michal Kubecek |
0692bf |
+ 16 `(M)` processor reported a Machine Check Exception (MCE)
|
|
Michal Kubecek |
0692bf |
+ 32 `(B)` bad page referenced or some unexpected page flags
|
|
Michal Kubecek |
0692bf |
+ 64 `(U)` taint requested by userspace application
|
|
Michal Kubecek |
0692bf |
+ 128 `(D)` kernel died recently, i.e. there was an OOPS or BUG
|
|
Michal Kubecek |
0692bf |
+ 256 `(A)` an ACPI table was overridden by user
|
|
Michal Kubecek |
0692bf |
+ 512 `(W)` kernel issued warning
|
|
Michal Kubecek |
0692bf |
+ 1024 `(C)` staging driver was loaded
|
|
Michal Kubecek |
0692bf |
+ 2048 `(I)` workaround for bug in platform firmware applied
|
|
Michal Kubecek |
0692bf |
+ 4096 `(O)` externally-built ("out-of-tree") module was loaded
|
|
Michal Kubecek |
0692bf |
+ 8192 `(E)` unsigned module was loaded
|
|
Michal Kubecek |
0692bf |
+ 16384 `(L)` soft lockup occurred
|
|
Michal Kubecek |
0692bf |
+ 32768 `(K)` kernel has been live patched
|
|
Michal Kubecek |
0692bf |
+ 65536 `(X)` A kernel module with external support was loaded
|
|
Michal Kubecek |
0692bf |
+ 131072 `(T)` The kernel was built with the struct randomization plugin
|
|
Michal Kubecek |
c35dc3 |
+2147483648 `(n)` An unsupported kernel module was loaded
|
|
Michal Kubecek |
0692bf |
+========== ===== ==========================================================
|
|
Michal Kubecek |
b493de |
|
|
Michal Kubecek |
34fe32 |
See Documentation/admin-guide/tainted-kernels.rst for more information.
|
|
Michal Kubecek |
b493de |
|
|
Michal Kubecek |
c35dc3 |
--- a/Documentation/admin-guide/tainted-kernels.rst
|
|
Michal Kubecek |
c35dc3 |
+++ b/Documentation/admin-guide/tainted-kernels.rst
|
|
Michal Kubecek |
c35dc3 |
@@ -79,29 +79,31 @@ which bits are set::
|
|
Michal Kubecek |
c35dc3 |
Table for decoding tainted state
|
|
Michal Kubecek |
c35dc3 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
Michal Kubecek |
c35dc3 |
|
|
Michal Kubecek |
c35dc3 |
-=== === ====== ========================================================
|
|
Michal Kubecek |
c35dc3 |
-Bit Log Number Reason that got the kernel tainted
|
|
Michal Kubecek |
c35dc3 |
-=== === ====== ========================================================
|
|
Michal Kubecek |
c35dc3 |
- 0 G/P 1 proprietary module was loaded
|
|
Michal Kubecek |
c35dc3 |
- 1 _/F 2 module was force loaded
|
|
Michal Kubecek |
c35dc3 |
- 2 _/S 4 kernel running on an out of specification system
|
|
Michal Kubecek |
c35dc3 |
- 3 _/R 8 module was force unloaded
|
|
Michal Kubecek |
c35dc3 |
- 4 _/M 16 processor reported a Machine Check Exception (MCE)
|
|
Michal Kubecek |
c35dc3 |
- 5 _/B 32 bad page referenced or some unexpected page flags
|
|
Michal Kubecek |
c35dc3 |
- 6 _/U 64 taint requested by userspace application
|
|
Michal Kubecek |
c35dc3 |
- 7 _/D 128 kernel died recently, i.e. there was an OOPS or BUG
|
|
Michal Kubecek |
c35dc3 |
- 8 _/A 256 ACPI table overridden by user
|
|
Michal Kubecek |
c35dc3 |
- 9 _/W 512 kernel issued warning
|
|
Michal Kubecek |
c35dc3 |
- 10 _/C 1024 staging driver was loaded
|
|
Michal Kubecek |
c35dc3 |
- 11 _/I 2048 workaround for bug in platform firmware applied
|
|
Michal Kubecek |
c35dc3 |
- 12 _/O 4096 externally-built ("out-of-tree") module was loaded
|
|
Michal Kubecek |
c35dc3 |
- 13 _/E 8192 unsigned module was loaded
|
|
Michal Kubecek |
c35dc3 |
- 14 _/L 16384 soft lockup occurred
|
|
Michal Kubecek |
c35dc3 |
- 15 _/K 32768 kernel has been live patched
|
|
Michal Kubecek |
c35dc3 |
- 16 _/X 65536 auxiliary taint, defined for and used by distros
|
|
Michal Kubecek |
c35dc3 |
- 17 _/T 131072 kernel was built with the struct randomization plugin
|
|
Michal Kubecek |
c35dc3 |
- 18 _/N 262144 an in-kernel test has been run
|
|
Michal Kubecek |
c35dc3 |
-=== === ====== ========================================================
|
|
Michal Kubecek |
c35dc3 |
+=== === ========== ========================================================
|
|
Michal Kubecek |
c35dc3 |
+Bit Log Number Reason that got the kernel tainted
|
|
Michal Kubecek |
c35dc3 |
+=== === ========== ========================================================
|
|
Michal Kubecek |
c35dc3 |
+ 0 G/P 1 proprietary module was loaded
|
|
Michal Kubecek |
c35dc3 |
+ 1 _/F 2 module was force loaded
|
|
Michal Kubecek |
c35dc3 |
+ 2 _/S 4 kernel running on an out of specification system
|
|
Michal Kubecek |
c35dc3 |
+ 3 _/R 8 module was force unloaded
|
|
Michal Kubecek |
c35dc3 |
+ 4 _/M 16 processor reported a Machine Check Exception (MCE)
|
|
Michal Kubecek |
c35dc3 |
+ 5 _/B 32 bad page referenced or some unexpected page flags
|
|
Michal Kubecek |
c35dc3 |
+ 6 _/U 64 taint requested by userspace application
|
|
Michal Kubecek |
c35dc3 |
+ 7 _/D 128 kernel died recently, i.e. there was an OOPS or BUG
|
|
Michal Kubecek |
c35dc3 |
+ 8 _/A 256 ACPI table overridden by user
|
|
Michal Kubecek |
c35dc3 |
+ 9 _/W 512 kernel issued warning
|
|
Michal Kubecek |
c35dc3 |
+ 10 _/C 1024 staging driver was loaded
|
|
Michal Kubecek |
c35dc3 |
+ 11 _/I 2048 workaround for bug in platform firmware applied
|
|
Michal Kubecek |
c35dc3 |
+ 12 _/O 4096 externally-built ("out-of-tree") module was loaded
|
|
Michal Kubecek |
c35dc3 |
+ 13 _/E 8192 unsigned module was loaded
|
|
Michal Kubecek |
c35dc3 |
+ 14 _/L 16384 soft lockup occurred
|
|
Michal Kubecek |
c35dc3 |
+ 15 _/K 32768 kernel has been live patched
|
|
Michal Kubecek |
c35dc3 |
+ 16 _/X 65536 auxiliary taint, defined for and used by distros
|
|
Michal Kubecek |
c35dc3 |
+ 17 _/T 131072 kernel was built with the struct randomization plugin
|
|
Michal Kubecek |
c35dc3 |
+ 18 _/N 262144 an in-kernel test has been run
|
|
Michal Kubecek |
c35dc3 |
+ 31 _/n 2147483648 an unsupported kernel module was loaded
|
|
Michal Kubecek |
c35dc3 |
+
|
|
Michal Kubecek |
c35dc3 |
+=== === ========== ========================================================
|
|
Michal Kubecek |
c35dc3 |
|
|
Michal Kubecek |
c35dc3 |
Note: The character ``_`` is representing a blank in this table to make reading
|
|
Michal Kubecek |
c35dc3 |
easier.
|
|
Jeff Mahoney |
7627ac |
--- a/Makefile
|
|
Jeff Mahoney |
7627ac |
+++ b/Makefile
|
|
Michal Kubecek |
769d7a |
@@ -379,6 +379,11 @@ else # !mixed-build
|
|
Michal Suchanek |
10d9b2 |
|
|
Michal Kubecek |
0ba08a |
include $(srctree)/scripts/Kbuild.include
|
|
Jeff Mahoney |
455827 |
|
|
Jeff Mahoney |
455827 |
+# Warn about unsupported modules in kernels built inside Autobuild
|
|
Jeff Mahoney |
455827 |
+ifneq ($(wildcard /.buildenv),)
|
|
Jeff Mahoney |
455827 |
+CFLAGS += -DUNSUPPORTED_MODULES=2
|
|
Jeff Mahoney |
455827 |
+endif
|
|
Jeff Mahoney |
455827 |
+
|
|
Michal Suchanek |
10d9b2 |
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
|
|
Michal Kubecek |
769d7a |
KERNELRELEASE = $(call read-file, include/config/kernel.release)
|
|
Michal Suchanek |
10d9b2 |
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
|
|
Michal Kubecek |
34fe32 |
--- a/include/linux/module.h
|
|
Michal Kubecek |
34fe32 |
+++ b/include/linux/module.h
|
|
Michal Kubecek |
8fc2af |
@@ -572,6 +572,9 @@ bool is_module_address(unsigned long addr);
|
|
Michal Kubecek |
34fe32 |
bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr);
|
|
Michal Kubecek |
34fe32 |
bool is_module_percpu_address(unsigned long addr);
|
|
Michal Kubecek |
34fe32 |
bool is_module_text_address(unsigned long addr);
|
|
Michal Kubecek |
34fe32 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Michal Kubecek |
34fe32 |
+const char *supported_printable(int taint);
|
|
Michal Kubecek |
34fe32 |
+#endif
|
|
Michal Kubecek |
acbbbf |
|
|
Michal Kubecek |
34fe32 |
static inline bool within_module_core(unsigned long addr,
|
|
Michal Kubecek |
34fe32 |
const struct module *mod)
|
|
Michal Kubecek |
34fe32 |
--- a/include/linux/panic.h
|
|
Michal Kubecek |
34fe32 |
+++ b/include/linux/panic.h
|
|
Michal Kubecek |
8fc2af |
@@ -32,6 +32,10 @@ extern int sysctl_panic_on_stackoverflow;
|
|
Jeff Mahoney |
d3dcd1 |
|
|
Jeff Mahoney |
d3dcd1 |
extern bool crash_kexec_post_notifiers;
|
|
Jeff Mahoney |
d3dcd1 |
|
|
Jeff Mahoney |
d3dcd1 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Jeff Mahoney |
d3dcd1 |
+extern int suse_unsupported;
|
|
Jeff Mahoney |
d3dcd1 |
+#endif
|
|
Jeff Mahoney |
d3dcd1 |
+
|
|
Jeff Mahoney |
d3dcd1 |
/*
|
|
Jeff Mahoney |
d3dcd1 |
* panic_cpu is used for synchronizing panic() and crash_kexec() execution. It
|
|
Jeff Mahoney |
d3dcd1 |
* holds a CPU number which is executing panic() currently. A value of
|
|
Michal Kubecek |
8fc2af |
@@ -73,6 +77,20 @@ static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout)
|
|
Michal Kubecek |
c35dc3 |
#define TAINT_FLAGS_COUNT 19
|
|
Michal Kubecek |
887490 |
#define TAINT_FLAGS_MAX ((1UL << TAINT_FLAGS_COUNT) - 1)
|
|
Michal Suchanek |
10d9b2 |
|
|
Michal Suchanek |
10d9b2 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Michal Suchanek |
10d9b2 |
+/*
|
|
Michal Suchanek |
10d9b2 |
+ * Take the upper bits to hopefully allow them
|
|
Michal Suchanek |
10d9b2 |
+ * to stay the same for more than one release.
|
|
Michal Suchanek |
10d9b2 |
+ */
|
|
Michal Suchanek |
a4999e |
+# define TAINT_EXTERNAL_SUPPORT TAINT_AUX
|
|
Michal Suchanek |
a4999e |
+# define TAINT_NO_SUPPORT 31
|
|
Michal Suchanek |
10d9b2 |
+# if TAINT_FLAGS_COUNT >= TAINT_NO_SUPPORT
|
|
Michal Suchanek |
10d9b2 |
+# error Upstream taint flags overlap with SUSE flags
|
|
Michal Suchanek |
10d9b2 |
+# endif
|
|
Michal Suchanek |
10d9b2 |
+# undef TAINT_FLAGS_COUNT
|
|
Michal Suchanek |
10d9b2 |
+# define TAINT_FLAGS_COUNT 32
|
|
Michal Suchanek |
10d9b2 |
+#endif
|
|
Michal Suchanek |
10d9b2 |
+
|
|
Michal Suchanek |
10d9b2 |
struct taint_flag {
|
|
Michal Suchanek |
10d9b2 |
char c_true; /* character printed when tainted */
|
|
Michal Suchanek |
10d9b2 |
char c_false; /* character printed when not tainted */
|
|
Jeff Mahoney |
b7f69f |
--- a/init/Kconfig.suse
|
|
Jeff Mahoney |
b7f69f |
+++ b/init/Kconfig.suse
|
|
Jeff Mahoney |
b7f69f |
@@ -1,2 +1,20 @@
|
|
Jeff Mahoney |
776164 |
config SUSE_KERNEL
|
|
Jeff Mahoney |
776164 |
def_bool y
|
|
Jeff Mahoney |
b7f69f |
+
|
|
Jeff Mahoney |
776164 |
+config SUSE_KERNEL_SUPPORTED
|
|
Jeff Mahoney |
776164 |
+ bool "Enable enterprise support facility"
|
|
Jeff Mahoney |
776164 |
+ depends on SUSE_KERNEL
|
|
Jeff Mahoney |
776164 |
+ help
|
|
Jeff Mahoney |
776164 |
+ This feature enables the handling of the "supported" module flag.
|
|
Jeff Mahoney |
776164 |
+ This flag can be used to report unsupported module loads or even
|
|
Jeff Mahoney |
776164 |
+ refuse them entirely. It is useful when ensuring that the kernel
|
|
Jeff Mahoney |
776164 |
+ remains in a state that SUSE, or its technical partners, is
|
|
Jeff Mahoney |
776164 |
+ prepared to support.
|
|
Jeff Mahoney |
776164 |
+
|
|
Jeff Mahoney |
776164 |
+ Modules in the list of supported modules will be marked supported
|
|
Jeff Mahoney |
776164 |
+ on build. The default enforcement mode is to report, but not
|
|
Jeff Mahoney |
776164 |
+ deny, loading of unsupported modules.
|
|
Jeff Mahoney |
776164 |
+
|
|
Jeff Mahoney |
776164 |
+ If you aren't building a kernel for an enterprise distribution,
|
|
Jeff Mahoney |
776164 |
+ say n.
|
|
Jeff Mahoney |
776164 |
+
|
|
Jeff Mahoney |
7627ac |
--- a/kernel/ksysfs.c
|
|
Jeff Mahoney |
7627ac |
+++ b/kernel/ksysfs.c
|
|
Michal Kubecek |
8fc2af |
@@ -229,6 +229,30 @@ static struct bin_attribute notes_attr __ro_after_init = {
|
|
Jeff Mahoney |
63642f |
struct kobject *kernel_kobj;
|
|
Jeff Mahoney |
63642f |
EXPORT_SYMBOL_GPL(kernel_kobj);
|
|
Jeff Mahoney |
63642f |
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Jeff Mahoney |
63642f |
+const char *supported_printable(int taint)
|
|
Jeff Mahoney |
63642f |
+{
|
|
Michal Marek |
92db6d |
+ int mask = (1 << TAINT_PROPRIETARY_MODULE) | (1 << TAINT_NO_SUPPORT);
|
|
Jeff Mahoney |
63642f |
+ if ((taint & mask) == mask)
|
|
Jeff Mahoney |
63642f |
+ return "No, Proprietary and Unsupported modules are loaded";
|
|
Michal Marek |
92db6d |
+ else if (taint & (1 << TAINT_PROPRIETARY_MODULE))
|
|
Jeff Mahoney |
63642f |
+ return "No, Proprietary modules are loaded";
|
|
Michal Marek |
92db6d |
+ else if (taint & (1 << TAINT_NO_SUPPORT))
|
|
Jeff Mahoney |
63642f |
+ return "No, Unsupported modules are loaded";
|
|
Michal Marek |
92db6d |
+ else if (taint & (1 << TAINT_EXTERNAL_SUPPORT))
|
|
Jeff Mahoney |
63642f |
+ return "Yes, External";
|
|
Jeff Mahoney |
63642f |
+ else
|
|
Jeff Mahoney |
63642f |
+ return "Yes";
|
|
Jeff Mahoney |
63642f |
+}
|
|
Jeff Mahoney |
63642f |
+
|
|
Jeff Mahoney |
63642f |
+static ssize_t supported_show(struct kobject *kobj,
|
|
Jeff Mahoney |
63642f |
+ struct kobj_attribute *attr, char *buf)
|
|
Jeff Mahoney |
63642f |
+{
|
|
Jeff Mahoney |
63642f |
+ return sprintf(buf, "%s\n", supported_printable(get_taint()));
|
|
Jeff Mahoney |
63642f |
+}
|
|
Jeff Mahoney |
63642f |
+KERNEL_ATTR_RO(supported);
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Jeff Mahoney |
63642f |
+
|
|
Jeff Mahoney |
63642f |
static struct attribute * kernel_attrs[] = {
|
|
Jeff Mahoney |
a95ebd |
&fscaps_attr.attr,
|
|
Jeff Mahoney |
a95204 |
&uevent_seqnum_attr.attr,
|
|
Michal Kubecek |
8fc2af |
@@ -250,6 +274,9 @@ static struct attribute * kernel_attrs[] = {
|
|
Michal Kubecek |
8fc2af |
#ifndef CONFIG_TINY_RCU
|
|
Jeff Mahoney |
a95204 |
&rcu_expedited_attr.attr,
|
|
Jeff Mahoney |
f1286b |
&rcu_normal_attr.attr,
|
|
Michal Kubecek |
8fc2af |
+#endif
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Jeff Mahoney |
63642f |
+ &supported_attr.attr,
|
|
Michal Kubecek |
8fc2af |
#endif
|
|
Jeff Mahoney |
63642f |
NULL
|
|
Jeff Mahoney |
63642f |
};
|
|
Michal Kubecek |
515f42 |
--- a/kernel/module/main.c
|
|
Michal Kubecek |
515f42 |
+++ b/kernel/module/main.c
|
|
Michal Kubecek |
769d7a |
@@ -91,6 +91,22 @@ struct symsearch {
|
|
Michal Kubecek |
515f42 |
enum mod_license license;
|
|
Michal Kubecek |
515f42 |
};
|
|
Hubert Mantel |
4f4392 |
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Greg Kroah-Hartman |
7952cb |
+/* Allow unsupported modules switch. */
|
|
Hubert Mantel |
4f4392 |
+#ifdef UNSUPPORTED_MODULES
|
|
Thomas Bogendoerfer |
8457d7 |
+int suse_unsupported = UNSUPPORTED_MODULES;
|
|
Hubert Mantel |
4f4392 |
+#else
|
|
Thomas Bogendoerfer |
8457d7 |
+int suse_unsupported = 2; /* don't warn when loading unsupported modules. */
|
|
Hubert Mantel |
4f4392 |
+#endif
|
|
Hubert Mantel |
4f4392 |
+
|
|
Hubert Mantel |
4f4392 |
+static int __init unsupported_setup(char *str)
|
|
Hubert Mantel |
4f4392 |
+{
|
|
Thomas Bogendoerfer |
8457d7 |
+ get_option(&str, &suse_unsupported);
|
|
Hubert Mantel |
4f4392 |
+ return 1;
|
|
Hubert Mantel |
4f4392 |
+}
|
|
Hubert Mantel |
4f4392 |
+__setup("unsupported=", unsupported_setup);
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Hubert Mantel |
4f4392 |
+
|
|
Jeff Mahoney |
02d6a9 |
/*
|
|
Michal Kubecek |
515f42 |
* Bounds of module text, for speeding up __module_address.
|
|
Michal Kubecek |
515f42 |
* Protected by module_mutex.
|
|
Michal Kubecek |
8fc2af |
@@ -964,6 +980,33 @@ static ssize_t show_taint(struct module_attribute *mattr,
|
|
Jeff Mahoney |
d017ea |
static struct module_attribute modinfo_taint =
|
|
Jeff Mahoney |
d017ea |
__ATTR(taint, 0444, show_taint, NULL);
|
|
Hubert Mantel |
4f4392 |
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Jeff Mahoney |
63642f |
+static void setup_modinfo_supported(struct module *mod, const char *s)
|
|
Jeff Mahoney |
63642f |
+{
|
|
Jeff Mahoney |
63642f |
+ if (!s) {
|
|
Michal Suchanek |
10d9b2 |
+ mod->taints |= (1 << TAINT_NO_SUPPORT);
|
|
Jeff Mahoney |
63642f |
+ return;
|
|
Hubert Mantel |
4f4392 |
+ }
|
|
Jeff Mahoney |
63642f |
+
|
|
Jeff Mahoney |
63642f |
+ if (strcmp(s, "external") == 0)
|
|
Michal Suchanek |
10d9b2 |
+ mod->taints |= (1 << TAINT_EXTERNAL_SUPPORT);
|
|
Jeff Mahoney |
63642f |
+ else if (strcmp(s, "yes"))
|
|
Michal Suchanek |
10d9b2 |
+ mod->taints |= (1 << TAINT_NO_SUPPORT);
|
|
Jeff Mahoney |
63642f |
+}
|
|
Jeff Mahoney |
63642f |
+
|
|
Jeff Mahoney |
63642f |
+static ssize_t show_modinfo_supported(struct module_attribute *mattr,
|
|
Jan Beulich |
aa8917 |
+ struct module_kobject *mk, char *buffer)
|
|
Jeff Mahoney |
63642f |
+{
|
|
Jan Beulich |
aa8917 |
+ return sprintf(buffer, "%s\n", supported_printable(mk->mod->taints));
|
|
Jeff Mahoney |
63642f |
+}
|
|
Jeff Mahoney |
63642f |
+
|
|
Jeff Mahoney |
63642f |
+static struct module_attribute modinfo_supported = {
|
|
Jeff Mahoney |
63642f |
+ .attr = { .name = "supported", .mode = 0444 },
|
|
Jeff Mahoney |
63642f |
+ .show = show_modinfo_supported,
|
|
Jeff Mahoney |
63642f |
+ .setup = setup_modinfo_supported,
|
|
Jeff Mahoney |
63642f |
+};
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Jeff Mahoney |
63642f |
+
|
|
Michal Kubecek |
515f42 |
struct module_attribute *modinfo_attrs[] = {
|
|
Jeff Mahoney |
eccefc |
&module_uevent,
|
|
Jeff Mahoney |
d017ea |
&modinfo_version,
|
|
Michal Kubecek |
8fc2af |
@@ -975,6 +1018,9 @@ struct module_attribute *modinfo_attrs[] = {
|
|
Michal Kubecek |
515f42 |
#endif
|
|
Jeff Mahoney |
d017ea |
&modinfo_initsize,
|
|
Jeff Mahoney |
d017ea |
&modinfo_taint,
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Jeff Mahoney |
63642f |
+ &modinfo_supported,
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Jeff Mahoney |
63642f |
#ifdef CONFIG_MODULE_UNLOAD
|
|
Jeff Mahoney |
d017ea |
&modinfo_refcnt,
|
|
Jeff Mahoney |
63642f |
#endif
|
|
Michal Kubecek |
769d7a |
@@ -3124,4 +3170,7 @@ void print_modules(void)
|
|
Michal Kubecek |
c35dc3 |
pr_cont(" [last unloaded: %s%s]", last_unloaded_module.name,
|
|
Michal Kubecek |
c35dc3 |
last_unloaded_module.taints);
|
|
Michal Kubecek |
515f42 |
pr_cont("\n");
|
|
Michal Kubecek |
515f42 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Michal Kubecek |
515f42 |
+ printk("Supported: %s\n", supported_printable(get_taint()));
|
|
Michal Kubecek |
515f42 |
+#endif
|
|
Michal Kubecek |
515f42 |
}
|
|
Michal Kubecek |
515f42 |
--- a/kernel/module/sysfs.c
|
|
Michal Kubecek |
515f42 |
+++ b/kernel/module/sysfs.c
|
|
Michal Kubecek |
515f42 |
@@ -399,8 +399,37 @@ int mod_sysfs_setup(struct module *mod,
|
|
Jeff Mahoney |
63642f |
add_sect_attrs(mod, info);
|
|
Jeff Mahoney |
63642f |
add_notes_attrs(mod, info);
|
|
Jeff Mahoney |
63642f |
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Libor Pechacek |
3fd4e9 |
+ if (mod->taints & (1 << TAINT_EXTERNAL_SUPPORT)) {
|
|
Libor Pechacek |
3fd4e9 |
+ pr_notice("%s: externally supported module, "
|
|
Libor Pechacek |
3fd4e9 |
+ "setting X kernel taint flag.\n", mod->name);
|
|
Michal Suchanek |
10d9b2 |
+ add_taint(TAINT_EXTERNAL_SUPPORT, LOCKDEP_STILL_OK);
|
|
Libor Pechacek |
3fd4e9 |
+ } else if (mod->taints & (1 << TAINT_NO_SUPPORT)) {
|
|
Thomas Bogendoerfer |
8457d7 |
+ if (suse_unsupported == 0) {
|
|
Andreas Gruenbacher |
c2d682 |
+ printk(KERN_WARNING "%s: module not supported by "
|
|
Jeff Mahoney |
776164 |
+ "SUSE, refusing to load. To override, echo "
|
|
Andreas Gruenbacher |
c2d682 |
+ "1 > /proc/sys/kernel/unsupported\n", mod->name);
|
|
Hubert Mantel |
4f4392 |
+ err = -ENOEXEC;
|
|
Jeff Mahoney |
776164 |
+ goto out_remove_attrs;
|
|
Hubert Mantel |
4f4392 |
+ }
|
|
Michal Suchanek |
10d9b2 |
+ add_taint(TAINT_NO_SUPPORT, LOCKDEP_STILL_OK);
|
|
Thomas Bogendoerfer |
8457d7 |
+ if (suse_unsupported == 1) {
|
|
Jeff Mahoney |
63642f |
+ printk(KERN_WARNING "%s: module is not supported by "
|
|
Jeff Mahoney |
776164 |
+ "SUSE. Our support organization may not be "
|
|
Jeff Mahoney |
776164 |
+ "able to address your support request if it "
|
|
Jeff Mahoney |
776164 |
+ "involves a kernel fault.\n", mod->name);
|
|
Hubert Mantel |
4f4392 |
+ }
|
|
Hubert Mantel |
4f4392 |
+ }
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Hubert Mantel |
4f4392 |
+
|
|
Jeff Mahoney |
63642f |
return 0;
|
|
Jeff Mahoney |
63642f |
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Jeff Mahoney |
776164 |
+out_remove_attrs:
|
|
Jeff Mahoney |
776164 |
+ remove_notes_attrs(mod);
|
|
Jeff Mahoney |
776164 |
+ remove_sect_attrs(mod);
|
|
Jeff Mahoney |
776164 |
+ del_usage_links(mod);
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Jeff Mahoney |
d41853 |
out_unreg_modinfo_attrs:
|
|
Michal Kubecek |
0a6d0d |
module_remove_modinfo_attrs(mod, -1);
|
|
Jeff Mahoney |
776164 |
out_unreg_param:
|
|
Michal Suchanek |
10d9b2 |
--- a/kernel/panic.c
|
|
Michal Suchanek |
10d9b2 |
+++ b/kernel/panic.c
|
|
Michal Kubecek |
8fc2af |
@@ -470,6 +470,9 @@ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = {
|
|
Michal Suchanek |
10d9b2 |
[ TAINT_AUX ] = { 'X', ' ', true },
|
|
Michal Suchanek |
10d9b2 |
[ TAINT_RANDSTRUCT ] = { 'T', ' ', true },
|
|
Michal Kubecek |
c35dc3 |
[ TAINT_TEST ] = { 'N', ' ', true },
|
|
Michal Suchanek |
10d9b2 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Michal Kubecek |
c35dc3 |
+ [ TAINT_NO_SUPPORT ] = { 'n', ' ', true },
|
|
Michal Suchanek |
10d9b2 |
+#endif
|
|
Michal Suchanek |
10d9b2 |
};
|
|
Michal Suchanek |
10d9b2 |
|
|
Michal Suchanek |
10d9b2 |
/**
|
|
Jeff Mahoney |
7627ac |
--- a/kernel/sysctl.c
|
|
Jeff Mahoney |
7627ac |
+++ b/kernel/sysctl.c
|
|
Michal Kubecek |
769d7a |
@@ -1840,6 +1840,15 @@ static struct ctl_table kern_table[] = {
|
|
Jeff Mahoney |
d4b615 |
.extra1 = &pid_max_min,
|
|
Jeff Mahoney |
d4b615 |
.extra2 = &pid_max_max,
|
|
Hubert Mantel |
4f4392 |
},
|
|
Jeff Mahoney |
776164 |
+#if defined(CONFIG_MODULES) && defined(CONFIG_SUSE_KERNEL_SUPPORTED)
|
|
Hubert Mantel |
4f4392 |
+ {
|
|
Hubert Mantel |
4f4392 |
+ .procname = "unsupported",
|
|
Thomas Bogendoerfer |
8457d7 |
+ .data = &suse_unsupported,
|
|
Hubert Mantel |
4f4392 |
+ .maxlen = sizeof(int),
|
|
Hubert Mantel |
4f4392 |
+ .mode = 0644,
|
|
Hubert Mantel |
4f4392 |
+ .proc_handler = &proc_dointvec,
|
|
Hubert Mantel |
4f4392 |
+ },
|
|
Hubert Mantel |
4f4392 |
+#endif
|
|
Hubert Mantel |
4f4392 |
{
|
|
Jeff Mahoney |
d4b615 |
.procname = "panic_on_oops",
|
|
Jeff Mahoney |
d4b615 |
.data = &panic_on_oops,
|
|
Jeff Mahoney |
7627ac |
--- a/scripts/Makefile.modpost
|
|
Jeff Mahoney |
7627ac |
+++ b/scripts/Makefile.modpost
|
|
Michal Kubecek |
8fc2af |
@@ -56,6 +56,11 @@ ifneq ($(findstring i,$(filter-out --%,$(MAKEFLAGS))),)
|
|
Michal Kubecek |
8fc2af |
modpost-args += -n
|
|
Michal Kubecek |
769d7a |
endif
|
|
Andreas Gruenbacher |
8c96cb |
|
|
Jeff Mahoney |
b03fb0 |
+ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Jeff Mahoney |
b03fb0 |
+modpost-args += -S $(firstword $(wildcard $(extmod-Module.supported) \
|
|
Jeff Mahoney |
b03fb0 |
+ Module.supported /dev/null))
|
|
Jeff Mahoney |
b03fb0 |
+endif
|
|
Jeff Mahoney |
d3dcd1 |
+
|
|
Jeff Mahoney |
d3dcd1 |
# Read out modules.order to pass in modpost.
|
|
Jeff Mahoney |
d3dcd1 |
# Otherwise, allmodconfig would fail with "Argument list too long".
|
|
Michal Kubecek |
8e1570 |
ifdef KBUILD_MODULES
|
|
Michal Kubecek |
8fc2af |
@@ -119,6 +124,7 @@ endif
|
|
Jeff Mahoney |
b03fb0 |
|
|
Jeff Mahoney |
b03fb0 |
modpost-args += -e $(addprefix -i , $(KBUILD_EXTRA_SYMBOLS))
|
|
Jeff Mahoney |
b03fb0 |
|
|
Jeff Mahoney |
b03fb0 |
+extmod-Module.supported := $(KBUILD_EXTMOD)/Module.supported
|
|
Jeff Mahoney |
b03fb0 |
endif # ($(KBUILD_EXTMOD),)
|
|
Jeff Mahoney |
b03fb0 |
|
|
Michal Kubecek |
8fc2af |
ifneq ($(missing-input),)
|
|
Jeff Mahoney |
7627ac |
--- a/scripts/mod/modpost.c
|
|
Jeff Mahoney |
7627ac |
+++ b/scripts/mod/modpost.c
|
|
Michal Kubecek |
515f42 |
@@ -17,10 +17,12 @@
|
|
Jeff Mahoney |
d3dcd1 |
#include <stdio.h>
|
|
Jeff Mahoney |
d3dcd1 |
#include <ctype.h>
|
|
Jeff Mahoney |
d3dcd1 |
#include <string.h>
|
|
Jeff Mahoney |
d3dcd1 |
+#include <fnmatch.h>
|
|
Michal Kubecek |
42fc05 |
#include <limits.h>
|
|
Michal Kubecek |
878777 |
#include <stdbool.h>
|
|
Jan Beulich |
8b0e2e |
#include <errno.h>
|
|
Jan Beulich |
8b0e2e |
#include "modpost.h"
|
|
Jan Beulich |
8b0e2e |
+#include "../../include/generated/autoconf.h"
|
|
Jan Beulich |
8b0e2e |
#include "../../include/linux/license.h"
|
|
Jan Beulich |
8b0e2e |
|
|
Jan Beulich |
8b0e2e |
/* Are we using CONFIG_MODVERSIONS? */
|
|
Michal Kubecek |
8fc2af |
@@ -1783,6 +1785,133 @@ static void mod_set_crcs(struct module *mod)
|
|
Michal Kubecek |
515f42 |
free(buf);
|
|
Andreas Gruenbacher |
8c96cb |
}
|
|
Andreas Gruenbacher |
8c96cb |
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Jeff Mahoney |
d3dcd1 |
+/*
|
|
Jeff Mahoney |
d3dcd1 |
+ * Replace dashes with underscores.
|
|
Jeff Mahoney |
d3dcd1 |
+ * Dashes inside character range patterns (e.g. [0-9]) are left unchanged.
|
|
Jeff Mahoney |
d3dcd1 |
+ * (copied from module-init-tools/util.c)
|
|
Jeff Mahoney |
d3dcd1 |
+ */
|
|
Jeff Mahoney |
d3dcd1 |
+static char *underscores(char *string)
|
|
Jeff Mahoney |
d3dcd1 |
+{
|
|
Jeff Mahoney |
d3dcd1 |
+ unsigned int i;
|
|
Jeff Mahoney |
d3dcd1 |
+
|
|
Jeff Mahoney |
d3dcd1 |
+ if (!string)
|
|
Jeff Mahoney |
d3dcd1 |
+ return NULL;
|
|
Jeff Mahoney |
d3dcd1 |
+
|
|
Jeff Mahoney |
d3dcd1 |
+ for (i = 0; string[i]; i++) {
|
|
Jeff Mahoney |
d3dcd1 |
+ switch (string[i]) {
|
|
Jeff Mahoney |
d3dcd1 |
+ case '-':
|
|
Jeff Mahoney |
d3dcd1 |
+ string[i] = '_';
|
|
Jeff Mahoney |
d3dcd1 |
+ break;
|
|
Jeff Mahoney |
d3dcd1 |
+
|
|
Jeff Mahoney |
d3dcd1 |
+ case ']':
|
|
Jeff Mahoney |
d3dcd1 |
+ warn("Unmatched bracket in %s\n", string);
|
|
Jeff Mahoney |
d3dcd1 |
+ break;
|
|
Jeff Mahoney |
d3dcd1 |
+
|
|
Jeff Mahoney |
d3dcd1 |
+ case '[':
|
|
Jeff Mahoney |
d3dcd1 |
+ i += strcspn(&string[i], "]");
|
|
Jeff Mahoney |
d3dcd1 |
+ if (!string[i])
|
|
Jeff Mahoney |
d3dcd1 |
+ warn("Unmatched bracket in %s\n", string);
|
|
Jeff Mahoney |
d3dcd1 |
+ break;
|
|
Jeff Mahoney |
d3dcd1 |
+ }
|
|
Jeff Mahoney |
d3dcd1 |
+ }
|
|
Jeff Mahoney |
d3dcd1 |
+ return string;
|
|
Jeff Mahoney |
d3dcd1 |
+}
|
|
Jeff Mahoney |
d3dcd1 |
+
|
|
Michal Kubecek |
0c612f |
+/**
|
|
Michal Kubecek |
0c612f |
+ * Return a copy of the next line in a mmap'ed file.
|
|
Michal Kubecek |
0c612f |
+ * spaces in the beginning of the line is trimmed away.
|
|
Michal Kubecek |
0c612f |
+ * Return a pointer to a static buffer.
|
|
Michal Kubecek |
0c612f |
+ **/
|
|
Michal Kubecek |
0c612f |
+static char *get_next_line(unsigned long *pos, void *file, unsigned long size)
|
|
Michal Kubecek |
0c612f |
+{
|
|
Michal Kubecek |
0c612f |
+ static char line[4096];
|
|
Michal Kubecek |
0c612f |
+ int skip = 1;
|
|
Michal Kubecek |
0c612f |
+ size_t len = 0;
|
|
Michal Kubecek |
0c612f |
+ signed char *p = (signed char *)file + *pos;
|
|
Michal Kubecek |
0c612f |
+ char *s = line;
|
|
Michal Kubecek |
0c612f |
+
|
|
Michal Kubecek |
0c612f |
+ for (; *pos < size ; (*pos)++) {
|
|
Michal Kubecek |
0c612f |
+ if (skip && isspace(*p)) {
|
|
Michal Kubecek |
0c612f |
+ p++;
|
|
Michal Kubecek |
0c612f |
+ continue;
|
|
Michal Kubecek |
0c612f |
+ }
|
|
Michal Kubecek |
0c612f |
+ skip = 0;
|
|
Michal Kubecek |
0c612f |
+ if (*p != '\n' && (*pos < size)) {
|
|
Michal Kubecek |
0c612f |
+ len++;
|
|
Michal Kubecek |
0c612f |
+ *s++ = *p++;
|
|
Michal Kubecek |
0c612f |
+ if (len > 4095)
|
|
Michal Kubecek |
0c612f |
+ break; /* Too long, stop */
|
|
Michal Kubecek |
0c612f |
+ } else {
|
|
Michal Kubecek |
0c612f |
+ /* End of string */
|
|
Michal Kubecek |
0c612f |
+ *s = '\0';
|
|
Michal Kubecek |
0c612f |
+ return line;
|
|
Michal Kubecek |
0c612f |
+ }
|
|
Michal Kubecek |
0c612f |
+ }
|
|
Michal Kubecek |
0c612f |
+ /* End of buffer */
|
|
Michal Kubecek |
0c612f |
+ return NULL;
|
|
Michal Kubecek |
0c612f |
+}
|
|
Michal Kubecek |
0c612f |
+
|
|
Jeff Mahoney |
d3dcd1 |
+char *supported_file;
|
|
Andreas Gruenbacher |
197b4b |
+unsigned long supported_size;
|
|
Andreas Gruenbacher |
8c96cb |
+
|
|
Jeff Mahoney |
d3dcd1 |
+static const char *supported(const char *modname)
|
|
Andreas Gruenbacher |
8c96cb |
+{
|
|
Andreas Gruenbacher |
8c96cb |
+ unsigned long pos = 0;
|
|
Andreas Gruenbacher |
aa6a7e |
+ char *line;
|
|
Andreas Gruenbacher |
8c96cb |
+
|
|
Andreas Gruenbacher |
8c96cb |
+ /* In a first shot, do a simple linear scan. */
|
|
Andreas Gruenbacher |
197b4b |
+ while ((line = get_next_line(&pos, supported_file,
|
|
Andreas Gruenbacher |
197b4b |
+ supported_size))) {
|
|
Jeff Mahoney |
d3dcd1 |
+ const char *how = "yes";
|
|
Andreas Gruenbacher |
aa6a7e |
+ char *l = line;
|
|
Jeff Mahoney |
d3dcd1 |
+ char *pat_basename, *mod, *orig_mod, *mod_basename;
|
|
Andreas Gruenbacher |
aa6a7e |
+
|
|
Andreas Gruenbacher |
aa6a7e |
+ /* optional type-of-support flag */
|
|
Andreas Gruenbacher |
aa6a7e |
+ for (l = line; *l != '\0'; l++) {
|
|
Andreas Gruenbacher |
aa6a7e |
+ if (*l == ' ' || *l == '\t') {
|
|
Andreas Gruenbacher |
aa6a7e |
+ *l = '\0';
|
|
Andreas Gruenbacher |
aa6a7e |
+ how = l + 1;
|
|
Andreas Gruenbacher |
aa6a7e |
+ break;
|
|
Andreas Gruenbacher |
aa6a7e |
+ }
|
|
Andreas Gruenbacher |
aa6a7e |
+ }
|
|
Andreas Gruenbacher |
aa6a7e |
+ /* strip .ko extension */
|
|
Andreas Gruenbacher |
aa6a7e |
+ l = line + strlen(line);
|
|
Andreas Gruenbacher |
aa6a7e |
+ if (l - line > 3 && !strcmp(l-3, ".ko"))
|
|
Andreas Gruenbacher |
aa6a7e |
+ *(l-3) = '\0';
|
|
Andreas Gruenbacher |
aa6a7e |
+
|
|
Jeff Mahoney |
d3dcd1 |
+ /*
|
|
Jeff Mahoney |
d3dcd1 |
+ * convert dashes to underscores in the last path component
|
|
Jeff Mahoney |
d3dcd1 |
+ * of line and mod
|
|
Jeff Mahoney |
d3dcd1 |
+ */
|
|
Jeff Mahoney |
d3dcd1 |
+ if ((pat_basename = strrchr(line, '/')))
|
|
Jeff Mahoney |
d3dcd1 |
+ pat_basename++;
|
|
Jeff Mahoney |
d3dcd1 |
+ else
|
|
Jeff Mahoney |
d3dcd1 |
+ pat_basename = line;
|
|
Jeff Mahoney |
d3dcd1 |
+ underscores(pat_basename);
|
|
Jeff Mahoney |
d3dcd1 |
+
|
|
Jeff Mahoney |
d3dcd1 |
+ orig_mod = mod = strdup(modname);
|
|
Jeff Mahoney |
d3dcd1 |
+ if ((mod_basename = strrchr(mod, '/')))
|
|
Jeff Mahoney |
d3dcd1 |
+ mod_basename++;
|
|
Andreas Gruenbacher |
aa6a7e |
+ else
|
|
Jeff Mahoney |
d3dcd1 |
+ mod_basename = mod;
|
|
Jeff Mahoney |
d3dcd1 |
+ underscores(mod_basename);
|
|
Jeff Mahoney |
d3dcd1 |
+
|
|
Jeff Mahoney |
d3dcd1 |
+ /* only compare the last component if no wildcards are used */
|
|
Jeff Mahoney |
d3dcd1 |
+ if (strcspn(line, "[]*?") == strlen(line)) {
|
|
Jeff Mahoney |
d3dcd1 |
+ line = pat_basename;
|
|
Jeff Mahoney |
d3dcd1 |
+ mod = mod_basename;
|
|
Jeff Mahoney |
d3dcd1 |
+ }
|
|
Jeff Mahoney |
d3dcd1 |
+ if (!fnmatch(line, mod, 0)) {
|
|
Jeff Mahoney |
d3dcd1 |
+ free(orig_mod);
|
|
Andreas Gruenbacher |
aa6a7e |
+ return how;
|
|
Jeff Mahoney |
d3dcd1 |
+ }
|
|
Jeff Mahoney |
d3dcd1 |
+ free(orig_mod);
|
|
Andreas Gruenbacher |
8c96cb |
+ }
|
|
Andreas Gruenbacher |
aa6a7e |
+ return NULL;
|
|
Andreas Gruenbacher |
8c96cb |
+}
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Andreas Gruenbacher |
8c96cb |
+
|
|
Michal Kubecek |
549a5b |
static void read_symbols(const char *modname)
|
|
Andreas Gruenbacher |
8c96cb |
{
|
|
Andreas Gruenbacher |
197b4b |
const char *symname;
|
|
Michal Kubecek |
8fc2af |
@@ -2040,6 +2169,15 @@ static void add_exported_symbols(struct buffer *buf, struct module *mod)
|
|
Michal Kubecek |
515f42 |
}
|
|
Jeff Mahoney |
08ca98 |
}
|
|
Andreas Gruenbacher |
8c96cb |
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Michal Marek |
603efc |
+static void add_supported_flag(struct buffer *b, struct module *mod)
|
|
Andreas Gruenbacher |
8c96cb |
+{
|
|
Jeff Mahoney |
d3dcd1 |
+ const char *how = supported(mod->name);
|
|
Andreas Gruenbacher |
aa6a7e |
+ if (how)
|
|
Andreas Gruenbacher |
aa6a7e |
+ buf_printf(b, "\nMODULE_INFO(supported, \"%s\");\n", how);
|
|
Andreas Gruenbacher |
8c96cb |
+}
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Andreas Gruenbacher |
8c96cb |
+
|
|
Andreas Gruenbacher |
197b4b |
/**
|
|
Andreas Gruenbacher |
197b4b |
* Record CRCs for unresolved symbols
|
|
Andreas Gruenbacher |
197b4b |
**/
|
|
Michal Kubecek |
8fc2af |
@@ -2197,6 +2335,9 @@ static void write_mod_c_file(struct module *mod)
|
|
Michal Kubecek |
515f42 |
|
|
Michal Kubecek |
515f42 |
add_header(&buf, mod);
|
|
Michal Kubecek |
515f42 |
add_exported_symbols(&buf, mod);
|
|
Michal Kubecek |
515f42 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Michal Kubecek |
515f42 |
+ add_supported_flag(&buf, mod);
|
|
Michal Kubecek |
515f42 |
+#endif
|
|
Michal Kubecek |
515f42 |
add_versions(&buf, mod);
|
|
Michal Kubecek |
515f42 |
add_depends(&buf, mod);
|
|
Michal Kubecek |
515f42 |
add_moddevtable(&buf, mod);
|
|
Michal Kubecek |
8fc2af |
@@ -2214,6 +2355,17 @@ static void write_mod_c_file(struct module *mod)
|
|
Michal Kubecek |
515f42 |
free(buf.p);
|
|
Andreas Gruenbacher |
8c96cb |
}
|
|
Andreas Gruenbacher |
8c96cb |
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Michal Marek |
603efc |
+static void read_supported(const char *fname)
|
|
Andreas Gruenbacher |
8c96cb |
+{
|
|
Jeff Mahoney |
d3dcd1 |
+ if (fname) {
|
|
Jeff Mahoney |
d3dcd1 |
+ supported_file = grab_file(fname, &supported_size);
|
|
Jeff Mahoney |
d3dcd1 |
+ if (!supported_file)
|
|
Jeff Mahoney |
d3dcd1 |
+ ; /* ignore error */
|
|
Jeff Mahoney |
d3dcd1 |
+ }
|
|
Andreas Gruenbacher |
8c96cb |
+}
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Andreas Gruenbacher |
8c96cb |
+
|
|
Greg Kroah-Hartman |
e0a4f7 |
/* parse Module.symvers file. line format:
|
|
Michal Kubecek |
0801cd |
* 0x12345678<tab>symbol<tab>module<tab>export<tab>namespace
|
|
Greg Kroah-Hartman |
e0a4f7 |
**/
|
|
Michal Kubecek |
769d7a |
@@ -2330,11 +2482,14 @@ int main(int argc, char **argv)
|
|
Michal Kubecek |
515f42 |
struct module *mod;
|
|
Michal Kubecek |
6af0b1 |
char *missing_namespace_deps = NULL;
|
|
Jeff Mahoney |
0ead2a |
char *dump_write = NULL, *files_source = NULL;
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Olaf Hering |
abf163 |
+ const char *supported = NULL;
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Greg Kroah-Hartman |
885000 |
int opt;
|
|
Michal Kubecek |
515f42 |
LIST_HEAD(dump_lists);
|
|
Michal Kubecek |
515f42 |
struct dump_list *dl, *dl2;
|
|
Andreas Gruenbacher |
8c96cb |
|
|
Michal Kubecek |
887490 |
- while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:")) != -1) {
|
|
Michal Kubecek |
887490 |
+ while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:S:")) != -1) {
|
|
Jeff Mahoney |
6b77d3 |
switch (opt) {
|
|
Michal Kubecek |
887490 |
case 'e':
|
|
Michal Kubecek |
515f42 |
external_module = true;
|
|
Michal Kubecek |
769d7a |
@@ -2371,11 +2526,20 @@ int main(int argc, char **argv)
|
|
Michal Kubecek |
059916 |
case 'd':
|
|
Michal Kubecek |
6af0b1 |
missing_namespace_deps = optarg;
|
|
Jeff Mahoney |
d4b615 |
break;
|
|
Michal Kubecek |
84ddad |
+ case 'S':
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Jeff Mahoney |
6b77d3 |
+ supported = optarg;
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Jeff Mahoney |
6b77d3 |
+ break;
|
|
Jeff Mahoney |
6b77d3 |
default:
|
|
Jeff Mahoney |
6b77d3 |
exit(1);
|
|
Andreas Gruenbacher |
8c96cb |
}
|
|
Andreas Gruenbacher |
8c96cb |
}
|
|
Andreas Gruenbacher |
8c96cb |
|
|
Jeff Mahoney |
776164 |
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
|
|
Jeff Mahoney |
d3dcd1 |
+ read_supported(supported);
|
|
Jeff Mahoney |
776164 |
+#endif
|
|
Jeff Mahoney |
d3dcd1 |
+
|
|
Michal Kubecek |
515f42 |
list_for_each_entry_safe(dl, dl2, &dump_lists, list) {
|
|
Michal Kubecek |
515f42 |
read_dump(dl->file);
|
|
Michal Kubecek |
515f42 |
list_del(&dl->list);
|