diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-10-12 11:32:31 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-10-12 11:53:51 -0700 |
commit | d1705c558c95418378b11a0be963fe1b3e2fa381 (patch) | |
tree | 8fef767c2d1fb4d113c81b5668869d1149b1547f /arch/x86/kernel | |
parent | 7a4b7e5e741fe0a72a517b0367a2659aa53f7c44 (diff) | |
download | linux-d1705c558c95418378b11a0be963fe1b3e2fa381.tar.gz linux-d1705c558c95418378b11a0be963fe1b3e2fa381.tar.bz2 linux-d1705c558c95418378b11a0be963fe1b3e2fa381.zip |
x86: fix kernel panic on 32 bits when profiling
Latest kernel has a kernel panic in booting on i386 machine when
profile=2 setting in cmdline. It is due to 'sp' being incorrect in
profile_pc().
BUG: unable to handle kernel NULL pointer dereference at 00000246
IP: [<c01288b6>] profile_pc+0x2a/0x48
*pde = 00000000
Oops: 0000 [#1] SMP
This differs from the original version by Alex Shi in that we use the
kernel_stack_pointer() inline already defined in <asm/ptrace.h> for
this purpose, instead of #ifdef.
Originally-by: Alex Shi <alex.shi@intel.com>
Cc: "Chen, Tim C" <tim.c.chen@intel.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/time.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c index dcb00d278512..be2573448ed9 100644 --- a/arch/x86/kernel/time.c +++ b/arch/x86/kernel/time.c @@ -38,7 +38,8 @@ unsigned long profile_pc(struct pt_regs *regs) #ifdef CONFIG_FRAME_POINTER return *(unsigned long *)(regs->bp + sizeof(long)); #else - unsigned long *sp = (unsigned long *)regs->sp; + unsigned long *sp = + (unsigned long *)kernel_stack_pointer(regs); /* * Return address is either directly at stack pointer * or above a saved flags. Eflags has bits 22-31 zero, |