diff options
-rw-r--r-- | Documentation/sysctl/kernel.txt | 1 | ||||
-rw-r--r-- | include/linux/kernel.h | 1 | ||||
-rw-r--r-- | kernel/module.c | 11 | ||||
-rw-r--r-- | kernel/panic.c | 6 |
4 files changed, 17 insertions, 2 deletions
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt index e1ff0d920a5c..bde799e06598 100644 --- a/Documentation/sysctl/kernel.txt +++ b/Documentation/sysctl/kernel.txt | |||
@@ -369,4 +369,5 @@ can be ORed together: | |||
369 | 2 - A module was force loaded by insmod -f. | 369 | 2 - A module was force loaded by insmod -f. |
370 | Set by modutils >= 2.4.9 and module-init-tools. | 370 | Set by modutils >= 2.4.9 and module-init-tools. |
371 | 4 - Unsafe SMP processors: SMP with CPUs not designed for SMP. | 371 | 4 - Unsafe SMP processors: SMP with CPUs not designed for SMP. |
372 | 64 - A module from drivers/staging was loaded. | ||
372 | 373 | ||
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 2651f805ba6d..b36805cb95fb 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -260,6 +260,7 @@ extern enum system_states { | |||
260 | #define TAINT_DIE (1<<7) | 260 | #define TAINT_DIE (1<<7) |
261 | #define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) | 261 | #define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) |
262 | #define TAINT_WARN (1<<9) | 262 | #define TAINT_WARN (1<<9) |
263 | #define TAINT_CRAP (1<<10) | ||
263 | 264 | ||
264 | extern void dump_stack(void) __cold; | 265 | extern void dump_stack(void) __cold; |
265 | 266 | ||
diff --git a/kernel/module.c b/kernel/module.c index 9db11911e04b..152b1655bbac 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1806,6 +1806,7 @@ static noinline struct module *load_module(void __user *umod, | |||
1806 | Elf_Ehdr *hdr; | 1806 | Elf_Ehdr *hdr; |
1807 | Elf_Shdr *sechdrs; | 1807 | Elf_Shdr *sechdrs; |
1808 | char *secstrings, *args, *modmagic, *strtab = NULL; | 1808 | char *secstrings, *args, *modmagic, *strtab = NULL; |
1809 | char *staging; | ||
1809 | unsigned int i; | 1810 | unsigned int i; |
1810 | unsigned int symindex = 0; | 1811 | unsigned int symindex = 0; |
1811 | unsigned int strindex = 0; | 1812 | unsigned int strindex = 0; |
@@ -1960,6 +1961,14 @@ static noinline struct module *load_module(void __user *umod, | |||
1960 | goto free_hdr; | 1961 | goto free_hdr; |
1961 | } | 1962 | } |
1962 | 1963 | ||
1964 | staging = get_modinfo(sechdrs, infoindex, "staging"); | ||
1965 | if (staging) { | ||
1966 | add_taint_module(mod, TAINT_CRAP); | ||
1967 | printk(KERN_WARNING "%s: module is from the staging directory," | ||
1968 | " the quality is unknown, you have been warned.\n", | ||
1969 | mod->name); | ||
1970 | } | ||
1971 | |||
1963 | /* Now copy in args */ | 1972 | /* Now copy in args */ |
1964 | args = strndup_user(uargs, ~0UL >> 1); | 1973 | args = strndup_user(uargs, ~0UL >> 1); |
1965 | if (IS_ERR(args)) { | 1974 | if (IS_ERR(args)) { |
@@ -2556,6 +2565,8 @@ static char *module_flags(struct module *mod, char *buf) | |||
2556 | buf[bx++] = 'P'; | 2565 | buf[bx++] = 'P'; |
2557 | if (mod->taints & TAINT_FORCED_MODULE) | 2566 | if (mod->taints & TAINT_FORCED_MODULE) |
2558 | buf[bx++] = 'F'; | 2567 | buf[bx++] = 'F'; |
2568 | if (mod->taints & TAINT_CRAP) | ||
2569 | buf[bx++] = 'C'; | ||
2559 | /* | 2570 | /* |
2560 | * TAINT_FORCED_RMMOD: could be added. | 2571 | * TAINT_FORCED_RMMOD: could be added. |
2561 | * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't | 2572 | * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't |
diff --git a/kernel/panic.c b/kernel/panic.c index 12c5a0a6c89b..98e2047f4db7 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -155,6 +155,7 @@ EXPORT_SYMBOL(panic); | |||
155 | * 'U' - Userspace-defined naughtiness. | 155 | * 'U' - Userspace-defined naughtiness. |
156 | * 'A' - ACPI table overridden. | 156 | * 'A' - ACPI table overridden. |
157 | * 'W' - Taint on warning. | 157 | * 'W' - Taint on warning. |
158 | * 'C' - modules from drivers/staging are loaded. | ||
158 | * | 159 | * |
159 | * The string is overwritten by the next call to print_taint(). | 160 | * The string is overwritten by the next call to print_taint(). |
160 | */ | 161 | */ |
@@ -163,7 +164,7 @@ const char *print_tainted(void) | |||
163 | { | 164 | { |
164 | static char buf[20]; | 165 | static char buf[20]; |
165 | if (tainted) { | 166 | if (tainted) { |
166 | snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c%c%c", | 167 | snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c%c%c%c", |
167 | tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G', | 168 | tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G', |
168 | tainted & TAINT_FORCED_MODULE ? 'F' : ' ', | 169 | tainted & TAINT_FORCED_MODULE ? 'F' : ' ', |
169 | tainted & TAINT_UNSAFE_SMP ? 'S' : ' ', | 170 | tainted & TAINT_UNSAFE_SMP ? 'S' : ' ', |
@@ -173,7 +174,8 @@ const char *print_tainted(void) | |||
173 | tainted & TAINT_USER ? 'U' : ' ', | 174 | tainted & TAINT_USER ? 'U' : ' ', |
174 | tainted & TAINT_DIE ? 'D' : ' ', | 175 | tainted & TAINT_DIE ? 'D' : ' ', |
175 | tainted & TAINT_OVERRIDDEN_ACPI_TABLE ? 'A' : ' ', | 176 | tainted & TAINT_OVERRIDDEN_ACPI_TABLE ? 'A' : ' ', |
176 | tainted & TAINT_WARN ? 'W' : ' '); | 177 | tainted & TAINT_WARN ? 'W' : ' ', |
178 | tainted & TAINT_CRAP ? 'C' : ' '); | ||
177 | } | 179 | } |
178 | else | 180 | else |
179 | snprintf(buf, sizeof(buf), "Not tainted"); | 181 | snprintf(buf, sizeof(buf), "Not tainted"); |