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-next>] [day] [month] [year] [list]
Message-Id: <1238958725.3522.1.camel@ht.satnam>
Date:	Mon, 06 Apr 2009 00:42:05 +0530
From:	Jaswinder Singh Rajput <jaswinder@...nel.org>
To:	John Levon <levon@...ementarian.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Ingo Molnar <mingo@...e.hu>, x86 maintainers <x86@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] x86: fix BUG: using smp_processor_id() in preemptible
 [00000000] code: oprofiled/3319

Fixed this bug on P4 HT machine:
[  474.968698] BUG: using smp_processor_id() in preemptible [00000000] code: oprofiled/3319
[  474.968711] caller is get_stagger+0xe/0x2c
[  474.968716] Pid: 3319, comm: oprofiled Not tainted 2.6.29 #8
[  474.968720] Call Trace:
[  474.968730]  [<c03dee3a>] ? printk+0x14/0x16
[  474.968737]  [<c021bcb8>] debug_smp_processor_id+0xa4/0xb8
[  474.968742]  [<c034d64d>] get_stagger+0xe/0x2c
[  474.968747]  [<c034daa7>] p4_fill_in_addresses+0x33/0x2d4
[  474.968751]  [<c034cc06>] nmi_setup+0xce/0x194
[  474.968756]  [<c034acf9>] oprofile_setup+0x35/0x90
[  474.968760]  [<c034bc55>] event_buffer_open+0x47/0x63
[  474.968766]  [<c0179a8d>] __dentry_open+0x148/0x237
[  474.968770]  [<c0179c20>] nameidata_to_filp+0x31/0x48
[  474.968775]  [<c034bc0e>] ? event_buffer_open+0x0/0x63
[  474.968780]  [<c018493e>] do_filp_open+0x335/0x660
[  474.968786]  [<c0161f85>] ? lru_cache_add_lru+0x2c/0x2e
[  474.968792]  [<c0171808>] ? page_add_new_anon_rmap+0x5d/0x6a
[  474.968797]  [<c017985d>] do_sys_open+0x47/0xc1
[  474.968801]  [<c0179923>] sys_open+0x23/0x2b
[  474.968806]  [<c01029f4>] sysenter_do_call+0x12/0x26

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@...il.com>
---
 arch/x86/oprofile/op_model_p4.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c
index 4c4a51c..d51c116 100644
--- a/arch/x86/oprofile/op_model_p4.c
+++ b/arch/x86/oprofile/op_model_p4.c
@@ -379,8 +379,11 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
 static unsigned int get_stagger(void)
 {
 #ifdef CONFIG_SMP
-	int cpu = smp_processor_id();
-	return (cpu != first_cpu(per_cpu(cpu_sibling_map, cpu)));
+	int cpu = get_cpu();
+	int cpu0 = first_cpu(per_cpu(cpu_sibling_map, cpu));
+	put_cpu();
+	if (cpu != cpu0)
+		return 1;
 #endif
 	return 0;
 }
-- 
1.6.0.6



View attachment "config-ht-20090406-oprofile" of type "text/plain" (53721 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ