From: Greg KH <gregkh@suse.de>
To: <linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Cc: <torvalds@linux-foundation.org>, <akpm@linux-foundation.org>,
<alan@lxorguk.ukuu.org.uk>,
Robert Richter <robert.richter@amd.com>
Subject: [24/27] oprofile, x86: Fix crash when unloading module (nmi timer mode)
Date: Wed, 07 Dec 2011 08:54:57 -0800 [thread overview]
Message-ID: <20111207165602.407872916@clark.kroah.org> (raw)
In-Reply-To: <20111207165611.GA19872@kroah.com>
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Robert Richter <robert.richter@amd.com>
commit 97f7f8189fe54e3cfe324ef9ad35064f3d2d3bff upstream.
If oprofile uses the nmi timer interrupt there is a crash while
unloading the module. The bug can be triggered with oprofile build as
module and kernel parameter nolapic set. This patch fixes this.
oprofile: using NMI timer interrupt.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffff8123c226>] unregister_syscore_ops+0x41/0x58
PGD 42dbca067 PUD 41da6a067 PMD 0
Oops: 0002 [#1] PREEMPT SMP
CPU 5
Modules linked in: oprofile(-) [last unloaded: oprofile]
Pid: 2518, comm: modprobe Not tainted 3.1.0-rc7-00019-gb2fb49d #19 Advanced Micro Device Anaheim/Anaheim
RIP: 0010:[<ffffffff8123c226>] [<ffffffff8123c226>] unregister_syscore_ops+0x41/0x58
RSP: 0018:ffff88041ef71e98 EFLAGS: 00010296
RAX: 0000000000000000 RBX: ffffffffa0017100 RCX: dead000000200200
RDX: 0000000000000000 RSI: dead000000100100 RDI: ffffffff8178c620
RBP: ffff88041ef71ea8 R08: 0000000000000001 R09: 0000000000000082
R10: 0000000000000000 R11: ffff88041ef71de8 R12: 0000000000000080
R13: fffffffffffffff5 R14: 0000000000000001 R15: 0000000000610210
FS: 00007fc902f20700(0000) GS:ffff88042fd40000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000008 CR3: 000000041cdb6000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process modprobe (pid: 2518, threadinfo ffff88041ef70000, task ffff88041d348040)
Stack:
ffff88041ef71eb8 ffffffffa0017790 ffff88041ef71eb8 ffffffffa0013532
ffff88041ef71ec8 ffffffffa00132d6 ffff88041ef71ed8 ffffffffa00159b2
ffff88041ef71f78 ffffffff81073115 656c69666f72706f 0000000000610200
Call Trace:
[<ffffffffa0013532>] op_nmi_exit+0x15/0x17 [oprofile]
[<ffffffffa00132d6>] oprofile_arch_exit+0xe/0x10 [oprofile]
[<ffffffffa00159b2>] oprofile_exit+0x1e/0x20 [oprofile]
[<ffffffff81073115>] sys_delete_module+0x1c3/0x22f
[<ffffffff811bf09e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[<ffffffff8148070b>] system_call_fastpath+0x16/0x1b
Code: 20 c6 78 81 e8 c5 cc 23 00 48 8b 13 48 8b 43 08 48 be 00 01 10 00 00 00 ad de 48 b9 00 02 20 00 00 00 ad de 48 c7 c7 20 c6 78 81
89 42 08 48 89 10 48 89 33 48 89 4b 08 e8 a6 c0 23 00 5a 5b
RIP [<ffffffff8123c226>] unregister_syscore_ops+0x41/0x58
RSP <ffff88041ef71e98>
CR2: 0000000000000008
---[ end trace 43a541a52956b7b0 ]---
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
arch/x86/oprofile/init.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/arch/x86/oprofile/init.c
+++ b/arch/x86/oprofile/init.c
@@ -21,6 +21,7 @@ extern int op_nmi_timer_init(struct opro
extern void op_nmi_exit(void);
extern void x86_backtrace(struct pt_regs * const regs, unsigned int depth);
+static int nmi_timer;
int __init oprofile_arch_init(struct oprofile_operations *ops)
{
@@ -31,8 +32,9 @@ int __init oprofile_arch_init(struct opr
#ifdef CONFIG_X86_LOCAL_APIC
ret = op_nmi_init(ops);
#endif
+ nmi_timer = (ret != 0);
#ifdef CONFIG_X86_IO_APIC
- if (ret < 0)
+ if (nmi_timer)
ret = op_nmi_timer_init(ops);
#endif
ops->backtrace = x86_backtrace;
@@ -44,6 +46,7 @@ int __init oprofile_arch_init(struct opr
void oprofile_arch_exit(void)
{
#ifdef CONFIG_X86_LOCAL_APIC
- op_nmi_exit();
+ if (!nmi_timer)
+ op_nmi_exit();
#endif
}
next prev parent reply other threads:[~2011-12-07 17:04 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 16:56 [00/27] 2.6.32.50-longterm review Greg KH
2011-12-07 16:54 ` [01/27] i2c-algo-bit: Generate correct i2c address sequence for 10-bit target Greg KH
2011-12-07 16:54 ` [02/27] eCryptfs: Extend array bounds for all filename chars Greg KH
2011-12-07 16:54 ` [03/27] PCI hotplug: shpchp: dont blindly claim non-AMD 0x7450 device IDs Greg KH
2011-12-07 16:54 ` [04/27] ARM: 7161/1: errata: no automatic store buffer drain Greg KH
2011-12-07 16:54 ` [05/27] ALSA: lx6464es - fix device communication via command bus Greg KH
2011-12-07 17:13 ` Tim Blechmann
2011-12-07 16:54 ` [06/27] SUNRPC: Ensure we return EAGAIN in xs_nospace if congestion is cleared Greg KH
2011-12-07 16:54 ` [07/27] timekeeping: add arch_offset hook to ktime_get functions Greg KH
2011-12-07 16:54 ` [08/27] p54spi: Add missing spin_lock_init Greg KH
2011-12-07 16:54 ` [09/27] p54spi: Fix workqueue deadlock Greg KH
2011-12-07 16:54 ` [10/27] nl80211: fix MAC address validation Greg KH
2011-12-07 16:54 ` [11/27] gro: reset vlan_tci on reuse Greg KH
2011-12-07 16:54 ` [12/27] staging: usbip: bugfix for deadlock Greg KH
2011-12-07 16:54 ` [13/27] staging: comedi: fix oops for USB DAQ devices Greg KH
2011-12-07 16:54 ` [14/27] Staging: comedi: fix signal handling in read and write Greg KH
2011-12-07 16:54 ` [15/27] USB: whci-hcd: fix endian conversion in qset_clear() Greg KH
2011-12-07 16:54 ` [16/27] usb: ftdi_sio: add PID for Propox ISPcable III Greg KH
2011-12-07 16:54 ` [17/27] usb: option: add SIMCom SIM5218 Greg KH
2011-12-07 16:54 ` [18/27] USB: usb-storage: unusual_devs entry for Kingston DT 101 G2 Greg KH
2011-12-07 16:54 ` [19/27] SCSI: scsi_lib: fix potential NULL dereference Greg KH
2011-12-07 16:54 ` [20/27] SCSI: Silencing killing requests for dead queue Greg KH
2011-12-07 16:54 ` [21/27] cifs: fix cifs stable patch cifs-fix-oplock-break-handling-try-2.patch Greg KH
2011-12-07 16:54 ` [22/27] sched, x86: Avoid unnecessary overflow in sched_clock Greg KH
2011-12-07 16:54 ` [23/27] x86/mpparse: Account for bus types other than ISA and PCI Greg KH
2011-12-07 16:54 ` Greg KH [this message]
2011-12-07 16:54 ` [25/27] genirq: Fix race condition when stopping the irq thread Greg KH
2011-12-07 16:54 ` [26/27] tick-broadcast: Stop active broadcast device when replacing it Greg KH
2011-12-07 16:55 ` [27/27] clockevents: Set noop handler in clockevents_exchange_device() Greg KH
2011-12-29 12:09 ` Jonathan Nieder
2011-12-30 1:05 ` Linus Torvalds
2011-12-30 15:07 ` Tim Gardner
[not found] ` <CA++bM2uqcWFM6=WdmrusmugQw2nH_KDyySKH+1qyr8GK0Cq14A@mail.gmail.com>
2012-01-05 10:27 ` Feng Tang
2012-01-10 14:23 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111207165602.407872916@clark.kroah.org \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=robert.richter@amd.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).