Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: jpoimboe at redhat.com (Josh Poimboeuf)
Subject: [PATCH 2/4] x86/kprobes: Fix frame pointer annotations
Date: Wed, 8 May 2019 06:54:16 -0500	[thread overview]
Message-ID: <20190508115416.nblx7c2kocidpytm@treble> (raw)
In-Reply-To: <20190508080612.721269814@infradead.org>

On Wed, May 08, 2019 at 09:49:03AM +0200, Peter Zijlstra wrote:
> The kprobe trampolines have a FRAME_POINTER annotation that makes no
> sense. It marks the frame in the middle of pt_regs, at the place of
> saving BP.
> 
> Change it to mark the pt_regs frame as per the ENCODE_FRAME_POINTER
> from the respective entry_*.S.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz at infradead.org>
> ---
>  arch/x86/kernel/kprobes/common.h |   32 +++++++++++++++++++++++---------
>  1 file changed, 23 insertions(+), 9 deletions(-)
> 
> --- a/arch/x86/kernel/kprobes/common.h
> +++ b/arch/x86/kernel/kprobes/common.h
> @@ -6,14 +6,15 @@
>  
>  #include <asm/asm.h>
>  
> +#ifdef CONFIG_X86_64
> +
>  #ifdef CONFIG_FRAME_POINTER
> -# define SAVE_RBP_STRING "	push %" _ASM_BP "\n" \
> -			 "	mov  %" _ASM_SP ", %" _ASM_BP "\n"
> +#define ENCODE_FRAME_POINTER			\
> +	"	leaq 1(%rsp), %rbp\n"
>  #else
> -# define SAVE_RBP_STRING "	push %" _ASM_BP "\n"
> +#define ENCODE_FRAME_POINTER
>  #endif

> +#ifdef CONFIG_FRAME_POINTER
> +#define ENCODE_FRAME_POINTER			\
> +	"	movl %esp, %ebp\n"		\
> +	"	andl $0x7fffffff, %ebp\n"
> +#else
> +#define ENCODE_FRAME_POINTER
> +#endif

We should put these macros in a header file somewhere (including
stringified versions).

-- 
Josh

WARNING: multiple messages have this Message-ID (diff)
From: jpoimboe@redhat.com (Josh Poimboeuf)
Subject: [PATCH 2/4] x86/kprobes: Fix frame pointer annotations
Date: Wed, 8 May 2019 06:54:16 -0500	[thread overview]
Message-ID: <20190508115416.nblx7c2kocidpytm@treble> (raw)
Message-ID: <20190508115416.8XNBY4QV8TP9Y6A60mnYt5pFzuowfddgEts9hEh8IoY@z> (raw)
In-Reply-To: <20190508080612.721269814@infradead.org>

On Wed, May 08, 2019@09:49:03AM +0200, Peter Zijlstra wrote:
> The kprobe trampolines have a FRAME_POINTER annotation that makes no
> sense. It marks the frame in the middle of pt_regs, at the place of
> saving BP.
> 
> Change it to mark the pt_regs frame as per the ENCODE_FRAME_POINTER
> from the respective entry_*.S.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz at infradead.org>
> ---
>  arch/x86/kernel/kprobes/common.h |   32 +++++++++++++++++++++++---------
>  1 file changed, 23 insertions(+), 9 deletions(-)
> 
> --- a/arch/x86/kernel/kprobes/common.h
> +++ b/arch/x86/kernel/kprobes/common.h
> @@ -6,14 +6,15 @@
>  
>  #include <asm/asm.h>
>  
> +#ifdef CONFIG_X86_64
> +
>  #ifdef CONFIG_FRAME_POINTER
> -# define SAVE_RBP_STRING "	push %" _ASM_BP "\n" \
> -			 "	mov  %" _ASM_SP ", %" _ASM_BP "\n"
> +#define ENCODE_FRAME_POINTER			\
> +	"	leaq 1(%rsp), %rbp\n"
>  #else
> -# define SAVE_RBP_STRING "	push %" _ASM_BP "\n"
> +#define ENCODE_FRAME_POINTER
>  #endif

> +#ifdef CONFIG_FRAME_POINTER
> +#define ENCODE_FRAME_POINTER			\
> +	"	movl %esp, %ebp\n"		\
> +	"	andl $0x7fffffff, %ebp\n"
> +#else
> +#define ENCODE_FRAME_POINTER
> +#endif

We should put these macros in a header file somewhere (including
stringified versions).

-- 
Josh

  parent reply	other threads:[~2019-05-08 11:54 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08  7:49 [PATCH 0/4] x86: int3 fallout peterz
2019-05-08  7:49 ` Peter Zijlstra
2019-05-08  7:49 ` [PATCH 1/4] x86/entry/32: Clean up return from interrupt preemption path peterz
2019-05-08  7:49   ` Peter Zijlstra
2019-05-08  7:49 ` [PATCH 2/4] x86/kprobes: Fix frame pointer annotations peterz
2019-05-08  7:49   ` Peter Zijlstra
2019-05-08 11:54   ` jpoimboe [this message]
2019-05-08 11:54     ` Josh Poimboeuf
2019-05-08 12:04     ` peterz
2019-05-08 12:04       ` Peter Zijlstra
     [not found]       ` <20190508124248.u5ukpbhnh4wpiccq@treble>
     [not found]         ` <20190508153907.GM2589@hirez.programming.kicks-ass.net>
2019-05-08 18:48           ` jpoimboe
2019-05-08 18:48             ` Josh Poimboeuf
2019-05-09  1:20             ` mhiramat
2019-05-09  1:20               ` Masami Hiramatsu
2019-05-09  8:14               ` peterz
2019-05-09  8:14                 ` Peter Zijlstra
2019-05-09  9:27                 ` peterz
2019-05-09  9:27                   ` Peter Zijlstra
2019-05-09 14:00                 ` jpoimboe
2019-05-09 14:00                   ` Josh Poimboeuf
2019-05-09 14:01                 ` mhiramat
2019-05-09 14:01                   ` Masami Hiramatsu
2019-05-09 17:14                   ` peterz
2019-05-09 17:14                     ` Peter Zijlstra
2019-05-10  4:58                     ` mhiramat
2019-05-10  4:58                       ` Masami Hiramatsu
2019-05-10 12:31                       ` peterz
2019-05-10 12:31                         ` Peter Zijlstra
2019-05-11  0:52                         ` mhiramat
2019-05-11  0:52                           ` Masami Hiramatsu
2019-05-10 12:40                       ` peterz
2019-05-10 12:40                         ` Peter Zijlstra
2019-05-11  0:56                         ` mhiramat
2019-05-11  0:56                           ` Masami Hiramatsu
2019-05-13  8:15                           ` peterz
2019-05-13  8:15                             ` Peter Zijlstra
2019-05-09 16:20                 ` luto
2019-05-09 16:20                   ` Andy Lutomirski
2019-05-09 17:18                   ` peterz
2019-05-09 17:18                     ` Peter Zijlstra
2019-05-09 17:43                   ` rostedt
2019-05-09 17:43                     ` Steven Rostedt
2019-05-10  3:21                     ` mhiramat
2019-05-10  3:21                       ` Masami Hiramatsu
2019-05-10 12:14                       ` peterz
2019-05-10 12:14                         ` Peter Zijlstra
2019-05-10 12:17                       ` peterz
2019-05-10 12:17                         ` Peter Zijlstra
2019-05-10 14:54                         ` rostedt
2019-05-10 14:54                           ` Steven Rostedt
2019-05-09 17:37                 ` rostedt
2019-05-09 17:37                   ` Steven Rostedt
2019-05-09 18:26                   ` peterz
2019-05-09 18:26                     ` Peter Zijlstra
2019-05-09 18:36                     ` rostedt
2019-05-09 18:36                       ` Steven Rostedt
2019-05-08  7:49 ` [PATCH 3/4] x86/ftrace: Add pt_regs frame annotations peterz
2019-05-08  7:49   ` Peter Zijlstra
2019-05-08  7:49 ` [RFC][PATCH 4/4] x86_32: Provide consistent pt_regs peterz
2019-05-08  7:49   ` Peter Zijlstra
2019-05-08 11:57   ` jpoimboe
2019-05-08 11:57     ` Josh Poimboeuf
2019-05-08 20:58   ` torvalds
2019-05-08 20:58     ` Linus Torvalds

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=20190508115416.nblx7c2kocidpytm@treble \
    --to=linux-kselftest@vger.kernel.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