lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 20 Feb 2013 21:46:18 +0100 (CET)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Dave Jones <davej@...hat.com>
cc:	"Rafael J. Wysocki" <rjw@...k.pl>, x86@...nel.org,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	Tang Chen <tangchen@...fujitsu.com>,
	Tony Luck <tony.luck@...el.com>
Subject: Re: odd GPF bug on resume from hibernate.

On Wed, 20 Feb 2013, Dave Jones wrote:

> On Wed, Feb 20, 2013 at 08:42:46PM +0100, Rafael J. Wysocki wrote:
>  > On Wednesday, February 20, 2013 02:28:26 PM Dave Jones wrote:
>  > > We had two users report hitting a bug that looks like this..
>  > > 
>  > > general protection fault: 8800 [#1] SMP 
>  > > 
>  > >    0:	ca 00 55             	lret   $0x5500
>  > > 
>  > > At this point I don't know where to begin debugging..
>  > > 
>  > > Is that 8800 error code a clue ?
>  > 
>  > Does CPU offline/online work on this machine?
> 
> I just asked the user to give that a try at https://bugzilla.redhat.com/show_bug.cgi?id=910162
> 
> Incidentally, I found that offlining a cpu in Linus' current tree
> causes a mess..
> 
> 
> numa_remove_cpu cpu 1 node 0: mask now 0,2-3
> smpboot: CPU 1 is now offline
> BUG: using smp_processor_id() in preemptible [00000000] code: bash/5976
> caller is cmci_rediscover+0x6b/0xe0
> Pid: 5976, comm: bash Not tainted 3.8.0-rc7+ #63
> Call Trace:
>  [<ffffffff812fb901>] debug_smp_processor_id+0xe1/0x100
>  [<ffffffff8101e4bb>] cmci_rediscover+0x6b/0xe0
>  [<ffffffff8158f55f>] mce_cpu_callback+0x1af/0x1c3
>  [<ffffffff815a6893>] notifier_call_chain+0x53/0xa0
>  [<ffffffff8107338e>] __raw_notifier_call_chain+0xe/0x10
>  [<ffffffff810491e0>] __cpu_notify+0x20/0x40
>  [<ffffffff81049215>] cpu_notify+0x15/0x20
>  [<ffffffff8104939e>] cpu_notify_nofail+0xe/0x20
>  [<ffffffff81588512>] _cpu_down+0x242/0x2b0
>  [<ffffffff815885b6>] cpu_down+0x36/0x50

That's caused by: commit 85b97637bb40a9f486459dd254598759af9c3d50

       x86/mce: Do not change worker's running cpu in cmci_rediscover().

mce_cpu_callback() does:

        if (action == CPU_POST_DEAD) {
                /* intentionally ignoring frozen here */
                cmci_rediscover(cpu);
        }

This is called from preemptible context.

Now cmci_rediscover() grew the following addon:

+   		      if (cpu == smp_processor_id()) {
+		      	      cmci_rediscover_work_func(NULL);
					continue;

Which causes the above splat. It seems testing with full debugging is
overrated.

Find the fix below, though it's debatable whether that "optimization"
of calling the function directly is worth the trouble.

Thanks,

	tglx

Index: linux-2.6/arch/x86/kernel/cpu/mcheck/mce_intel.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ linux-2.6/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -311,10 +311,12 @@ void cmci_rediscover(int dying)
 		if (cpu == dying)
 			continue;
 
-		if (cpu == smp_processor_id()) {
+		if (cpu == get_cpu()) {
 			cmci_rediscover_work_func(NULL);
+			put_cpu();
 			continue;
 		}
+		put_cpu();
 
 		work_on_cpu(cpu, cmci_rediscover_work_func, NULL);
 	}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ