Commit 061b1bd394ca8628b7c24eb4658ba3535da4249a
1 parent
b922df7383
Exists in
master
and in
7 other branches
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: Greg Kroah-Hartman <gregkh@suse.de>
Showing 4 changed files with 17 additions and 2 deletions Side-by-side Diff
Documentation/sysctl/kernel.txt
include/linux/kernel.h
kernel/module.c
... | ... | @@ -1806,6 +1806,7 @@ |
1806 | 1806 | Elf_Ehdr *hdr; |
1807 | 1807 | Elf_Shdr *sechdrs; |
1808 | 1808 | char *secstrings, *args, *modmagic, *strtab = NULL; |
1809 | + char *staging; | |
1809 | 1810 | unsigned int i; |
1810 | 1811 | unsigned int symindex = 0; |
1811 | 1812 | unsigned int strindex = 0; |
... | ... | @@ -1960,6 +1961,14 @@ |
1960 | 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 | 1972 | /* Now copy in args */ |
1964 | 1973 | args = strndup_user(uargs, ~0UL >> 1); |
1965 | 1974 | if (IS_ERR(args)) { |
... | ... | @@ -2556,6 +2565,8 @@ |
2556 | 2565 | buf[bx++] = 'P'; |
2557 | 2566 | if (mod->taints & TAINT_FORCED_MODULE) |
2558 | 2567 | buf[bx++] = 'F'; |
2568 | + if (mod->taints & TAINT_CRAP) | |
2569 | + buf[bx++] = 'C'; | |
2559 | 2570 | /* |
2560 | 2571 | * TAINT_FORCED_RMMOD: could be added. |
2561 | 2572 | * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't |
kernel/panic.c
... | ... | @@ -155,6 +155,7 @@ |
155 | 155 | * 'U' - Userspace-defined naughtiness. |
156 | 156 | * 'A' - ACPI table overridden. |
157 | 157 | * 'W' - Taint on warning. |
158 | + * 'C' - modules from drivers/staging are loaded. | |
158 | 159 | * |
159 | 160 | * The string is overwritten by the next call to print_taint(). |
160 | 161 | */ |
... | ... | @@ -163,7 +164,7 @@ |
163 | 164 | { |
164 | 165 | static char buf[20]; |
165 | 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 | 168 | tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G', |
168 | 169 | tainted & TAINT_FORCED_MODULE ? 'F' : ' ', |
169 | 170 | tainted & TAINT_UNSAFE_SMP ? 'S' : ' ', |
... | ... | @@ -173,7 +174,8 @@ |
173 | 174 | tainted & TAINT_USER ? 'U' : ' ', |
174 | 175 | tainted & TAINT_DIE ? 'D' : ' ', |
175 | 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 | 180 | else |
179 | 181 | snprintf(buf, sizeof(buf), "Not tainted"); |