* [PATCH] x86/kprobes: Set up frame pointer in kprobe trampoline
@ 2017-10-03 13:51 Josh Poimboeuf
2017-10-03 15:37 ` Masami Hiramatsu
2017-10-03 17:42 ` [tip:x86/urgent] kprobes/x86: " tip-bot for Josh Poimboeuf
0 siblings, 2 replies; 3+ messages in thread
From: Josh Poimboeuf @ 2017-10-03 13:51 UTC (permalink / raw)
To: Ananth N Mavinakayanahalli, Anil S Keshavamurthy,
David S . Miller, Masami Hiramatsu
Cc: linux-kernel, x86, Richard Weinberger
Richard Weinberger saw an unwinder warning when running bcc's opensnoop:
WARNING: kernel stack frame pointer at ffff99ef4076bea0 in opensnoop:2008 has bad value 0000000000000008
unwind stack type:0 next_sp: (null) mask:0x2 graph_idx:0
...
ffff99ef4076be88: ffff99ef4076bea0 (0xffff99ef4076bea0)
ffff99ef4076be90: ffffffffac442721 (optimized_callback +0x81/0x90)
...
A lockdep stack trace was initiated from inside a kprobe handler, when
the unwinder noticed a bad frame pointer on the stack. The bad frame
pointer is related to the fact that the kprobe optprobe trampoline
doesn't save the frame pointer before calling into optimized_callback().
Reported-and-tested-by: Richard Weinberger <richard@sigma-star.at>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
arch/x86/kernel/kprobes/common.h | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/kprobes/common.h b/arch/x86/kernel/kprobes/common.h
index e2c2a1970869..595b56b37d27 100644
--- a/arch/x86/kernel/kprobes/common.h
+++ b/arch/x86/kernel/kprobes/common.h
@@ -3,6 +3,15 @@
/* Kprobes and Optprobes common header */
+#include <asm/asm.h>
+
+#ifdef CONFIG_FRAME_POINTER
+# define SAVE_RBP_STRING " push %" _ASM_BP "\n" \
+ " mov %" _ASM_SP ", %" _ASM_BP "\n"
+#else
+# define SAVE_RBP_STRING " push %" _ASM_BP "\n"
+#endif
+
#ifdef CONFIG_X86_64
#define SAVE_REGS_STRING \
/* Skip cs, ip, orig_ax. */ \
@@ -17,7 +26,7 @@
" pushq %r10\n" \
" pushq %r11\n" \
" pushq %rbx\n" \
- " pushq %rbp\n" \
+ SAVE_RBP_STRING \
" pushq %r12\n" \
" pushq %r13\n" \
" pushq %r14\n" \
@@ -48,7 +57,7 @@
" pushl %es\n" \
" pushl %ds\n" \
" pushl %eax\n" \
- " pushl %ebp\n" \
+ SAVE_RBP_STRING \
" pushl %edi\n" \
" pushl %esi\n" \
" pushl %edx\n" \
--
2.13.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/kprobes: Set up frame pointer in kprobe trampoline
2017-10-03 13:51 [PATCH] x86/kprobes: Set up frame pointer in kprobe trampoline Josh Poimboeuf
@ 2017-10-03 15:37 ` Masami Hiramatsu
2017-10-03 17:42 ` [tip:x86/urgent] kprobes/x86: " tip-bot for Josh Poimboeuf
1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2017-10-03 15:37 UTC (permalink / raw)
To: Josh Poimboeuf, Ingo Molnar
Cc: Ananth N Mavinakayanahalli, Anil S Keshavamurthy,
David S . Miller, linux-kernel, x86, Richard Weinberger
On Tue, 3 Oct 2017 08:51:43 -0500
Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> Richard Weinberger saw an unwinder warning when running bcc's opensnoop:
>
> WARNING: kernel stack frame pointer at ffff99ef4076bea0 in opensnoop:2008 has bad value 0000000000000008
> unwind stack type:0 next_sp: (null) mask:0x2 graph_idx:0
> ...
> ffff99ef4076be88: ffff99ef4076bea0 (0xffff99ef4076bea0)
> ffff99ef4076be90: ffffffffac442721 (optimized_callback +0x81/0x90)
> ...
>
> A lockdep stack trace was initiated from inside a kprobe handler, when
> the unwinder noticed a bad frame pointer on the stack. The bad frame
> pointer is related to the fact that the kprobe optprobe trampoline
> doesn't save the frame pointer before calling into optimized_callback().
OK, this looks good to me :)
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Thanks!
>
> Reported-and-tested-by: Richard Weinberger <richard@sigma-star.at>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
> arch/x86/kernel/kprobes/common.h | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/kprobes/common.h b/arch/x86/kernel/kprobes/common.h
> index e2c2a1970869..595b56b37d27 100644
> --- a/arch/x86/kernel/kprobes/common.h
> +++ b/arch/x86/kernel/kprobes/common.h
> @@ -3,6 +3,15 @@
>
> /* Kprobes and Optprobes common header */
>
> +#include <asm/asm.h>
> +
> +#ifdef CONFIG_FRAME_POINTER
> +# define SAVE_RBP_STRING " push %" _ASM_BP "\n" \
> + " mov %" _ASM_SP ", %" _ASM_BP "\n"
> +#else
> +# define SAVE_RBP_STRING " push %" _ASM_BP "\n"
> +#endif
> +
> #ifdef CONFIG_X86_64
> #define SAVE_REGS_STRING \
> /* Skip cs, ip, orig_ax. */ \
> @@ -17,7 +26,7 @@
> " pushq %r10\n" \
> " pushq %r11\n" \
> " pushq %rbx\n" \
> - " pushq %rbp\n" \
> + SAVE_RBP_STRING \
> " pushq %r12\n" \
> " pushq %r13\n" \
> " pushq %r14\n" \
> @@ -48,7 +57,7 @@
> " pushl %es\n" \
> " pushl %ds\n" \
> " pushl %eax\n" \
> - " pushl %ebp\n" \
> + SAVE_RBP_STRING \
> " pushl %edi\n" \
> " pushl %esi\n" \
> " pushl %edx\n" \
> --
> 2.13.6
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:x86/urgent] kprobes/x86: Set up frame pointer in kprobe trampoline
2017-10-03 13:51 [PATCH] x86/kprobes: Set up frame pointer in kprobe trampoline Josh Poimboeuf
2017-10-03 15:37 ` Masami Hiramatsu
@ 2017-10-03 17:42 ` tip-bot for Josh Poimboeuf
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2017-10-03 17:42 UTC (permalink / raw)
To: linux-tip-commits
Cc: jpoimboe, davem, torvalds, anil.s.keshavamurthy, mingo, mhiramat,
hpa, linux-kernel, tglx, ananth, richard, peterz
Commit-ID: ee213fc72fd67d0988525af501534f4cb924d1e9
Gitweb: https://git.kernel.org/tip/ee213fc72fd67d0988525af501534f4cb924d1e9
Author: Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Tue, 3 Oct 2017 08:51:43 -0500
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 3 Oct 2017 19:11:27 +0200
kprobes/x86: Set up frame pointer in kprobe trampoline
Richard Weinberger saw an unwinder warning when running bcc's opensnoop:
WARNING: kernel stack frame pointer at ffff99ef4076bea0 in opensnoop:2008 has bad value 0000000000000008
unwind stack type:0 next_sp: (null) mask:0x2 graph_idx:0
...
ffff99ef4076be88: ffff99ef4076bea0 (0xffff99ef4076bea0)
ffff99ef4076be90: ffffffffac442721 (optimized_callback +0x81/0x90)
...
A lockdep stack trace was initiated from inside a kprobe handler, when
the unwinder noticed a bad frame pointer on the stack. The bad frame
pointer is related to the fact that the kprobe optprobe trampoline
doesn't save the frame pointer before calling into optimized_callback().
Reported-and-tested-by: Richard Weinberger <richard@sigma-star.at>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: David S . Miller <davem@davemloft.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/7aef2f8ecd75c2f505ef9b80490412262cf4a44c.1507038547.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/kprobes/common.h | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/kprobes/common.h b/arch/x86/kernel/kprobes/common.h
index db2182d..3fc0f9a 100644
--- a/arch/x86/kernel/kprobes/common.h
+++ b/arch/x86/kernel/kprobes/common.h
@@ -3,6 +3,15 @@
/* Kprobes and Optprobes common header */
+#include <asm/asm.h>
+
+#ifdef CONFIG_FRAME_POINTER
+# define SAVE_RBP_STRING " push %" _ASM_BP "\n" \
+ " mov %" _ASM_SP ", %" _ASM_BP "\n"
+#else
+# define SAVE_RBP_STRING " push %" _ASM_BP "\n"
+#endif
+
#ifdef CONFIG_X86_64
#define SAVE_REGS_STRING \
/* Skip cs, ip, orig_ax. */ \
@@ -17,7 +26,7 @@
" pushq %r10\n" \
" pushq %r11\n" \
" pushq %rbx\n" \
- " pushq %rbp\n" \
+ SAVE_RBP_STRING \
" pushq %r12\n" \
" pushq %r13\n" \
" pushq %r14\n" \
@@ -48,7 +57,7 @@
" pushl %es\n" \
" pushl %ds\n" \
" pushl %eax\n" \
- " pushl %ebp\n" \
+ SAVE_RBP_STRING \
" pushl %edi\n" \
" pushl %esi\n" \
" pushl %edx\n" \
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-03 17:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 13:51 [PATCH] x86/kprobes: Set up frame pointer in kprobe trampoline Josh Poimboeuf
2017-10-03 15:37 ` Masami Hiramatsu
2017-10-03 17:42 ` [tip:x86/urgent] kprobes/x86: " tip-bot for Josh Poimboeuf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.