]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.39/patches.drivers/0001-Staging-add-TAINT_CRAP-for-all-drivers-staging-code.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.drivers / 0001-Staging-add-TAINT_CRAP-for-all-drivers-staging-code.patch
diff --git a/src/patches/suse-2.6.27.39/patches.drivers/0001-Staging-add-TAINT_CRAP-for-all-drivers-staging-code.patch b/src/patches/suse-2.6.27.39/patches.drivers/0001-Staging-add-TAINT_CRAP-for-all-drivers-staging-code.patch
new file mode 100644 (file)
index 0000000..f8c2897
--- /dev/null
@@ -0,0 +1,110 @@
+From 061b1bd394ca8628b7c24eb4658ba3535da4249a Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Date: Wed, 24 Sep 2008 14:46:44 -0700
+Subject: [PATCH 01/23] Staging: add TAINT_CRAP for all drivers/staging code
+Patch-mainline: 2.6.28
+
+We need to add a flag for all code that is in the drivers/staging/
+directory to prevent all other kernel developers from worrying about
+issues here, and to notify users that the drivers might not be as good
+as they are normally used to.
+
+Based on code from Andreas Gruenbacher and Jeff Mahoney to provide a
+TAINT flag for the support level of a kernel module in the Novell
+enterprise kernel release.
+
+This is the kernel portion of this feature, the ability for the flag to
+be set needs to be done in the build process and will happen in a
+follow-up patch.
+
+Cc: Andreas Gruenbacher <agruen@suse.de>
+Cc: Jeff Mahoney <jeffm@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ Documentation/sysctl/kernel.txt |    1 +
+ include/linux/kernel.h          |    1 +
+ kernel/module.c                 |   11 +++++++++++
+ kernel/panic.c                  |    4 +++-
+ 4 files changed, 16 insertions(+), 1 deletion(-)
+
+--- a/Documentation/sysctl/kernel.txt
++++ b/Documentation/sysctl/kernel.txt
+@@ -369,6 +369,7 @@ can be ORed together:
+   2 - A module was force loaded by insmod -f.
+       Set by modutils >= 2.4.9 and module-init-tools.
+   4 - Unsafe SMP processors: SMP with CPUs not designed for SMP.
++ 64 - A module from drivers/staging was loaded.
+  0x40000000 - An unsupported kernel module was loaded.
+  0x80000000 - An kernel module with external support was loaded.
+--- a/include/linux/kernel.h
++++ b/include/linux/kernel.h
+@@ -263,6 +263,7 @@ extern enum system_states {
+ #define TAINT_DIE                     (1<<7)
+ #define TAINT_OVERRIDDEN_ACPI_TABLE   (1<<8)
+ #define TAINT_WARN                    (1<<9)
++#define TAINT_CRAP                    (1<<10)
+ /*
+  * Take the upper bits to hopefully allow them
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -1894,6 +1894,7 @@ static noinline struct module *load_modu
+       Elf_Ehdr *hdr;
+       Elf_Shdr *sechdrs;
+       char *secstrings, *args, *modmagic, *strtab = NULL;
++      char *staging;
+       unsigned int i;
+       unsigned int symindex = 0;
+       unsigned int strindex = 0;
+@@ -2051,6 +2052,14 @@ static noinline struct module *load_modu
+               goto free_hdr;
+       }
++      staging = get_modinfo(sechdrs, infoindex, "staging");
++      if (staging) {
++              add_taint_module(mod, TAINT_CRAP);
++              printk(KERN_WARNING "%s: module is from the staging directory,"
++                     " the quality is unknown, you have been warned.\n",
++                     mod->name);
++      }
++
+       /* Now copy in args */
+       args = strndup_user(uargs, ~0UL >> 1);
+       if (IS_ERR(args)) {
+@@ -2699,6 +2708,8 @@ static char *module_flags(struct module 
+                       buf[bx++] = 'P';
+               if (mod->taints & TAINT_FORCED_MODULE)
+                       buf[bx++] = 'F';
++              if (mod->taints & TAINT_CRAP)
++                      buf[bx++] = 'C';
+               if (mod->taints & TAINT_NO_SUPPORT)
+                       buf[bx++] = 'N';
+               if (mod->taints & TAINT_EXTERNAL_SUPPORT)
+--- a/kernel/panic.c
++++ b/kernel/panic.c
+@@ -178,6 +178,7 @@ EXPORT_SYMBOL(panic);
+  *  'U' - Userspace-defined naughtiness.
+  *  'A' - ACPI table overridden.
+  *  'W' - Taint on warning.
++ *  'C' - modules from drivers/staging are loaded.
+  *  'N' - Unsuported modules loaded.
+  *  'X' - Modules with external support loaded.
+  *
+@@ -188,7 +189,7 @@ const char *print_tainted(void)
+ {
+       static char buf[20];
+       if (tainted) {
+-              snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c%c%c%c%c",
++              snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c%c%c%c%c%c",
+                       tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G',
+                       tainted & TAINT_FORCED_MODULE ? 'F' : ' ',
+                       tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
+@@ -199,6 +200,7 @@ const char *print_tainted(void)
+                       tainted & TAINT_DIE ? 'D' : ' ',
+                       tainted & TAINT_OVERRIDDEN_ACPI_TABLE ? 'A' : ' ',
+                       tainted & TAINT_WARN ? 'W' : ' ',
++                      tainted & TAINT_CRAP ? 'C' : ' ',
+                       tainted & TAINT_NO_SUPPORT ? 'N' : ' ',
+                       tainted & TAINT_EXTERNAL_SUPPORT ? 'X' : ' ');
+       }