Commit 061b1bd3 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: add TAINT_CRAP for all drivers/staging code

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b922df73
...@@ -369,4 +369,5 @@ can be ORed together: ...@@ -369,4 +369,5 @@ can be ORed together:
2 - A module was force loaded by insmod -f. 2 - A module was force loaded by insmod -f.
Set by modutils >= 2.4.9 and module-init-tools. Set by modutils >= 2.4.9 and module-init-tools.
4 - Unsafe SMP processors: SMP with CPUs not designed for SMP. 4 - Unsafe SMP processors: SMP with CPUs not designed for SMP.
64 - A module from drivers/staging was loaded.
...@@ -260,6 +260,7 @@ extern enum system_states { ...@@ -260,6 +260,7 @@ extern enum system_states {
#define TAINT_DIE (1<<7) #define TAINT_DIE (1<<7)
#define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) #define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8)
#define TAINT_WARN (1<<9) #define TAINT_WARN (1<<9)
#define TAINT_CRAP (1<<10)
extern void dump_stack(void) __cold; extern void dump_stack(void) __cold;
......
...@@ -1806,6 +1806,7 @@ static noinline struct module *load_module(void __user *umod, ...@@ -1806,6 +1806,7 @@ static noinline struct module *load_module(void __user *umod,
Elf_Ehdr *hdr; Elf_Ehdr *hdr;
Elf_Shdr *sechdrs; Elf_Shdr *sechdrs;
char *secstrings, *args, *modmagic, *strtab = NULL; char *secstrings, *args, *modmagic, *strtab = NULL;
char *staging;
unsigned int i; unsigned int i;
unsigned int symindex = 0; unsigned int symindex = 0;
unsigned int strindex = 0; unsigned int strindex = 0;
...@@ -1960,6 +1961,14 @@ static noinline struct module *load_module(void __user *umod, ...@@ -1960,6 +1961,14 @@ static noinline struct module *load_module(void __user *umod,
goto free_hdr; 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 */ /* Now copy in args */
args = strndup_user(uargs, ~0UL >> 1); args = strndup_user(uargs, ~0UL >> 1);
if (IS_ERR(args)) { if (IS_ERR(args)) {
...@@ -2556,6 +2565,8 @@ static char *module_flags(struct module *mod, char *buf) ...@@ -2556,6 +2565,8 @@ static char *module_flags(struct module *mod, char *buf)
buf[bx++] = 'P'; buf[bx++] = 'P';
if (mod->taints & TAINT_FORCED_MODULE) if (mod->taints & TAINT_FORCED_MODULE)
buf[bx++] = 'F'; buf[bx++] = 'F';
if (mod->taints & TAINT_CRAP)
buf[bx++] = 'C';
/* /*
* TAINT_FORCED_RMMOD: could be added. * TAINT_FORCED_RMMOD: could be added.
* TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't
......
...@@ -155,6 +155,7 @@ EXPORT_SYMBOL(panic); ...@@ -155,6 +155,7 @@ EXPORT_SYMBOL(panic);
* 'U' - Userspace-defined naughtiness. * 'U' - Userspace-defined naughtiness.
* 'A' - ACPI table overridden. * 'A' - ACPI table overridden.
* 'W' - Taint on warning. * 'W' - Taint on warning.
* 'C' - modules from drivers/staging are loaded.
* *
* The string is overwritten by the next call to print_taint(). * The string is overwritten by the next call to print_taint().
*/ */
...@@ -163,7 +164,7 @@ const char *print_tainted(void) ...@@ -163,7 +164,7 @@ const char *print_tainted(void)
{ {
static char buf[20]; static char buf[20];
if (tainted) { if (tainted) {
snprintf(buf, sizeof(buf), "Tainted: %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",
tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G', tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G',
tainted & TAINT_FORCED_MODULE ? 'F' : ' ', tainted & TAINT_FORCED_MODULE ? 'F' : ' ',
tainted & TAINT_UNSAFE_SMP ? 'S' : ' ', tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
...@@ -173,7 +174,8 @@ const char *print_tainted(void) ...@@ -173,7 +174,8 @@ const char *print_tainted(void)
tainted & TAINT_USER ? 'U' : ' ', tainted & TAINT_USER ? 'U' : ' ',
tainted & TAINT_DIE ? 'D' : ' ', tainted & TAINT_DIE ? 'D' : ' ',
tainted & TAINT_OVERRIDDEN_ACPI_TABLE ? 'A' : ' ', tainted & TAINT_OVERRIDDEN_ACPI_TABLE ? 'A' : ' ',
tainted & TAINT_WARN ? 'W' : ' '); tainted & TAINT_WARN ? 'W' : ' ',
tainted & TAINT_CRAP ? 'C' : ' ');
} }
else else
snprintf(buf, sizeof(buf), "Not tainted"); snprintf(buf, sizeof(buf), "Not tainted");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment