diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-25 18:41:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-25 18:41:43 -0500 |
commit | 9043a2650cd21f96f831a97f516c2c302e21fb70 (patch) | |
tree | 926720afb0acc7bad8cfcae537dc58de552f9249 | |
parent | ab7826595e9ec51a51f622c5fc91e2f59440481a (diff) | |
parent | d9d8d7ed498ec65bea72dd24be7b9cd35af0c200 (diff) |
Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull module update from Rusty Russell:
"The sweeping change is to make add_taint() explicitly indicate whether
to disable lockdep, but it's a mechanical change."
* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
MODSIGN: Add option to not sign modules during modules_install
MODSIGN: Add -s <signature> option to sign-file
MODSIGN: Specify the hash algorithm on sign-file command line
MODSIGN: Simplify Makefile with a Kconfig helper
module: clean up load_module a little more.
modpost: Ignore ARC specific non-alloc sections
module: constify within_module_*
taint: add explicit flag to show whether lock dep is still OK.
module: printk message when module signature fail taints kernel.
43 files changed, 235 insertions, 201 deletions
@@ -720,11 +720,11 @@ endif # INSTALL_MOD_STRIP | |||
720 | export mod_strip_cmd | 720 | export mod_strip_cmd |
721 | 721 | ||
722 | 722 | ||
723 | ifeq ($(CONFIG_MODULE_SIG),y) | 723 | ifdef CONFIG_MODULE_SIG_ALL |
724 | MODSECKEY = ./signing_key.priv | 724 | MODSECKEY = ./signing_key.priv |
725 | MODPUBKEY = ./signing_key.x509 | 725 | MODPUBKEY = ./signing_key.x509 |
726 | export MODPUBKEY | 726 | export MODPUBKEY |
727 | mod_sign_cmd = perl $(srctree)/scripts/sign-file $(MODSECKEY) $(MODPUBKEY) | 727 | mod_sign_cmd = perl $(srctree)/scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODSECKEY) $(MODPUBKEY) |
728 | else | 728 | else |
729 | mod_sign_cmd = true | 729 | mod_sign_cmd = true |
730 | endif | 730 | endif |
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index 272666d006df..4037461a6493 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c | |||
@@ -186,7 +186,7 @@ die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15) | |||
186 | #endif | 186 | #endif |
187 | printk("%s(%d): %s %ld\n", current->comm, task_pid_nr(current), str, err); | 187 | printk("%s(%d): %s %ld\n", current->comm, task_pid_nr(current), str, err); |
188 | dik_show_regs(regs, r9_15); | 188 | dik_show_regs(regs, r9_15); |
189 | add_taint(TAINT_DIE); | 189 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
190 | dik_show_trace((unsigned long *)(regs+1)); | 190 | dik_show_trace((unsigned long *)(regs+1)); |
191 | dik_show_code((unsigned int *)regs->pc); | 191 | dik_show_code((unsigned int *)regs->pc); |
192 | 192 | ||
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index b0179b89a04c..1c089119b2d7 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -296,7 +296,7 @@ static void oops_end(unsigned long flags, struct pt_regs *regs, int signr) | |||
296 | 296 | ||
297 | bust_spinlocks(0); | 297 | bust_spinlocks(0); |
298 | die_owner = -1; | 298 | die_owner = -1; |
299 | add_taint(TAINT_DIE); | 299 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
300 | die_nest_count--; | 300 | die_nest_count--; |
301 | if (!die_nest_count) | 301 | if (!die_nest_count) |
302 | /* Nest count reaches zero, release the lock. */ | 302 | /* Nest count reaches zero, release the lock. */ |
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 3883f842434f..b3c5f628bdb4 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c | |||
@@ -242,7 +242,7 @@ void die(const char *str, struct pt_regs *regs, int err) | |||
242 | crash_kexec(regs); | 242 | crash_kexec(regs); |
243 | 243 | ||
244 | bust_spinlocks(0); | 244 | bust_spinlocks(0); |
245 | add_taint(TAINT_DIE); | 245 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
246 | raw_spin_unlock_irq(&die_lock); | 246 | raw_spin_unlock_irq(&die_lock); |
247 | oops_exit(); | 247 | oops_exit(); |
248 | 248 | ||
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c index 3d760c06f024..682b2478691a 100644 --- a/arch/avr32/kernel/traps.c +++ b/arch/avr32/kernel/traps.c | |||
@@ -61,7 +61,7 @@ void die(const char *str, struct pt_regs *regs, long err) | |||
61 | show_regs_log_lvl(regs, KERN_EMERG); | 61 | show_regs_log_lvl(regs, KERN_EMERG); |
62 | show_stack_log_lvl(current, regs->sp, regs, KERN_EMERG); | 62 | show_stack_log_lvl(current, regs->sp, regs, KERN_EMERG); |
63 | bust_spinlocks(0); | 63 | bust_spinlocks(0); |
64 | add_taint(TAINT_DIE); | 64 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
65 | spin_unlock_irq(&die_lock); | 65 | spin_unlock_irq(&die_lock); |
66 | 66 | ||
67 | if (in_interrupt()) | 67 | if (in_interrupt()) |
diff --git a/arch/hexagon/kernel/traps.c b/arch/hexagon/kernel/traps.c index a41eeb8eeaa1..be5e2dd9c9d3 100644 --- a/arch/hexagon/kernel/traps.c +++ b/arch/hexagon/kernel/traps.c | |||
@@ -225,7 +225,7 @@ int die(const char *str, struct pt_regs *regs, long err) | |||
225 | do_show_stack(current, ®s->r30, pt_elr(regs)); | 225 | do_show_stack(current, ®s->r30, pt_elr(regs)); |
226 | 226 | ||
227 | bust_spinlocks(0); | 227 | bust_spinlocks(0); |
228 | add_taint(TAINT_DIE); | 228 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
229 | 229 | ||
230 | spin_unlock_irq(&die.lock); | 230 | spin_unlock_irq(&die.lock); |
231 | 231 | ||
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c index bd42b76000d1..f7f9f9c6caf0 100644 --- a/arch/ia64/kernel/traps.c +++ b/arch/ia64/kernel/traps.c | |||
@@ -72,7 +72,7 @@ die (const char *str, struct pt_regs *regs, long err) | |||
72 | 72 | ||
73 | bust_spinlocks(0); | 73 | bust_spinlocks(0); |
74 | die.lock_owner = -1; | 74 | die.lock_owner = -1; |
75 | add_taint(TAINT_DIE); | 75 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
76 | spin_unlock_irq(&die.lock); | 76 | spin_unlock_irq(&die.lock); |
77 | 77 | ||
78 | if (!regs) | 78 | if (!regs) |
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c index cbc624af4494..f32ab22e7ed3 100644 --- a/arch/m68k/kernel/traps.c +++ b/arch/m68k/kernel/traps.c | |||
@@ -1176,7 +1176,7 @@ void die_if_kernel (char *str, struct pt_regs *fp, int nr) | |||
1176 | console_verbose(); | 1176 | console_verbose(); |
1177 | printk("%s: %08x\n",str,nr); | 1177 | printk("%s: %08x\n",str,nr); |
1178 | show_registers(fp); | 1178 | show_registers(fp); |
1179 | add_taint(TAINT_DIE); | 1179 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
1180 | do_exit(SIGSEGV); | 1180 | do_exit(SIGSEGV); |
1181 | } | 1181 | } |
1182 | 1182 | ||
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index cf7ac5483f53..9007966d56d4 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -396,7 +396,7 @@ void __noreturn die(const char *str, struct pt_regs *regs) | |||
396 | 396 | ||
397 | printk("%s[#%d]:\n", str, ++die_counter); | 397 | printk("%s[#%d]:\n", str, ++die_counter); |
398 | show_registers(regs); | 398 | show_registers(regs); |
399 | add_taint(TAINT_DIE); | 399 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
400 | raw_spin_unlock_irq(&die_lock); | 400 | raw_spin_unlock_irq(&die_lock); |
401 | 401 | ||
402 | oops_exit(); | 402 | oops_exit(); |
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c index 45ba99f5080b..aeb8f8f2c07a 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c | |||
@@ -282,7 +282,7 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err) | |||
282 | 282 | ||
283 | show_regs(regs); | 283 | show_regs(regs); |
284 | dump_stack(); | 284 | dump_stack(); |
285 | add_taint(TAINT_DIE); | 285 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
286 | 286 | ||
287 | if (in_interrupt()) | 287 | if (in_interrupt()) |
288 | panic("Fatal exception in interrupt"); | 288 | panic("Fatal exception in interrupt"); |
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index f9b751b29558..37cc40ef5043 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -146,7 +146,7 @@ static void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, | |||
146 | { | 146 | { |
147 | bust_spinlocks(0); | 147 | bust_spinlocks(0); |
148 | die_owner = -1; | 148 | die_owner = -1; |
149 | add_taint(TAINT_DIE); | 149 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
150 | die_nest_count--; | 150 | die_nest_count--; |
151 | oops_exit(); | 151 | oops_exit(); |
152 | printk("\n"); | 152 | printk("\n"); |
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index 70ecfc5fe8f0..13dd63fba367 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -271,7 +271,7 @@ void die(struct pt_regs *regs, const char *str) | |||
271 | print_modules(); | 271 | print_modules(); |
272 | show_regs(regs); | 272 | show_regs(regs); |
273 | bust_spinlocks(0); | 273 | bust_spinlocks(0); |
274 | add_taint(TAINT_DIE); | 274 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
275 | spin_unlock_irq(&die_lock); | 275 | spin_unlock_irq(&die_lock); |
276 | if (in_interrupt()) | 276 | if (in_interrupt()) |
277 | panic("Fatal exception in interrupt"); | 277 | panic("Fatal exception in interrupt"); |
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c index 72246bc06884..dfdad72c61ca 100644 --- a/arch/sh/kernel/traps.c +++ b/arch/sh/kernel/traps.c | |||
@@ -38,7 +38,7 @@ void die(const char *str, struct pt_regs *regs, long err) | |||
38 | notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV); | 38 | notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV); |
39 | 39 | ||
40 | bust_spinlocks(0); | 40 | bust_spinlocks(0); |
41 | add_taint(TAINT_DIE); | 41 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
42 | spin_unlock_irq(&die_lock); | 42 | spin_unlock_irq(&die_lock); |
43 | oops_exit(); | 43 | oops_exit(); |
44 | 44 | ||
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index 0eaf0059aaef..88a127b9c69e 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c | |||
@@ -115,7 +115,7 @@ static void __init process_switch(char c) | |||
115 | break; | 115 | break; |
116 | } | 116 | } |
117 | cheetah_pcache_forced_on = 1; | 117 | cheetah_pcache_forced_on = 1; |
118 | add_taint(TAINT_MACHINE_CHECK); | 118 | add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE); |
119 | cheetah_enable_pcache(); | 119 | cheetah_enable_pcache(); |
120 | break; | 120 | break; |
121 | 121 | ||
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c index a5785ea2a85d..662982946a89 100644 --- a/arch/sparc/kernel/traps_32.c +++ b/arch/sparc/kernel/traps_32.c | |||
@@ -58,7 +58,7 @@ void die_if_kernel(char *str, struct pt_regs *regs) | |||
58 | 58 | ||
59 | printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter); | 59 | printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter); |
60 | show_regs(regs); | 60 | show_regs(regs); |
61 | add_taint(TAINT_DIE); | 61 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
62 | 62 | ||
63 | __SAVE; __SAVE; __SAVE; __SAVE; | 63 | __SAVE; __SAVE; __SAVE; __SAVE; |
64 | __SAVE; __SAVE; __SAVE; __SAVE; | 64 | __SAVE; __SAVE; __SAVE; __SAVE; |
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c index e7ecf1507d90..8d38ca97aa23 100644 --- a/arch/sparc/kernel/traps_64.c +++ b/arch/sparc/kernel/traps_64.c | |||
@@ -2383,7 +2383,7 @@ void die_if_kernel(char *str, struct pt_regs *regs) | |||
2383 | notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV); | 2383 | notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV); |
2384 | __asm__ __volatile__("flushw"); | 2384 | __asm__ __volatile__("flushw"); |
2385 | show_regs(regs); | 2385 | show_regs(regs); |
2386 | add_taint(TAINT_DIE); | 2386 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
2387 | if (regs->tstate & TSTATE_PRIV) { | 2387 | if (regs->tstate & TSTATE_PRIV) { |
2388 | struct thread_info *tp = current_thread_info(); | 2388 | struct thread_info *tp = current_thread_info(); |
2389 | struct reg_window *rw = (struct reg_window *) | 2389 | struct reg_window *rw = (struct reg_window *) |
diff --git a/arch/unicore32/kernel/traps.c b/arch/unicore32/kernel/traps.c index 2054f0d4db13..0870b68d2ad9 100644 --- a/arch/unicore32/kernel/traps.c +++ b/arch/unicore32/kernel/traps.c | |||
@@ -231,7 +231,7 @@ void die(const char *str, struct pt_regs *regs, int err) | |||
231 | ret = __die(str, err, thread, regs); | 231 | ret = __die(str, err, thread, regs); |
232 | 232 | ||
233 | bust_spinlocks(0); | 233 | bust_spinlocks(0); |
234 | add_taint(TAINT_DIE); | 234 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
235 | spin_unlock_irq(&die_lock); | 235 | spin_unlock_irq(&die_lock); |
236 | oops_exit(); | 236 | oops_exit(); |
237 | 237 | ||
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index edd77e7508b3..fa96eb0d02fb 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -219,8 +219,7 @@ static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c) | |||
219 | */ | 219 | */ |
220 | WARN_ONCE(1, "WARNING: This combination of AMD" | 220 | WARN_ONCE(1, "WARNING: This combination of AMD" |
221 | " processors is not suitable for SMP.\n"); | 221 | " processors is not suitable for SMP.\n"); |
222 | if (!test_taint(TAINT_UNSAFE_SMP)) | 222 | add_taint(TAINT_UNSAFE_SMP, LOCKDEP_NOW_UNRELIABLE); |
223 | add_taint(TAINT_UNSAFE_SMP); | ||
224 | 223 | ||
225 | valid_k7: | 224 | valid_k7: |
226 | ; | 225 | ; |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index fc7608a89d93..7bc126346ace 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -1082,7 +1082,7 @@ void do_machine_check(struct pt_regs *regs, long error_code) | |||
1082 | /* | 1082 | /* |
1083 | * Set taint even when machine check was not enabled. | 1083 | * Set taint even when machine check was not enabled. |
1084 | */ | 1084 | */ |
1085 | add_taint(TAINT_MACHINE_CHECK); | 1085 | add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE); |
1086 | 1086 | ||
1087 | severity = mce_severity(&m, cfg->tolerant, NULL); | 1087 | severity = mce_severity(&m, cfg->tolerant, NULL); |
1088 | 1088 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/p5.c b/arch/x86/kernel/cpu/mcheck/p5.c index 2d5454cd2c4f..1c044b1ccc59 100644 --- a/arch/x86/kernel/cpu/mcheck/p5.c +++ b/arch/x86/kernel/cpu/mcheck/p5.c | |||
@@ -33,7 +33,7 @@ static void pentium_machine_check(struct pt_regs *regs, long error_code) | |||
33 | smp_processor_id()); | 33 | smp_processor_id()); |
34 | } | 34 | } |
35 | 35 | ||
36 | add_taint(TAINT_MACHINE_CHECK); | 36 | add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE); |
37 | } | 37 | } |
38 | 38 | ||
39 | /* Set up machine check reporting for processors with Intel style MCE: */ | 39 | /* Set up machine check reporting for processors with Intel style MCE: */ |
diff --git a/arch/x86/kernel/cpu/mcheck/winchip.c b/arch/x86/kernel/cpu/mcheck/winchip.c index 2d7998fb628c..e9a701aecaa1 100644 --- a/arch/x86/kernel/cpu/mcheck/winchip.c +++ b/arch/x86/kernel/cpu/mcheck/winchip.c | |||
@@ -15,7 +15,7 @@ | |||
15 | static void winchip_machine_check(struct pt_regs *regs, long error_code) | 15 | static void winchip_machine_check(struct pt_regs *regs, long error_code) |
16 | { | 16 | { |
17 | printk(KERN_EMERG "CPU0: Machine Check Exception.\n"); | 17 | printk(KERN_EMERG "CPU0: Machine Check Exception.\n"); |
18 | add_taint(TAINT_MACHINE_CHECK); | 18 | add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE); |
19 | } | 19 | } |
20 | 20 | ||
21 | /* Set up machine check reporting on the Winchip C6 series */ | 21 | /* Set up machine check reporting on the Winchip C6 series */ |
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index e9fe907cd249..fa72a39e5d46 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c | |||
@@ -542,7 +542,7 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base, | |||
542 | 542 | ||
543 | if (tmp != mask_lo) { | 543 | if (tmp != mask_lo) { |
544 | printk(KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n"); | 544 | printk(KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n"); |
545 | add_taint(TAINT_FIRMWARE_WORKAROUND); | 545 | add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); |
546 | mask_lo = tmp; | 546 | mask_lo = tmp; |
547 | } | 547 | } |
548 | } | 548 | } |
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index ae42418bc50f..c8797d55b245 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c | |||
@@ -232,7 +232,7 @@ void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr) | |||
232 | 232 | ||
233 | bust_spinlocks(0); | 233 | bust_spinlocks(0); |
234 | die_owner = -1; | 234 | die_owner = -1; |
235 | add_taint(TAINT_DIE); | 235 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
236 | die_nest_count--; | 236 | die_nest_count--; |
237 | if (!die_nest_count) | 237 | if (!die_nest_count) |
238 | /* Nest count reaches zero, release the lock. */ | 238 | /* Nest count reaches zero, release the lock. */ |
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index 01e0111bf787..ded955d45155 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c | |||
@@ -524,7 +524,7 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
524 | if (!user_mode(regs)) | 524 | if (!user_mode(regs)) |
525 | show_stack(NULL, (unsigned long*)regs->areg[1]); | 525 | show_stack(NULL, (unsigned long*)regs->areg[1]); |
526 | 526 | ||
527 | add_taint(TAINT_DIE); | 527 | add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
528 | spin_unlock_irq(&die_lock); | 528 | spin_unlock_irq(&die_lock); |
529 | 529 | ||
530 | if (in_interrupt()) | 530 | if (in_interrupt()) |
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c index 6adfc706a1de..12b62f2cdb3f 100644 --- a/drivers/acpi/custom_method.c +++ b/drivers/acpi/custom_method.c | |||
@@ -66,7 +66,7 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, | |||
66 | buf = NULL; | 66 | buf = NULL; |
67 | if (ACPI_FAILURE(status)) | 67 | if (ACPI_FAILURE(status)) |
68 | return -EINVAL; | 68 | return -EINVAL; |
69 | add_taint(TAINT_OVERRIDDEN_ACPI_TABLE); | 69 | add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE); |
70 | } | 70 | } |
71 | 71 | ||
72 | return count; | 72 | return count; |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 908b02d5da1b..8080588f88cb 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -661,7 +661,7 @@ static void acpi_table_taint(struct acpi_table_header *table) | |||
661 | pr_warn(PREFIX | 661 | pr_warn(PREFIX |
662 | "Override [%4.4s-%8.8s], this is unsafe: tainting kernel\n", | 662 | "Override [%4.4s-%8.8s], this is unsafe: tainting kernel\n", |
663 | table->signature, table->oem_table_id); | 663 | table->signature, table->oem_table_id); |
664 | add_taint(TAINT_OVERRIDDEN_ACPI_TABLE); | 664 | add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE); |
665 | } | 665 | } |
666 | 666 | ||
667 | 667 | ||
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 78d5f20c5f5b..81d6f605c92e 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
@@ -279,7 +279,7 @@ static ssize_t regmap_map_write_file(struct file *file, | |||
279 | return -EINVAL; | 279 | return -EINVAL; |
280 | 280 | ||
281 | /* Userspace has been fiddling around behind the kernel's back */ | 281 | /* Userspace has been fiddling around behind the kernel's back */ |
282 | add_taint(TAINT_USER); | 282 | add_taint(TAINT_USER, LOCKDEP_NOW_UNRELIABLE); |
283 | 283 | ||
284 | regmap_write(map, reg, value); | 284 | regmap_write(map, reg, value); |
285 | return buf_size; | 285 | return buf_size; |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index c566927efcbd..80d36874689b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -398,7 +398,11 @@ extern int panic_on_unrecovered_nmi; | |||
398 | extern int panic_on_io_nmi; | 398 | extern int panic_on_io_nmi; |
399 | extern int sysctl_panic_on_stackoverflow; | 399 | extern int sysctl_panic_on_stackoverflow; |
400 | extern const char *print_tainted(void); | 400 | extern const char *print_tainted(void); |
401 | extern void add_taint(unsigned flag); | 401 | enum lockdep_ok { |
402 | LOCKDEP_STILL_OK, | ||
403 | LOCKDEP_NOW_UNRELIABLE | ||
404 | }; | ||
405 | extern void add_taint(unsigned flag, enum lockdep_ok); | ||
402 | extern int test_taint(unsigned flag); | 406 | extern int test_taint(unsigned flag); |
403 | extern unsigned long get_taint(void); | 407 | extern unsigned long get_taint(void); |
404 | extern int root_mountflags; | 408 | extern int root_mountflags; |
diff --git a/include/linux/module.h b/include/linux/module.h index 1375ee3f03aa..ead1b5719a12 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -396,13 +396,13 @@ bool is_module_address(unsigned long addr); | |||
396 | bool is_module_percpu_address(unsigned long addr); | 396 | bool is_module_percpu_address(unsigned long addr); |
397 | bool is_module_text_address(unsigned long addr); | 397 | bool is_module_text_address(unsigned long addr); |
398 | 398 | ||
399 | static inline int within_module_core(unsigned long addr, struct module *mod) | 399 | static inline int within_module_core(unsigned long addr, const struct module *mod) |
400 | { | 400 | { |
401 | return (unsigned long)mod->module_core <= addr && | 401 | return (unsigned long)mod->module_core <= addr && |
402 | addr < (unsigned long)mod->module_core + mod->core_size; | 402 | addr < (unsigned long)mod->module_core + mod->core_size; |
403 | } | 403 | } |
404 | 404 | ||
405 | static inline int within_module_init(unsigned long addr, struct module *mod) | 405 | static inline int within_module_init(unsigned long addr, const struct module *mod) |
406 | { | 406 | { |
407 | return (unsigned long)mod->module_init <= addr && | 407 | return (unsigned long)mod->module_init <= addr && |
408 | addr < (unsigned long)mod->module_init + mod->init_size; | 408 | addr < (unsigned long)mod->module_init + mod->init_size; |
diff --git a/init/Kconfig b/init/Kconfig index 28c5b9dcc91e..968c539f0ac3 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -1670,6 +1670,17 @@ config MODULE_SIG_FORCE | |||
1670 | Reject unsigned modules or signed modules for which we don't have a | 1670 | Reject unsigned modules or signed modules for which we don't have a |
1671 | key. Without this, such modules will simply taint the kernel. | 1671 | key. Without this, such modules will simply taint the kernel. |
1672 | 1672 | ||
1673 | config MODULE_SIG_ALL | ||
1674 | bool "Automatically sign all modules" | ||
1675 | default y | ||
1676 | depends on MODULE_SIG | ||
1677 | help | ||
1678 | Sign all modules during make modules_install. Without this option, | ||
1679 | modules must be signed manually, using the scripts/sign-file tool. | ||
1680 | |||
1681 | comment "Do not forget to sign required modules with scripts/sign-file" | ||
1682 | depends on MODULE_SIG_FORCE && !MODULE_SIG_ALL | ||
1683 | |||
1673 | choice | 1684 | choice |
1674 | prompt "Which hash algorithm should modules be signed with?" | 1685 | prompt "Which hash algorithm should modules be signed with?" |
1675 | depends on MODULE_SIG | 1686 | depends on MODULE_SIG |
@@ -1702,6 +1713,15 @@ config MODULE_SIG_SHA512 | |||
1702 | 1713 | ||
1703 | endchoice | 1714 | endchoice |
1704 | 1715 | ||
1716 | config MODULE_SIG_HASH | ||
1717 | string | ||
1718 | depends on MODULE_SIG | ||
1719 | default "sha1" if MODULE_SIG_SHA1 | ||
1720 | default "sha224" if MODULE_SIG_SHA224 | ||
1721 | default "sha256" if MODULE_SIG_SHA256 | ||
1722 | default "sha384" if MODULE_SIG_SHA384 | ||
1723 | default "sha512" if MODULE_SIG_SHA512 | ||
1724 | |||
1705 | endif # MODULES | 1725 | endif # MODULES |
1706 | 1726 | ||
1707 | config INIT_ALL_POSSIBLE | 1727 | config INIT_ALL_POSSIBLE |
diff --git a/kernel/Makefile b/kernel/Makefile index 6c072b6da239..eceac38f3c65 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -153,23 +153,7 @@ kernel/modsign_certificate.o: signing_key.x509 extra_certificates | |||
153 | # fail and that the kernel may be used afterwards. | 153 | # fail and that the kernel may be used afterwards. |
154 | # | 154 | # |
155 | ############################################################################### | 155 | ############################################################################### |
156 | sign_key_with_hash := | 156 | ifndef CONFIG_MODULE_SIG_HASH |
157 | ifeq ($(CONFIG_MODULE_SIG_SHA1),y) | ||
158 | sign_key_with_hash := -sha1 | ||
159 | endif | ||
160 | ifeq ($(CONFIG_MODULE_SIG_SHA224),y) | ||
161 | sign_key_with_hash := -sha224 | ||
162 | endif | ||
163 | ifeq ($(CONFIG_MODULE_SIG_SHA256),y) | ||
164 | sign_key_with_hash := -sha256 | ||
165 | endif | ||
166 | ifeq ($(CONFIG_MODULE_SIG_SHA384),y) | ||
167 | sign_key_with_hash := -sha384 | ||
168 | endif | ||
169 | ifeq ($(CONFIG_MODULE_SIG_SHA512),y) | ||
170 | sign_key_with_hash := -sha512 | ||
171 | endif | ||
172 | ifeq ($(sign_key_with_hash),) | ||
173 | $(error Could not determine digest type to use from kernel config) | 157 | $(error Could not determine digest type to use from kernel config) |
174 | endif | 158 | endif |
175 | 159 | ||
@@ -182,8 +166,8 @@ signing_key.priv signing_key.x509: x509.genkey | |||
182 | @echo "### needs to be run as root, and uses a hardware random" | 166 | @echo "### needs to be run as root, and uses a hardware random" |
183 | @echo "### number generator if one is available." | 167 | @echo "### number generator if one is available." |
184 | @echo "###" | 168 | @echo "###" |
185 | openssl req -new -nodes -utf8 $(sign_key_with_hash) -days 36500 -batch \ | 169 | openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \ |
186 | -x509 -config x509.genkey \ | 170 | -batch -x509 -config x509.genkey \ |
187 | -outform DER -out signing_key.x509 \ | 171 | -outform DER -out signing_key.x509 \ |
188 | -keyout signing_key.priv | 172 | -keyout signing_key.priv |
189 | @echo "###" | 173 | @echo "###" |
diff --git a/kernel/module.c b/kernel/module.c index eab08274ec9b..921bed4794e9 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -197,9 +197,10 @@ static inline int strong_try_module_get(struct module *mod) | |||
197 | return -ENOENT; | 197 | return -ENOENT; |
198 | } | 198 | } |
199 | 199 | ||
200 | static inline void add_taint_module(struct module *mod, unsigned flag) | 200 | static inline void add_taint_module(struct module *mod, unsigned flag, |
201 | enum lockdep_ok lockdep_ok) | ||
201 | { | 202 | { |
202 | add_taint(flag); | 203 | add_taint(flag, lockdep_ok); |
203 | mod->taints |= (1U << flag); | 204 | mod->taints |= (1U << flag); |
204 | } | 205 | } |
205 | 206 | ||
@@ -727,7 +728,7 @@ static inline int try_force_unload(unsigned int flags) | |||
727 | { | 728 | { |
728 | int ret = (flags & O_TRUNC); | 729 | int ret = (flags & O_TRUNC); |
729 | if (ret) | 730 | if (ret) |
730 | add_taint(TAINT_FORCED_RMMOD); | 731 | add_taint(TAINT_FORCED_RMMOD, LOCKDEP_NOW_UNRELIABLE); |
731 | return ret; | 732 | return ret; |
732 | } | 733 | } |
733 | #else | 734 | #else |
@@ -1138,7 +1139,7 @@ static int try_to_force_load(struct module *mod, const char *reason) | |||
1138 | if (!test_taint(TAINT_FORCED_MODULE)) | 1139 | if (!test_taint(TAINT_FORCED_MODULE)) |
1139 | printk(KERN_WARNING "%s: %s: kernel tainted.\n", | 1140 | printk(KERN_WARNING "%s: %s: kernel tainted.\n", |
1140 | mod->name, reason); | 1141 | mod->name, reason); |
1141 | add_taint_module(mod, TAINT_FORCED_MODULE); | 1142 | add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_NOW_UNRELIABLE); |
1142 | return 0; | 1143 | return 0; |
1143 | #else | 1144 | #else |
1144 | return -ENOEXEC; | 1145 | return -ENOEXEC; |
@@ -2147,7 +2148,8 @@ static void set_license(struct module *mod, const char *license) | |||
2147 | if (!test_taint(TAINT_PROPRIETARY_MODULE)) | 2148 | if (!test_taint(TAINT_PROPRIETARY_MODULE)) |
2148 | printk(KERN_WARNING "%s: module license '%s' taints " | 2149 | printk(KERN_WARNING "%s: module license '%s' taints " |
2149 | "kernel.\n", mod->name, license); | 2150 | "kernel.\n", mod->name, license); |
2150 | add_taint_module(mod, TAINT_PROPRIETARY_MODULE); | 2151 | add_taint_module(mod, TAINT_PROPRIETARY_MODULE, |
2152 | LOCKDEP_NOW_UNRELIABLE); | ||
2151 | } | 2153 | } |
2152 | } | 2154 | } |
2153 | 2155 | ||
@@ -2700,10 +2702,10 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags) | |||
2700 | } | 2702 | } |
2701 | 2703 | ||
2702 | if (!get_modinfo(info, "intree")) | 2704 | if (!get_modinfo(info, "intree")) |
2703 | add_taint_module(mod, TAINT_OOT_MODULE); | 2705 | add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK); |
2704 | 2706 | ||
2705 | if (get_modinfo(info, "staging")) { | 2707 | if (get_modinfo(info, "staging")) { |
2706 | add_taint_module(mod, TAINT_CRAP); | 2708 | add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK); |
2707 | printk(KERN_WARNING "%s: module is from the staging directory," | 2709 | printk(KERN_WARNING "%s: module is from the staging directory," |
2708 | " the quality is unknown, you have been warned.\n", | 2710 | " the quality is unknown, you have been warned.\n", |
2709 | mod->name); | 2711 | mod->name); |
@@ -2869,15 +2871,17 @@ static int check_module_license_and_versions(struct module *mod) | |||
2869 | * using GPL-only symbols it needs. | 2871 | * using GPL-only symbols it needs. |
2870 | */ | 2872 | */ |
2871 | if (strcmp(mod->name, "ndiswrapper") == 0) | 2873 | if (strcmp(mod->name, "ndiswrapper") == 0) |
2872 | add_taint(TAINT_PROPRIETARY_MODULE); | 2874 | add_taint(TAINT_PROPRIETARY_MODULE, LOCKDEP_NOW_UNRELIABLE); |
2873 | 2875 | ||
2874 | /* driverloader was caught wrongly pretending to be under GPL */ | 2876 | /* driverloader was caught wrongly pretending to be under GPL */ |
2875 | if (strcmp(mod->name, "driverloader") == 0) | 2877 | if (strcmp(mod->name, "driverloader") == 0) |
2876 | add_taint_module(mod, TAINT_PROPRIETARY_MODULE); | 2878 | add_taint_module(mod, TAINT_PROPRIETARY_MODULE, |
2879 | LOCKDEP_NOW_UNRELIABLE); | ||
2877 | 2880 | ||
2878 | /* lve claims to be GPL but upstream won't provide source */ | 2881 | /* lve claims to be GPL but upstream won't provide source */ |
2879 | if (strcmp(mod->name, "lve") == 0) | 2882 | if (strcmp(mod->name, "lve") == 0) |
2880 | add_taint_module(mod, TAINT_PROPRIETARY_MODULE); | 2883 | add_taint_module(mod, TAINT_PROPRIETARY_MODULE, |
2884 | LOCKDEP_NOW_UNRELIABLE); | ||
2881 | 2885 | ||
2882 | #ifdef CONFIG_MODVERSIONS | 2886 | #ifdef CONFIG_MODVERSIONS |
2883 | if ((mod->num_syms && !mod->crcs) | 2887 | if ((mod->num_syms && !mod->crcs) |
@@ -3141,12 +3145,72 @@ static int may_init_module(void) | |||
3141 | return 0; | 3145 | return 0; |
3142 | } | 3146 | } |
3143 | 3147 | ||
3148 | /* | ||
3149 | * We try to place it in the list now to make sure it's unique before | ||
3150 | * we dedicate too many resources. In particular, temporary percpu | ||
3151 | * memory exhaustion. | ||
3152 | */ | ||
3153 | static int add_unformed_module(struct module *mod) | ||
3154 | { | ||
3155 | int err; | ||
3156 | struct module *old; | ||
3157 | |||
3158 | mod->state = MODULE_STATE_UNFORMED; | ||
3159 | |||
3160 | again: | ||
3161 | mutex_lock(&module_mutex); | ||
3162 | if ((old = find_module_all(mod->name, true)) != NULL) { | ||
3163 | if (old->state == MODULE_STATE_COMING | ||
3164 | || old->state == MODULE_STATE_UNFORMED) { | ||
3165 | /* Wait in case it fails to load. */ | ||
3166 | mutex_unlock(&module_mutex); | ||
3167 | err = wait_event_interruptible(module_wq, | ||
3168 | finished_loading(mod->name)); | ||
3169 | if (err) | ||
3170 | goto out_unlocked; | ||
3171 | goto again; | ||
3172 | } | ||
3173 | err = -EEXIST; | ||
3174 | goto out; | ||
3175 | } | ||
3176 | list_add_rcu(&mod->list, &modules); | ||
3177 | err = 0; | ||
3178 | |||
3179 | out: | ||
3180 | mutex_unlock(&module_mutex); | ||
3181 | out_unlocked: | ||
3182 | return err; | ||
3183 | } | ||
3184 | |||
3185 | static int complete_formation(struct module *mod, struct load_info *info) | ||
3186 | { | ||
3187 | int err; | ||
3188 | |||
3189 | mutex_lock(&module_mutex); | ||
3190 | |||
3191 | /* Find duplicate symbols (must be called under lock). */ | ||
3192 | err = verify_export_symbols(mod); | ||
3193 | if (err < 0) | ||
3194 | goto out; | ||
3195 | |||
3196 | /* This relies on module_mutex for list integrity. */ | ||
3197 | module_bug_finalize(info->hdr, info->sechdrs, mod); | ||
3198 | |||
3199 | /* Mark state as coming so strong_try_module_get() ignores us, | ||
3200 | * but kallsyms etc. can see us. */ | ||
3201 | mod->state = MODULE_STATE_COMING; | ||
3202 | |||
3203 | out: | ||
3204 | mutex_unlock(&module_mutex); | ||
3205 | return err; | ||
3206 | } | ||
3207 | |||
3144 | /* Allocate and load the module: note that size of section 0 is always | 3208 | /* Allocate and load the module: note that size of section 0 is always |
3145 | zero, and we rely on this for optional sections. */ | 3209 | zero, and we rely on this for optional sections. */ |
3146 | static int load_module(struct load_info *info, const char __user *uargs, | 3210 | static int load_module(struct load_info *info, const char __user *uargs, |
3147 | int flags) | 3211 | int flags) |
3148 | { | 3212 | { |
3149 | struct module *mod, *old; | 3213 | struct module *mod; |
3150 | long err; | 3214 | long err; |
3151 | 3215 | ||
3152 | err = module_sig_check(info); | 3216 | err = module_sig_check(info); |
@@ -3164,36 +3228,20 @@ static int load_module(struct load_info *info, const char __user *uargs, | |||
3164 | goto free_copy; | 3228 | goto free_copy; |
3165 | } | 3229 | } |
3166 | 3230 | ||
3167 | /* | 3231 | /* Reserve our place in the list. */ |
3168 | * We try to place it in the list now to make sure it's unique | 3232 | err = add_unformed_module(mod); |
3169 | * before we dedicate too many resources. In particular, | 3233 | if (err) |
3170 | * temporary percpu memory exhaustion. | ||
3171 | */ | ||
3172 | mod->state = MODULE_STATE_UNFORMED; | ||
3173 | again: | ||
3174 | mutex_lock(&module_mutex); | ||
3175 | if ((old = find_module_all(mod->name, true)) != NULL) { | ||
3176 | if (old->state == MODULE_STATE_COMING | ||
3177 | || old->state == MODULE_STATE_UNFORMED) { | ||
3178 | /* Wait in case it fails to load. */ | ||
3179 | mutex_unlock(&module_mutex); | ||
3180 | err = wait_event_interruptible(module_wq, | ||
3181 | finished_loading(mod->name)); | ||
3182 | if (err) | ||
3183 | goto free_module; | ||
3184 | goto again; | ||
3185 | } | ||
3186 | err = -EEXIST; | ||
3187 | mutex_unlock(&module_mutex); | ||
3188 | goto free_module; | 3234 | goto free_module; |
3189 | } | ||
3190 | list_add_rcu(&mod->list, &modules); | ||
3191 | mutex_unlock(&module_mutex); | ||
3192 | 3235 | ||
3193 | #ifdef CONFIG_MODULE_SIG | 3236 | #ifdef CONFIG_MODULE_SIG |
3194 | mod->sig_ok = info->sig_ok; | 3237 | mod->sig_ok = info->sig_ok; |
3195 | if (!mod->sig_ok) | 3238 | if (!mod->sig_ok) { |
3196 | add_taint_module(mod, TAINT_FORCED_MODULE); | 3239 | printk_once(KERN_NOTICE |
3240 | "%s: module verification failed: signature and/or" | ||
3241 | " required key missing - tainting kernel\n", | ||
3242 | mod->name); | ||
3243 | add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_STILL_OK); | ||
3244 | } | ||
3197 | #endif | 3245 | #endif |
3198 | 3246 | ||
3199 | /* Now module is in final location, initialize linked lists, etc. */ | 3247 | /* Now module is in final location, initialize linked lists, etc. */ |
@@ -3236,21 +3284,11 @@ again: | |||
3236 | 3284 | ||
3237 | dynamic_debug_setup(info->debug, info->num_debug); | 3285 | dynamic_debug_setup(info->debug, info->num_debug); |
3238 | 3286 | ||
3239 | mutex_lock(&module_mutex); | 3287 | /* Finally it's fully formed, ready to start executing. */ |
3240 | /* Find duplicate symbols (must be called under lock). */ | 3288 | err = complete_formation(mod, info); |
3241 | err = verify_export_symbols(mod); | 3289 | if (err) |
3242 | if (err < 0) | ||
3243 | goto ddebug_cleanup; | 3290 | goto ddebug_cleanup; |
3244 | 3291 | ||
3245 | /* This relies on module_mutex for list integrity. */ | ||
3246 | module_bug_finalize(info->hdr, info->sechdrs, mod); | ||
3247 | |||
3248 | /* Mark state as coming so strong_try_module_get() ignores us, | ||
3249 | * but kallsyms etc. can see us. */ | ||
3250 | mod->state = MODULE_STATE_COMING; | ||
3251 | |||
3252 | mutex_unlock(&module_mutex); | ||
3253 | |||
3254 | /* Module is ready to execute: parsing args may do that. */ | 3292 | /* Module is ready to execute: parsing args may do that. */ |
3255 | err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, | 3293 | err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, |
3256 | -32768, 32767, &ddebug_dyndbg_module_param_cb); | 3294 | -32768, 32767, &ddebug_dyndbg_module_param_cb); |
@@ -3274,8 +3312,8 @@ again: | |||
3274 | /* module_bug_cleanup needs module_mutex protection */ | 3312 | /* module_bug_cleanup needs module_mutex protection */ |
3275 | mutex_lock(&module_mutex); | 3313 | mutex_lock(&module_mutex); |
3276 | module_bug_cleanup(mod); | 3314 | module_bug_cleanup(mod); |
3277 | ddebug_cleanup: | ||
3278 | mutex_unlock(&module_mutex); | 3315 | mutex_unlock(&module_mutex); |
3316 | ddebug_cleanup: | ||
3279 | dynamic_debug_remove(info->debug); | 3317 | dynamic_debug_remove(info->debug); |
3280 | synchronize_sched(); | 3318 | synchronize_sched(); |
3281 | kfree(mod->args); | 3319 | kfree(mod->args); |
diff --git a/kernel/panic.c b/kernel/panic.c index e1b2822fff97..7c57cc9eee2c 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -259,26 +259,19 @@ unsigned long get_taint(void) | |||
259 | return tainted_mask; | 259 | return tainted_mask; |
260 | } | 260 | } |
261 | 261 | ||
262 | void add_taint(unsigned flag) | 262 | /** |
263 | * add_taint: add a taint flag if not already set. | ||
264 | * @flag: one of the TAINT_* constants. | ||
265 | * @lockdep_ok: whether lock debugging is still OK. | ||
266 | * | ||
267 | * If something bad has gone wrong, you'll want @lockdebug_ok = false, but for | ||
268 | * some notewortht-but-not-corrupting cases, it can be set to true. | ||
269 | */ | ||
270 | void add_taint(unsigned flag, enum lockdep_ok lockdep_ok) | ||
263 | { | 271 | { |
264 | /* | 272 | if (lockdep_ok == LOCKDEP_NOW_UNRELIABLE && __debug_locks_off()) |
265 | * Can't trust the integrity of the kernel anymore. | 273 | printk(KERN_WARNING |
266 | * We don't call directly debug_locks_off() because the issue | 274 | "Disabling lock debugging due to kernel taint\n"); |
267 | * is not necessarily serious enough to set oops_in_progress to 1 | ||
268 | * Also we want to keep up lockdep for staging/out-of-tree | ||
269 | * development and post-warning case. | ||
270 | */ | ||
271 | switch (flag) { | ||
272 | case TAINT_CRAP: | ||
273 | case TAINT_OOT_MODULE: | ||
274 | case TAINT_WARN: | ||
275 | case TAINT_FIRMWARE_WORKAROUND: | ||
276 | break; | ||
277 | |||
278 | default: | ||
279 | if (__debug_locks_off()) | ||
280 | printk(KERN_WARNING "Disabling lock debugging due to kernel taint\n"); | ||
281 | } | ||
282 | 275 | ||
283 | set_bit(flag, &tainted_mask); | 276 | set_bit(flag, &tainted_mask); |
284 | } | 277 | } |
@@ -421,7 +414,8 @@ static void warn_slowpath_common(const char *file, int line, void *caller, | |||
421 | print_modules(); | 414 | print_modules(); |
422 | dump_stack(); | 415 | dump_stack(); |
423 | print_oops_end_marker(); | 416 | print_oops_end_marker(); |
424 | add_taint(taint); | 417 | /* Just a warning, don't kill lockdep. */ |
418 | add_taint(taint, LOCKDEP_STILL_OK); | ||
425 | } | 419 | } |
426 | 420 | ||
427 | void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...) | 421 | void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...) |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index f1bdecf09afb..fc9103e9ff03 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -2796,7 +2796,7 @@ static noinline void __schedule_bug(struct task_struct *prev) | |||
2796 | if (irqs_disabled()) | 2796 | if (irqs_disabled()) |
2797 | print_irqtrace_events(prev); | 2797 | print_irqtrace_events(prev); |
2798 | dump_stack(); | 2798 | dump_stack(); |
2799 | add_taint(TAINT_WARN); | 2799 | add_taint(TAINT_WARN, LOCKDEP_STILL_OK); |
2800 | } | 2800 | } |
2801 | 2801 | ||
2802 | /* | 2802 | /* |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 95e9e55602a8..d8df00e69c14 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -2018,7 +2018,7 @@ static int proc_taint(struct ctl_table *table, int write, | |||
2018 | int i; | 2018 | int i; |
2019 | for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) { | 2019 | for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) { |
2020 | if ((tmptaint >> i) & 1) | 2020 | if ((tmptaint >> i) & 1) |
2021 | add_taint(i); | 2021 | add_taint(i, LOCKDEP_STILL_OK); |
2022 | } | 2022 | } |
2023 | } | 2023 | } |
2024 | 2024 | ||
@@ -166,7 +166,8 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) | |||
166 | print_modules(); | 166 | print_modules(); |
167 | show_regs(regs); | 167 | show_regs(regs); |
168 | print_oops_end_marker(); | 168 | print_oops_end_marker(); |
169 | add_taint(BUG_GET_TAINT(bug)); | 169 | /* Just a warning, don't kill lockdep. */ |
170 | add_taint(BUG_GET_TAINT(bug), LOCKDEP_STILL_OK); | ||
170 | return BUG_TRAP_TYPE_WARN; | 171 | return BUG_TRAP_TYPE_WARN; |
171 | } | 172 | } |
172 | 173 | ||
diff --git a/mm/memory.c b/mm/memory.c index 705473afc1f4..494526ae024a 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -720,7 +720,7 @@ static void print_bad_pte(struct vm_area_struct *vma, unsigned long addr, | |||
720 | print_symbol(KERN_ALERT "vma->vm_file->f_op->mmap: %s\n", | 720 | print_symbol(KERN_ALERT "vma->vm_file->f_op->mmap: %s\n", |
721 | (unsigned long)vma->vm_file->f_op->mmap); | 721 | (unsigned long)vma->vm_file->f_op->mmap); |
722 | dump_stack(); | 722 | dump_stack(); |
723 | add_taint(TAINT_BAD_PAGE); | 723 | add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); |
724 | } | 724 | } |
725 | 725 | ||
726 | static inline bool is_cow_mapping(vm_flags_t flags) | 726 | static inline bool is_cow_mapping(vm_flags_t flags) |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e9075fdef695..0dade3f18f7d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -333,7 +333,7 @@ static void bad_page(struct page *page) | |||
333 | out: | 333 | out: |
334 | /* Leave bad fields for debug, except PageBuddy could make trouble */ | 334 | /* Leave bad fields for debug, except PageBuddy could make trouble */ |
335 | page_mapcount_reset(page); /* remove PageBuddy */ | 335 | page_mapcount_reset(page); /* remove PageBuddy */ |
336 | add_taint(TAINT_BAD_PAGE); | 336 | add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); |
337 | } | 337 | } |
338 | 338 | ||
339 | /* | 339 | /* |
@@ -812,7 +812,7 @@ static void __slab_error(const char *function, struct kmem_cache *cachep, | |||
812 | printk(KERN_ERR "slab error in %s(): cache `%s': %s\n", | 812 | printk(KERN_ERR "slab error in %s(): cache `%s': %s\n", |
813 | function, cachep->name, msg); | 813 | function, cachep->name, msg); |
814 | dump_stack(); | 814 | dump_stack(); |
815 | add_taint(TAINT_BAD_PAGE); | 815 | add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); |
816 | } | 816 | } |
817 | #endif | 817 | #endif |
818 | 818 | ||
@@ -562,7 +562,7 @@ static void slab_bug(struct kmem_cache *s, char *fmt, ...) | |||
562 | printk(KERN_ERR "----------------------------------------" | 562 | printk(KERN_ERR "----------------------------------------" |
563 | "-------------------------------------\n\n"); | 563 | "-------------------------------------\n\n"); |
564 | 564 | ||
565 | add_taint(TAINT_BAD_PAGE); | 565 | add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); |
566 | } | 566 | } |
567 | 567 | ||
568 | static void slab_fix(struct kmem_cache *s, char *fmt, ...) | 568 | static void slab_fix(struct kmem_cache *s, char *fmt, ...) |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index ff36c508a10e..1c6fbb1a4f8e 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -830,6 +830,8 @@ static const char *section_white_list[] = | |||
830 | ".toc*", | 830 | ".toc*", |
831 | ".xt.prop", /* xtensa */ | 831 | ".xt.prop", /* xtensa */ |
832 | ".xt.lit", /* xtensa */ | 832 | ".xt.lit", /* xtensa */ |
833 | ".arcextmap*", /* arc */ | ||
834 | ".gnu.linkonce.arcext*", /* arc : modules */ | ||
833 | NULL | 835 | NULL |
834 | }; | 836 | }; |
835 | 837 | ||
diff --git a/scripts/sign-file b/scripts/sign-file index 974a20b661b7..2b7c4484d46c 100755 --- a/scripts/sign-file +++ b/scripts/sign-file | |||
@@ -2,51 +2,45 @@ | |||
2 | # | 2 | # |
3 | # Sign a module file using the given key. | 3 | # Sign a module file using the given key. |
4 | # | 4 | # |
5 | # Format: | 5 | |
6 | # | 6 | my $USAGE = |
7 | # ./scripts/sign-file [-v] <key> <x509> <module> [<dest>] | 7 | "Usage: scripts/sign-file [-v] <hash algo> <key> <x509> <module> [<dest>]\n" . |
8 | # | 8 | " scripts/sign-file [-v] -s <raw sig> <hash algo> <x509> <module> [<dest>]\n"; |
9 | # | 9 | |
10 | use strict; | 10 | use strict; |
11 | use FileHandle; | 11 | use FileHandle; |
12 | use IPC::Open2; | 12 | use IPC::Open2; |
13 | use Getopt::Std; | ||
13 | 14 | ||
14 | my $verbose = 0; | 15 | my %opts; |
15 | if ($#ARGV >= 0 && $ARGV[0] eq "-v") { | 16 | getopts('vs:', \%opts) or die $USAGE; |
16 | $verbose = 1; | 17 | my $verbose = $opts{'v'}; |
17 | shift; | 18 | my $signature_file = $opts{'s'}; |
18 | } | ||
19 | 19 | ||
20 | die "Format: ./scripts/sign-file [-v] <key> <x509> <module> [<dest>]\n" | 20 | die $USAGE if ($#ARGV > 4); |
21 | if ($#ARGV != 2 && $#ARGV != 3); | 21 | die $USAGE if (!$signature_file && $#ARGV < 3 || $signature_file && $#ARGV < 2); |
22 | 22 | ||
23 | my $private_key = $ARGV[0]; | 23 | my $dgst = shift @ARGV; |
24 | my $x509 = $ARGV[1]; | 24 | my $private_key; |
25 | my $module = $ARGV[2]; | 25 | if (!$signature_file) { |
26 | my $dest = ($#ARGV == 3) ? $ARGV[3] : $ARGV[2] . "~"; | 26 | $private_key = shift @ARGV; |
27 | } | ||
28 | my $x509 = shift @ARGV; | ||
29 | my $module = shift @ARGV; | ||
30 | my ($dest, $keep_orig); | ||
31 | if (@ARGV) { | ||
32 | $dest = $ARGV[0]; | ||
33 | $keep_orig = 1; | ||
34 | } else { | ||
35 | $dest = $module . "~"; | ||
36 | } | ||
27 | 37 | ||
28 | die "Can't read private key\n" unless (-r $private_key); | 38 | die "Can't read private key\n" if (!$signature_file && !-r $private_key); |
39 | die "Can't read signature file\n" if ($signature_file && !-r $signature_file); | ||
29 | die "Can't read X.509 certificate\n" unless (-r $x509); | 40 | die "Can't read X.509 certificate\n" unless (-r $x509); |
30 | die "Can't read module\n" unless (-r $module); | 41 | die "Can't read module\n" unless (-r $module); |
31 | 42 | ||
32 | # | 43 | # |
33 | # Read the kernel configuration | ||
34 | # | ||
35 | my %config = ( | ||
36 | CONFIG_MODULE_SIG_SHA512 => 1 | ||
37 | ); | ||
38 | |||
39 | if (-r ".config") { | ||
40 | open(FD, "<.config") || die ".config"; | ||
41 | while (<FD>) { | ||
42 | if ($_ =~ /^(CONFIG_.*)=[ym]/) { | ||
43 | $config{$1} = 1; | ||
44 | } | ||
45 | } | ||
46 | close(FD); | ||
47 | } | ||
48 | |||
49 | # | ||
50 | # Function to read the contents of a file into a variable. | 44 | # Function to read the contents of a file into a variable. |
51 | # | 45 | # |
52 | sub read_file($) | 46 | sub read_file($) |
@@ -321,73 +315,71 @@ my $id_type = 1; # Identifier type: X.509 | |||
321 | # | 315 | # |
322 | # Digest the data | 316 | # Digest the data |
323 | # | 317 | # |
324 | my ($dgst, $prologue) = (); | 318 | my $prologue; |
325 | if (exists $config{"CONFIG_MODULE_SIG_SHA1"}) { | 319 | if ($dgst eq "sha1") { |
326 | $prologue = pack("C*", | 320 | $prologue = pack("C*", |
327 | 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, | 321 | 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, |
328 | 0x2B, 0x0E, 0x03, 0x02, 0x1A, | 322 | 0x2B, 0x0E, 0x03, 0x02, 0x1A, |
329 | 0x05, 0x00, 0x04, 0x14); | 323 | 0x05, 0x00, 0x04, 0x14); |
330 | $dgst = "-sha1"; | ||
331 | $hash = 2; | 324 | $hash = 2; |
332 | } elsif (exists $config{"CONFIG_MODULE_SIG_SHA224"}) { | 325 | } elsif ($dgst eq "sha224") { |
333 | $prologue = pack("C*", | 326 | $prologue = pack("C*", |
334 | 0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09, | 327 | 0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09, |
335 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, | 328 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, |
336 | 0x05, 0x00, 0x04, 0x1C); | 329 | 0x05, 0x00, 0x04, 0x1C); |
337 | $dgst = "-sha224"; | ||
338 | $hash = 7; | 330 | $hash = 7; |
339 | } elsif (exists $config{"CONFIG_MODULE_SIG_SHA256"}) { | 331 | } elsif ($dgst eq "sha256") { |
340 | $prologue = pack("C*", | 332 | $prologue = pack("C*", |
341 | 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, | 333 | 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, |
342 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, | 334 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, |
343 | 0x05, 0x00, 0x04, 0x20); | 335 | 0x05, 0x00, 0x04, 0x20); |
344 | $dgst = "-sha256"; | ||
345 | $hash = 4; | 336 | $hash = 4; |
346 | } elsif (exists $config{"CONFIG_MODULE_SIG_SHA384"}) { | 337 | } elsif ($dgst eq "sha384") { |
347 | $prologue = pack("C*", | 338 | $prologue = pack("C*", |
348 | 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, | 339 | 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, |
349 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, | 340 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, |
350 | 0x05, 0x00, 0x04, 0x30); | 341 | 0x05, 0x00, 0x04, 0x30); |
351 | $dgst = "-sha384"; | ||
352 | $hash = 5; | 342 | $hash = 5; |
353 | } elsif (exists $config{"CONFIG_MODULE_SIG_SHA512"}) { | 343 | } elsif ($dgst eq "sha512") { |
354 | $prologue = pack("C*", | 344 | $prologue = pack("C*", |
355 | 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, | 345 | 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, |
356 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, | 346 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, |
357 | 0x05, 0x00, 0x04, 0x40); | 347 | 0x05, 0x00, 0x04, 0x40); |
358 | $dgst = "-sha512"; | ||
359 | $hash = 6; | 348 | $hash = 6; |
360 | } else { | 349 | } else { |
361 | die "Can't determine hash algorithm"; | 350 | die "Unknown hash algorithm: $dgst\n"; |
362 | } | 351 | } |
363 | 352 | ||
364 | # | ||
365 | # Generate the digest and read from openssl's stdout | ||
366 | # | ||
367 | my $digest; | ||
368 | $digest = readpipe("openssl dgst $dgst -binary $module") || die "openssl dgst"; | ||
369 | |||
370 | # | ||
371 | # Generate the binary signature, which will be just the integer that comprises | ||
372 | # the signature with no metadata attached. | ||
373 | # | ||
374 | my $pid; | ||
375 | $pid = open2(*read_from, *write_to, | ||
376 | "openssl rsautl -sign -inkey $private_key -keyform PEM") || | ||
377 | die "openssl rsautl"; | ||
378 | binmode write_to; | ||
379 | print write_to $prologue . $digest || die "pipe to openssl rsautl"; | ||
380 | close(write_to) || die "pipe to openssl rsautl"; | ||
381 | |||
382 | binmode read_from; | ||
383 | my $signature; | 353 | my $signature; |
384 | read(read_from, $signature, 4096) || die "pipe from openssl rsautl"; | 354 | if ($signature_file) { |
385 | close(read_from) || die "pipe from openssl rsautl"; | 355 | $signature = read_file($signature_file); |
356 | } else { | ||
357 | # | ||
358 | # Generate the digest and read from openssl's stdout | ||
359 | # | ||
360 | my $digest; | ||
361 | $digest = readpipe("openssl dgst -$dgst -binary $module") || die "openssl dgst"; | ||
362 | |||
363 | # | ||
364 | # Generate the binary signature, which will be just the integer that | ||
365 | # comprises the signature with no metadata attached. | ||
366 | # | ||
367 | my $pid; | ||
368 | $pid = open2(*read_from, *write_to, | ||
369 | "openssl rsautl -sign -inkey $private_key -keyform PEM") || | ||
370 | die "openssl rsautl"; | ||
371 | binmode write_to; | ||
372 | print write_to $prologue . $digest || die "pipe to openssl rsautl"; | ||
373 | close(write_to) || die "pipe to openssl rsautl"; | ||
374 | |||
375 | binmode read_from; | ||
376 | read(read_from, $signature, 4096) || die "pipe from openssl rsautl"; | ||
377 | close(read_from) || die "pipe from openssl rsautl"; | ||
378 | waitpid($pid, 0) || die; | ||
379 | die "openssl rsautl died: $?" if ($? >> 8); | ||
380 | } | ||
386 | $signature = pack("n", length($signature)) . $signature, | 381 | $signature = pack("n", length($signature)) . $signature, |
387 | 382 | ||
388 | waitpid($pid, 0) || die; | ||
389 | die "openssl rsautl died: $?" if ($? >> 8); | ||
390 | |||
391 | # | 383 | # |
392 | # Build the signed binary | 384 | # Build the signed binary |
393 | # | 385 | # |
@@ -424,6 +416,6 @@ print FD | |||
424 | ; | 416 | ; |
425 | close FD || die $dest; | 417 | close FD || die $dest; |
426 | 418 | ||
427 | if ($#ARGV != 3) { | 419 | if (!$keep_orig) { |
428 | rename($dest, $module) || die $module; | 420 | rename($dest, $module) || die $module; |
429 | } | 421 | } |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 8df1b3feaf2b..b7e84a7cd9ee 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -251,7 +251,7 @@ static ssize_t codec_reg_write_file(struct file *file, | |||
251 | return -EINVAL; | 251 | return -EINVAL; |
252 | 252 | ||
253 | /* Userspace has been fiddling around behind the kernel's back */ | 253 | /* Userspace has been fiddling around behind the kernel's back */ |
254 | add_taint(TAINT_USER); | 254 | add_taint(TAINT_USER, LOCKDEP_NOW_UNRELIABLE); |
255 | 255 | ||
256 | snd_soc_write(codec, reg, value); | 256 | snd_soc_write(codec, reg, value); |
257 | return buf_size; | 257 | return buf_size; |