Commit d4a2e61f authored by Linus Torvalds's avatar Linus Torvalds

Merge git://github.com/rustyrussell/linux

* git://github.com/rustyrussell/linux:
  module,bug: Add TAINT_OOT_MODULE flag for modules not built in-tree
  module: Enable dynamic debugging regardless of taint
parents 0e4c9dc2 2449b8ba
...@@ -263,6 +263,8 @@ characters, each representing a particular tainted value. ...@@ -263,6 +263,8 @@ characters, each representing a particular tainted value.
12: 'I' if the kernel is working around a severe bug in the platform 12: 'I' if the kernel is working around a severe bug in the platform
firmware (BIOS or similar). firmware (BIOS or similar).
13: 'O' if an externally-built ("out-of-tree") module has been loaded.
The primary reason for the 'Tainted: ' string is to tell kernel The primary reason for the 'Tainted: ' string is to tell kernel
debuggers if this is a clean kernel or if anything unusual has debuggers if this is a clean kernel or if anything unusual has
occurred. Tainting is permanent: even if an offending module is occurred. Tainting is permanent: even if an offending module is
......
...@@ -371,6 +371,7 @@ extern enum system_states { ...@@ -371,6 +371,7 @@ extern enum system_states {
#define TAINT_WARN 9 #define TAINT_WARN 9
#define TAINT_CRAP 10 #define TAINT_CRAP 10
#define TAINT_FIRMWARE_WORKAROUND 11 #define TAINT_FIRMWARE_WORKAROUND 11
#define TAINT_OOT_MODULE 12
extern const char hex_asc[]; extern const char hex_asc[];
#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] #define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
......
...@@ -2487,6 +2487,9 @@ static int check_modinfo(struct module *mod, struct load_info *info) ...@@ -2487,6 +2487,9 @@ static int check_modinfo(struct module *mod, struct load_info *info)
return -ENOEXEC; return -ENOEXEC;
} }
if (!get_modinfo(info, "intree"))
add_taint_module(mod, TAINT_OOT_MODULE);
if (get_modinfo(info, "staging")) { if (get_modinfo(info, "staging")) {
add_taint_module(mod, TAINT_CRAP); add_taint_module(mod, TAINT_CRAP);
printk(KERN_WARNING "%s: module is from the staging directory," printk(KERN_WARNING "%s: module is from the staging directory,"
...@@ -2878,8 +2881,7 @@ static struct module *load_module(void __user *umod, ...@@ -2878,8 +2881,7 @@ static struct module *load_module(void __user *umod,
} }
/* This has to be done once we're sure module name is unique. */ /* This has to be done once we're sure module name is unique. */
if (!mod->taints || mod->taints == (1U<<TAINT_CRAP)) dynamic_debug_setup(info.debug, info.num_debug);
dynamic_debug_setup(info.debug, info.num_debug);
/* Find duplicate symbols */ /* Find duplicate symbols */
err = verify_export_symbols(mod); err = verify_export_symbols(mod);
...@@ -2915,8 +2917,7 @@ static struct module *load_module(void __user *umod, ...@@ -2915,8 +2917,7 @@ static struct module *load_module(void __user *umod,
module_bug_cleanup(mod); module_bug_cleanup(mod);
ddebug: ddebug:
if (!mod->taints || mod->taints == (1U<<TAINT_CRAP)) dynamic_debug_remove(info.debug);
dynamic_debug_remove(info.debug);
unlock: unlock:
mutex_unlock(&module_mutex); mutex_unlock(&module_mutex);
synchronize_sched(); synchronize_sched();
...@@ -3257,6 +3258,8 @@ static char *module_flags(struct module *mod, char *buf) ...@@ -3257,6 +3258,8 @@ static char *module_flags(struct module *mod, char *buf)
buf[bx++] = '('; buf[bx++] = '(';
if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE)) if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE))
buf[bx++] = 'P'; buf[bx++] = 'P';
else if (mod->taints & (1 << TAINT_OOT_MODULE))
buf[bx++] = 'O';
if (mod->taints & (1 << TAINT_FORCED_MODULE)) if (mod->taints & (1 << TAINT_FORCED_MODULE))
buf[bx++] = 'F'; buf[bx++] = 'F';
if (mod->taints & (1 << TAINT_CRAP)) if (mod->taints & (1 << TAINT_CRAP))
......
...@@ -177,6 +177,7 @@ static const struct tnt tnts[] = { ...@@ -177,6 +177,7 @@ static const struct tnt tnts[] = {
{ TAINT_WARN, 'W', ' ' }, { TAINT_WARN, 'W', ' ' },
{ TAINT_CRAP, 'C', ' ' }, { TAINT_CRAP, 'C', ' ' },
{ TAINT_FIRMWARE_WORKAROUND, 'I', ' ' }, { TAINT_FIRMWARE_WORKAROUND, 'I', ' ' },
{ TAINT_OOT_MODULE, 'O', ' ' },
}; };
/** /**
...@@ -194,6 +195,7 @@ static const struct tnt tnts[] = { ...@@ -194,6 +195,7 @@ static const struct tnt tnts[] = {
* 'W' - Taint on warning. * 'W' - Taint on warning.
* 'C' - modules from drivers/staging are loaded. * 'C' - modules from drivers/staging are loaded.
* 'I' - Working around severe firmware bug. * 'I' - Working around severe firmware bug.
* 'O' - Out-of-tree module has been loaded.
* *
* The string is overwritten by the next call to print_tainted(). * The string is overwritten by the next call to print_tainted().
*/ */
......
...@@ -1849,6 +1849,12 @@ static void add_header(struct buffer *b, struct module *mod) ...@@ -1849,6 +1849,12 @@ static void add_header(struct buffer *b, struct module *mod)
buf_printf(b, "};\n"); buf_printf(b, "};\n");
} }
static void add_intree_flag(struct buffer *b, int is_intree)
{
if (is_intree)
buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n");
}
static void add_staging_flag(struct buffer *b, const char *name) static void add_staging_flag(struct buffer *b, const char *name)
{ {
static const char *staging_dir = "drivers/staging"; static const char *staging_dir = "drivers/staging";
...@@ -2169,6 +2175,7 @@ int main(int argc, char **argv) ...@@ -2169,6 +2175,7 @@ int main(int argc, char **argv)
buf.pos = 0; buf.pos = 0;
add_header(&buf, mod); add_header(&buf, mod);
add_intree_flag(&buf, !external_module);
add_staging_flag(&buf, mod->name); add_staging_flag(&buf, mod->name);
err |= add_versions(&buf, mod); err |= add_versions(&buf, mod);
add_depends(&buf, mod, modules); add_depends(&buf, mod, modules);
......
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