All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: kprobes: fix swapped segment registers in kretprobe
@ 2010-07-18 22:11 Roland McGrath
  2010-07-18 22:31 ` Linus Torvalds
  2010-07-20  4:53 ` Masami Hiramatsu
  0 siblings, 2 replies; 3+ messages in thread
From: Roland McGrath @ 2010-07-18 22:11 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: Masami Hiramatsu, Linus Torvalds, Andrew Morton, x86,
	linux-kernel

The following changes since commit bea9a6d239cb2aa2ced4dcb0a05e1827ce61fa3d:

  Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2 (2010-07-18 10:09:25 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/frob/linux-2.6-roland.git x86/kprobes

Roland McGrath (1):
      x86: kprobes: fix swapped segment registers in kretprobe

 arch/x86/kernel/kprobes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Thanks,
Roland
---
[PATCH] x86: kprobes: fix swapped segment registers in kretprobe

In commit f007ea26, the order of the %es and %ds segment registers
got accidentally swapped, so synthesized 'struct pt_regs' frames
have the two values inverted.  It's almost sure that these values
never matter, and that they also never differ.  But wrong is wrong.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 arch/x86/kernel/kprobes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index 345a4b1..675879b 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -640,8 +640,8 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
 	/* Skip cs, ip, orig_ax and gs. */	\
 	"	subl $16, %esp\n"	\
 	"	pushl %fs\n"		\
-	"	pushl %ds\n"		\
 	"	pushl %es\n"		\
+	"	pushl %ds\n"		\
 	"	pushl %eax\n"		\
 	"	pushl %ebp\n"		\
 	"	pushl %edi\n"		\

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

* Re: [PATCH] x86: kprobes: fix swapped segment registers in kretprobe
  2010-07-18 22:11 [PATCH] x86: kprobes: fix swapped segment registers in kretprobe Roland McGrath
@ 2010-07-18 22:31 ` Linus Torvalds
  2010-07-20  4:53 ` Masami Hiramatsu
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Torvalds @ 2010-07-18 22:31 UTC (permalink / raw)
  To: Roland McGrath
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Masami Hiramatsu,
	Andrew Morton, x86, linux-kernel

On Sun, Jul 18, 2010 at 3:11 PM, Roland McGrath <roland@redhat.com> wrote:
>
> [PATCH] x86: kprobes: fix swapped segment registers in kretprobe
>
> In commit f007ea26, the order of the %es and %ds segment registers
> got accidentally swapped, so synthesized 'struct pt_regs' frames
> have the two values inverted.  It's almost sure that these values
> never matter, and that they also never differ.  But wrong is wrong.

Heh, yes. ES and DS are almost guaranteed to be the same, or string
instructions act oddly. But I could imagine that some wine usage could
trigger this. Of course, you'd also have to have probes etc.

Regardless - pulled,

                  Linus

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

* Re: [PATCH] x86: kprobes: fix swapped segment registers in kretprobe
  2010-07-18 22:11 [PATCH] x86: kprobes: fix swapped segment registers in kretprobe Roland McGrath
  2010-07-18 22:31 ` Linus Torvalds
@ 2010-07-20  4:53 ` Masami Hiramatsu
  1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2010-07-20  4:53 UTC (permalink / raw)
  To: Roland McGrath
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Linus Torvalds,
	Andrew Morton, x86, linux-kernel

Roland McGrath wrote:
> The following changes since commit bea9a6d239cb2aa2ced4dcb0a05e1827ce61fa3d:
> 
>   Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2 (2010-07-18 10:09:25 -0700)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/frob/linux-2.6-roland.git x86/kprobes
> 
> Roland McGrath (1):
>       x86: kprobes: fix swapped segment registers in kretprobe
> 
>  arch/x86/kernel/kprobes.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> 
> Thanks,
> Roland
> ---
> [PATCH] x86: kprobes: fix swapped segment registers in kretprobe
> 
> In commit f007ea26, the order of the %es and %ds segment registers
> got accidentally swapped, so synthesized 'struct pt_regs' frames
> have the two values inverted.  It's almost sure that these values
> never matter, and that they also never differ.  But wrong is wrong.

Oops, thanks Roland for finding it.

Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>


> 
> Signed-off-by: Roland McGrath <roland@redhat.com>
> ---
>  arch/x86/kernel/kprobes.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
> index 345a4b1..675879b 100644
> --- a/arch/x86/kernel/kprobes.c
> +++ b/arch/x86/kernel/kprobes.c
> @@ -640,8 +640,8 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
>  	/* Skip cs, ip, orig_ax and gs. */	\
>  	"	subl $16, %esp\n"	\
>  	"	pushl %fs\n"		\
> -	"	pushl %ds\n"		\
>  	"	pushl %es\n"		\
> +	"	pushl %ds\n"		\
>  	"	pushl %eax\n"		\
>  	"	pushl %ebp\n"		\
>  	"	pushl %edi\n"		\
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


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

end of thread, other threads:[~2010-07-20  4:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-18 22:11 [PATCH] x86: kprobes: fix swapped segment registers in kretprobe Roland McGrath
2010-07-18 22:31 ` Linus Torvalds
2010-07-20  4:53 ` Masami Hiramatsu

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.