public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [SLAB] __builtin_return_address use without FRAME_POINTER causes boot failure
@ 2005-08-08 20:57 Christoph Lameter
  2005-08-08 21:37 ` Manfred Spraul
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Lameter @ 2005-08-08 20:57 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, manfred

I kept getting boot failures in the slab allocator. The failure goes 
away if one is setting CONFIG_FRAME_POINTER. Seems that 
CONFIG_DEBUG_SLAB implies the use of __buildin_return_address() which 
needs the framepointer.

Crash with 2.6.15-rc3-mm1:

Unable to handle kernel NULL pointer dereference at virtual address 00000004
 printing eip:
c013bebf
*pde = 00000000
Oops: 0000 [#1]
last sysfs file:
Modules linked in:
CPU:    0
EIP:    0060:[<c013bebf>]    Not tainted VLI
EFLAGS: 00010292   (2.6.13-rc5-mm1)
EIP is at kmem_cache_alloc+0x16f/0x1c0
eax: 00000000   ebx: 00000000   ecx: 00000000   edx: c17de13c
esi: c17df080   edi: c17de13c   ebp: c0377f6c   esp: c0377f48
ds: 007b   es: 007b   ss: 0068
Process swapper (pid: 0, threadinfo=c0376000 task=c0329b80)
Stack: c0377f7c 00000004 fffffffc 0000001c c013af6e 800000d0 0000002e 00000000
       c17df15c c17df140 c013af6e 00052c00 c0377f98 c17df15c 00000025 ffffffff
       fffffffc 00000004 00000054 c02e5551 00000014 ffffffc0 0000001c 00000040
Call Trace:
 [<c013af6e>] kmem_cache_create+0x59e/0x7b0
 [<c013af6e>] kmem_cache_create+0x59e/0x7b0
 [<c03826d1>] kmem_cache_init+0x1d1/0x380
 [<c03786dd>] start_kernel+0xcd/0x150
 [<c0378340>] unknown_bootoption+0x0/0x1a0
Code: 5a 75 8b eb ca 89 fa 89 f0 e8 8e e0 ff ff 8b 55 ec 89 10 89 fa 8b 45 00 8b 58 04 89 f0 e8 5a e0 ff ff 89 fa 89 18 8b 45 00 8b 00 <8b> 58 04 89 f0 e8 27 e0 ff ff 89 18 8b 46 18 e9 d7 fe ff ff 89
 <0>Kernel panic - not syncing: Attempted to kill the idle task!


Signed-off-by: Christoph Lameter <christoph@lameter.com>

Index: linux-2.6.13-rc5-mm1/lib/Kconfig.debug
===================================================================
--- linux-2.6.13-rc5-mm1.orig/lib/Kconfig.debug	2005-08-08 11:02:36.000000000 -0700
+++ linux-2.6.13-rc5-mm1/lib/Kconfig.debug	2005-08-08 13:43:17.000000000 -0700
@@ -79,7 +79,7 @@
 
 config DEBUG_SLAB
 	bool "Debug memory allocations"
-	depends on DEBUG_KERNEL
+	depends on DEBUG_KERNEL && FRAME_POINTER
 	help
 	  Say Y here to have the kernel do limited verification on memory
 	  allocation as well as poisoning memory on free to catch use of freed

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SLAB] __builtin_return_address use without FRAME_POINTER causes boot failure
  2005-08-08 20:57 [SLAB] __builtin_return_address use without FRAME_POINTER causes boot failure Christoph Lameter
@ 2005-08-08 21:37 ` Manfred Spraul
  2005-08-08 21:51   ` Andrew Morton
  2005-08-08 21:53   ` Alexander Nyberg
  0 siblings, 2 replies; 6+ messages in thread
From: Manfred Spraul @ 2005-08-08 21:37 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: akpm, linux-kernel

Christoph Lameter wrote:

>I kept getting boot failures in the slab allocator. The failure goes 
>away if one is setting CONFIG_FRAME_POINTER. Seems that 
>CONFIG_DEBUG_SLAB implies the use of __buildin_return_address() which 
>needs the framepointer.
>
>  
>
Very odd. __builtin_return_address(1) needs frame pointers, but slab 
only uses __builtin_return_addresse(0), which should always work.

--
    Manfred

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SLAB] __builtin_return_address use without FRAME_POINTER causes boot failure
  2005-08-08 21:37 ` Manfred Spraul
@ 2005-08-08 21:51   ` Andrew Morton
  2005-08-08 21:53   ` Alexander Nyberg
  1 sibling, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2005-08-08 21:51 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: christoph, linux-kernel

Manfred Spraul <manfred@colorfullife.com> wrote:
>
> Christoph Lameter wrote:
> 
> >I kept getting boot failures in the slab allocator. The failure goes 
> >away if one is setting CONFIG_FRAME_POINTER. Seems that 
> >CONFIG_DEBUG_SLAB implies the use of __buildin_return_address() which 
> >needs the framepointer.
> >
> >  
> >
> Very odd. __builtin_return_address(1) needs frame pointers, but slab 
> only uses __builtin_return_addresse(0), which should always work.

I assume this is due to the now-dropped
slab-leak-detector-give-longer-traces.patch

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SLAB] __builtin_return_address use without FRAME_POINTER causes boot failure
  2005-08-08 21:37 ` Manfred Spraul
  2005-08-08 21:51   ` Andrew Morton
@ 2005-08-08 21:53   ` Alexander Nyberg
  2005-08-09 17:05     ` Manfred Spraul
  1 sibling, 1 reply; 6+ messages in thread
From: Alexander Nyberg @ 2005-08-08 21:53 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: Christoph Lameter, akpm, linux-kernel

On Mon, Aug 08, 2005 at 11:37:18PM +0200 Manfred Spraul wrote:

> Christoph Lameter wrote:
> 
> >I kept getting boot failures in the slab allocator. The failure goes 
> >away if one is setting CONFIG_FRAME_POINTER. Seems that 
> >CONFIG_DEBUG_SLAB implies the use of __buildin_return_address() which 
> >needs the framepointer.
> >
> > 
> >
> Very odd. __builtin_return_address(1) needs frame pointers, but slab 
> only uses __builtin_return_addresse(0), which should always work.
> 

My fault, I introduced a debugging patch (i think i cc'ed you on it)
which used __builtin_return_address([12]) to save traces of who the
caller of an object is.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SLAB] __builtin_return_address use without FRAME_POINTER causes boot failure
  2005-08-08 21:53   ` Alexander Nyberg
@ 2005-08-09 17:05     ` Manfred Spraul
  2005-08-10  9:48       ` Jörn Engel
  0 siblings, 1 reply; 6+ messages in thread
From: Manfred Spraul @ 2005-08-09 17:05 UTC (permalink / raw)
  To: Alexander Nyberg; +Cc: Christoph Lameter, akpm, linux-kernel

Alexander Nyberg wrote:

>My fault, I introduced a debugging patch (i think i cc'ed you on it)
>which used __builtin_return_address([12]) to save traces of who the
>caller of an object is.
>  
>
Ups. I still have your original mail in my inbox.
The correct way is check the whole stack and store all pointers that are 
in kernel_text_address(). See store_stack_info() in mm/slab.c.

--
    Manfred

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SLAB] __builtin_return_address use without FRAME_POINTER causes boot failure
  2005-08-09 17:05     ` Manfred Spraul
@ 2005-08-10  9:48       ` Jörn Engel
  0 siblings, 0 replies; 6+ messages in thread
From: Jörn Engel @ 2005-08-10  9:48 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: Alexander Nyberg, Christoph Lameter, akpm, linux-kernel

On Tue, 9 August 2005 19:05:07 +0200, Manfred Spraul wrote:
> Alexander Nyberg wrote:
> 
> >My fault, I introduced a debugging patch (i think i cc'ed you on it)
> >which used __builtin_return_address([12]) to save traces of who the
> >caller of an object is.
> >
> Ups. I still have your original mail in my inbox.
> The correct way is check the whole stack and store all pointers that are 
> in kernel_text_address(). See store_stack_info() in mm/slab.c.

Ugly.  Wouldn't make a difference on i386, but other architectures
actually don't need to play function-guessing games.  Maybe we could
create an architecture-provided function like
void *get_next_stack_function(void* last_function);

For asm-generic, this would do the i386 style stack guessing, while
other architectures can walk a stack frame for it.

[ Yes, I realize that noone cares enough to actually do it, including
me, but it still would be nice. ]

Jörn

-- 
You can take my soul, but not my lack of enthusiasm.
-- Wally

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-08-10  9:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-08 20:57 [SLAB] __builtin_return_address use without FRAME_POINTER causes boot failure Christoph Lameter
2005-08-08 21:37 ` Manfred Spraul
2005-08-08 21:51   ` Andrew Morton
2005-08-08 21:53   ` Alexander Nyberg
2005-08-09 17:05     ` Manfred Spraul
2005-08-10  9:48       ` Jörn Engel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox