]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From 061b1bd394ca8628b7c24eb4658ba3535da4249a Mon Sep 17 00:00:00 2001 |
2 | From: Greg Kroah-Hartman <gregkh@suse.de> | |
3 | Date: Wed, 24 Sep 2008 14:46:44 -0700 | |
4 | Subject: [PATCH 01/23] Staging: add TAINT_CRAP for all drivers/staging code | |
5 | Patch-mainline: 2.6.28 | |
6 | ||
7 | We need to add a flag for all code that is in the drivers/staging/ | |
8 | directory to prevent all other kernel developers from worrying about | |
9 | issues here, and to notify users that the drivers might not be as good | |
10 | as they are normally used to. | |
11 | ||
12 | Based on code from Andreas Gruenbacher and Jeff Mahoney to provide a | |
13 | TAINT flag for the support level of a kernel module in the Novell | |
14 | enterprise kernel release. | |
15 | ||
16 | This is the kernel portion of this feature, the ability for the flag to | |
17 | be set needs to be done in the build process and will happen in a | |
18 | follow-up patch. | |
19 | ||
20 | Cc: Andreas Gruenbacher <agruen@suse.de> | |
21 | Cc: Jeff Mahoney <jeffm@suse.de> | |
22 | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> | |
23 | --- | |
24 | Documentation/sysctl/kernel.txt | 1 + | |
25 | include/linux/kernel.h | 1 + | |
26 | kernel/module.c | 11 +++++++++++ | |
27 | kernel/panic.c | 4 +++- | |
28 | 4 files changed, 16 insertions(+), 1 deletion(-) | |
29 | ||
30 | --- a/Documentation/sysctl/kernel.txt | |
31 | +++ b/Documentation/sysctl/kernel.txt | |
32 | @@ -369,6 +369,7 @@ can be ORed together: | |
33 | 2 - A module was force loaded by insmod -f. | |
34 | Set by modutils >= 2.4.9 and module-init-tools. | |
35 | 4 - Unsafe SMP processors: SMP with CPUs not designed for SMP. | |
36 | + 64 - A module from drivers/staging was loaded. | |
37 | 0x40000000 - An unsupported kernel module was loaded. | |
38 | 0x80000000 - An kernel module with external support was loaded. | |
39 | ||
40 | --- a/include/linux/kernel.h | |
41 | +++ b/include/linux/kernel.h | |
42 | @@ -263,6 +263,7 @@ extern enum system_states { | |
43 | #define TAINT_DIE (1<<7) | |
44 | #define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) | |
45 | #define TAINT_WARN (1<<9) | |
46 | +#define TAINT_CRAP (1<<10) | |
47 | ||
48 | /* | |
49 | * Take the upper bits to hopefully allow them | |
50 | --- a/kernel/module.c | |
51 | +++ b/kernel/module.c | |
52 | @@ -1894,6 +1894,7 @@ static noinline struct module *load_modu | |
53 | Elf_Ehdr *hdr; | |
54 | Elf_Shdr *sechdrs; | |
55 | char *secstrings, *args, *modmagic, *strtab = NULL; | |
56 | + char *staging; | |
57 | unsigned int i; | |
58 | unsigned int symindex = 0; | |
59 | unsigned int strindex = 0; | |
60 | @@ -2051,6 +2052,14 @@ static noinline struct module *load_modu | |
61 | goto free_hdr; | |
62 | } | |
63 | ||
64 | + staging = get_modinfo(sechdrs, infoindex, "staging"); | |
65 | + if (staging) { | |
66 | + add_taint_module(mod, TAINT_CRAP); | |
67 | + printk(KERN_WARNING "%s: module is from the staging directory," | |
68 | + " the quality is unknown, you have been warned.\n", | |
69 | + mod->name); | |
70 | + } | |
71 | + | |
72 | /* Now copy in args */ | |
73 | args = strndup_user(uargs, ~0UL >> 1); | |
74 | if (IS_ERR(args)) { | |
75 | @@ -2699,6 +2708,8 @@ static char *module_flags(struct module | |
76 | buf[bx++] = 'P'; | |
77 | if (mod->taints & TAINT_FORCED_MODULE) | |
78 | buf[bx++] = 'F'; | |
79 | + if (mod->taints & TAINT_CRAP) | |
80 | + buf[bx++] = 'C'; | |
81 | if (mod->taints & TAINT_NO_SUPPORT) | |
82 | buf[bx++] = 'N'; | |
83 | if (mod->taints & TAINT_EXTERNAL_SUPPORT) | |
84 | --- a/kernel/panic.c | |
85 | +++ b/kernel/panic.c | |
86 | @@ -178,6 +178,7 @@ EXPORT_SYMBOL(panic); | |
87 | * 'U' - Userspace-defined naughtiness. | |
88 | * 'A' - ACPI table overridden. | |
89 | * 'W' - Taint on warning. | |
90 | + * 'C' - modules from drivers/staging are loaded. | |
91 | * 'N' - Unsuported modules loaded. | |
92 | * 'X' - Modules with external support loaded. | |
93 | * | |
94 | @@ -188,7 +189,7 @@ const char *print_tainted(void) | |
95 | { | |
96 | static char buf[20]; | |
97 | if (tainted) { | |
98 | - snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c%c%c%c%c", | |
99 | + snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c%c%c%c%c%c", | |
100 | tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G', | |
101 | tainted & TAINT_FORCED_MODULE ? 'F' : ' ', | |
102 | tainted & TAINT_UNSAFE_SMP ? 'S' : ' ', | |
103 | @@ -199,6 +200,7 @@ const char *print_tainted(void) | |
104 | tainted & TAINT_DIE ? 'D' : ' ', | |
105 | tainted & TAINT_OVERRIDDEN_ACPI_TABLE ? 'A' : ' ', | |
106 | tainted & TAINT_WARN ? 'W' : ' ', | |
107 | + tainted & TAINT_CRAP ? 'C' : ' ', | |
108 | tainted & TAINT_NO_SUPPORT ? 'N' : ' ', | |
109 | tainted & TAINT_EXTERNAL_SUPPORT ? 'X' : ' '); | |
110 | } |