[PATCH] Fix potential interrupts during alternative patching [was Re: [RFC] Avoid PIT SMP lockups]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



S.Çağlar Onur wrote:
17 Eki 2006 Sal 01:21 tarihinde, S.Çağlar Onur şunları yazmıştı:
17 Eki 2006 Sal 01:17 tarihinde, Zachary Amsden şunları yazmıştı:
My nasty quick patch might not apply - the only tree I've got is a very
hacked 2.6.18-rc6-mm1+local-patches thing, but the fix should be obvious
enough.
Ok, I'll test and report back...

Both 2.6.18 and 2.6.18.1 boots without any problem (and of course without noreplacement workarund) with that patch.

Cheers

So this patch is an obvious bugfix - please apply, and to stable as well. I'm not sure when this broke, but taking interrupts in the middle of self modifying code is not a pretty sight.

Zach
Interrupts must be disabled during alternative instruction patching.
On systems with high timer IRQ rates, or when running in an emulator,
timing differences can result in random kernel panics because of
running partially patched instructions.  This doesn't yet fix NMIs,
which requires extricating the patch code from the late bug checking
and is logically separate (and also less likely to cause problems).

Signed-off-by: Zachary Amsden <[email protected]>


diff -r 773ac0ebfeb4 arch/i386/kernel/alternative.c
--- a/arch/i386/kernel/alternative.c	Wed Oct 18 06:03:56 2006 -0700
+++ b/arch/i386/kernel/alternative.c	Wed Oct 18 06:07:03 2006 -0700
@@ -344,6 +344,7 @@ void alternatives_smp_switch(int smp)
 
 void __init alternative_instructions(void)
 {
+	unsigned long flags;
 	if (no_replacement) {
 		printk(KERN_INFO "(SMP-)alternatives turned off\n");
 		free_init_pages("SMP alternatives",
@@ -351,6 +352,8 @@ void __init alternative_instructions(voi
 				(unsigned long)__smp_alt_end);
 		return;
 	}
+
+	local_irq_save(flags);
 	apply_alternatives(__alt_instructions, __alt_instructions_end);
 
 	/* switch to patch-once-at-boottime-only mode and free the
@@ -386,4 +389,5 @@ void __init alternative_instructions(voi
 		alternatives_smp_switch(0);
 	}
 #endif
-}
+	local_irq_restore(flags);
+}

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux