public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	akpm@osdl.org, Rusty Russell <rusty@rustcorp.com.au>,
	Glauber de Oliveira Costa <gcosta@redhat.com>,
	Jan Beulich <jbeulich@novell.com>, Andi Kleen <ak@suse.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	pinskia@gcc.gnu.org
Subject: Re: [PATCH] pop previous section in alternative.c
Date: Thu, 10 Apr 2008 09:00:08 +0200	[thread overview]
Message-ID: <20080410070008.GC30066@elte.hu> (raw)
In-Reply-To: <Pine.LNX.4.58.0804091906040.31970@gandalf.stny.rr.com>



* Steven Rostedt <rostedt@goodmis.org> wrote:



> On Wed, 9 Apr 2008, Steven Rostedt wrote:

> 

> > gcc expects all toplevel assembly to return to the original section 

> > type. The code in alteranative.c does not do this. This caused some 

> > strange bugs in sched-devel where code would end up in the .rodata 

> > section and when the kernel sets the NX bit on all .rodata, the 

> > kernel would crash when executing this code.

> >

> > This patch adds a .previous marker to return the code back to the 

> > original section.

> 

> Oh, and this would not be complete without giving Andrew Pinski 

> complete credit for telling me it wasn't a gcc bug but a bug in the 

> toplevel asm code in the kernel. ;-)



thanks Steve and Andrew for resolving this so quickly! For the record, 

here's the original, mysterious-looking crash that Peter saw with ftrace 

enabled, under sched-devel:



---------->

ACPI: PCI Interrupt 0000:01:0e.1[A] -> GSI 11 (level, low) -> IRQ 11

Waiting for driver initialization.

Loading shpchp.ko module

BUG: unable to handle kernel paging request at ffffffff8054f06a

IP: [<ffffffff8054f06a>] constant_test_bit+0x0/0x26

PGD 203067 PUD 207063 PMD 7f81d163 PTE 800000000054f161

Oops: 0011 [1] PREEMPT SMP 

CPU 0 

Modules linked in: sata_svw ata_generic

Pid: 565, comm: insmod Not tainted 2.6.25-rc8-sched-devel.git-x86-latest.git #177

RIP: 0010:[<ffffffff8054f06a>]  [<ffffffff8054f06a>] constant_test_bit+0x0/0x26

RSP: 0018:ffff81007d693d40  EFLAGS: 00010246

RAX: ffff81007f805db0 RBX: ffff81007d4e5b80 RCX: 0000000000000000

RDX: ffff81007d4e5bb0 RSI: ffffffff8074c114 RDI: 0000000000000069

RBP: ffff81007d693d88 R08: ffffffff80964770 R09: 0000000000000000

R10: 000000037d693c78 R11: ffff81007d693cd8 R12: ffffffffa000b464

R13: ffffffffa0008000 R14: ffffffffa000cdc0 R15: ffffffffa000cda0

FS:  00007f96cec7d6f0(0000) GS:ffffffff8072a000(0000) knlGS:0000000000000000

CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b

CR2: ffffffff8054f06a CR3: 000000007d5c8000 CR4: 00000000000006e0

DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000

DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400

Process insmod (pid: 565, threadinfo ffff81007d692000, task ffff81007d690000)

Stack:  ffffffff802125c9 ffff81007d693d78 ffffffffa0010998 ffffffffa0010980

 ffffc20000032790 ffffc20000031f1d 0000000000000000 ffffc20000032010

 ffffc2000002b000 ffff81007d693de8 ffffffff8022359f ffffffffa0010980

Call Trace:

 [<ffffffff802125c9>] ? alternatives_smp_module_add+0x117/0x14e

 [<ffffffff8022359f>] module_finalize+0x118/0x136

 [<ffffffff80268b08>] sys_init_module+0x1496/0x1a79

 [<ffffffff8053c61a>] ? _spin_unlock_irqrestore+0x6b/0x79

 [<ffffffff80383ba5>] ? acpi_get_hp_params_from_firmware+0x0/0x50b

 [<ffffffff8053b88d>] ? trace_hardirqs_on_thunk+0x3a/0x3f

 [<ffffffff8053b88d>] ? trace_hardirqs_on_thunk+0x3a/0x3f

 [<ffffffff8025ee36>] ? trace_hardirqs_on_caller+0x109/0x12d

 [<ffffffff8053b88d>] ? trace_hardirqs_on_thunk+0x3a/0x3f

 [<ffffffff8020c41b>] system_call_after_swapgs+0x7b/0x80



Code: 00 00 0f 1f 80 00 00 00 00 0f 1f 84 00 00 00 00 00 55 48 89 e5 e8 d7 d1 cb ff 89 f8 c1 f8 05 48 98 48 8d 04 86 f0 0f b3 3e c9 c3 <55> 48 89 e5 e8 bd d1 cb ff 89 f9 bf 40 00 00 00 89 c8 99 f7 ff 

RIP  [<ffffffff8054f06a>] constant_test_bit+0x0/0x26

 RSP <ffff81007d693d40>

CR2: ffffffff8054f06a

---[ end trace 778e504de7e3b1e3 ]---

note: insmod[565] exited with preempt_count 1

BUG: sleeping function called from invalid context at /mnt/md0/src/linux-2.6-2/kernel/rwsem.c:21



(it only triggered on Peter's hardware)



	Ingo


      parent reply	other threads:[~2008-04-10  7:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-09 23:04 [PATCH] pop previous section in alternative.c Steven Rostedt
2008-04-09 23:51 ` Steven Rostedt
2008-04-10  0:20   ` H. Peter Anvin
2008-04-10  8:47     ` Andi Kleen
2008-04-10  9:46       ` Andy Whitcroft
2008-04-10 14:11         ` Steven Rostedt
2008-04-10 14:41           ` Andi Kleen
2008-04-10 14:43             ` Steven Rostedt
2008-04-10 14:46             ` Linus Torvalds
2008-04-10 14:55               ` Steven Rostedt
2008-04-10 18:40                 ` Sam Ravnborg
2008-04-10 15:05               ` Andi Kleen
2008-04-10 15:18                 ` Linus Torvalds
2008-04-10 16:07                   ` H. Peter Anvin
2008-04-10 16:20                     ` Steven Rostedt
2008-04-10 17:07                       ` H. Peter Anvin
2008-04-10 17:32                         ` Andrew Pinski
2008-04-10 17:53                           ` H. Peter Anvin
2008-04-10 17:36                         ` Linus Torvalds
2008-04-10 17:52                           ` H. Peter Anvin
2008-04-13 15:27                 ` Maciej W. Rozycki
2008-04-10 16:10               ` H. Peter Anvin
2008-04-10  7:00   ` Ingo Molnar [this message]

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=20080410070008.GC30066@elte.hu \
    --to=mingo@elte.hu \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=gcosta@redhat.com \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=pinskia@gcc.gnu.org \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    --cc=tglx@linutronix.de \
    --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