On Mon, 2015-01-05 at 12:49 -0800, [email protected] wrote:
> The patch below does not apply to the 3.10-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <[email protected]>.

I've attached what I think is a sensible backport.

Ben.

> thanks,
> 
> greg k-h
> 
> ------------------ original commit in Linus's tree ------------------
> 
> From 7ddc6a2199f1da405a2fb68c40db8899b1a8cd87 Mon Sep 17 00:00:00 2001
> From: Andy Lutomirski <[email protected]>
> Date: Mon, 24 Nov 2014 17:39:06 -0800
> Subject: [PATCH] x86/asm/traps: Disable tracing and kprobes in fixup_bad_iret
>  and sync_regs
> 
> These functions can be executed on the int3 stack, so kprobes
> are dangerous. Tracing is probably a bad idea, too.
> 
> Fixes: b645af2d5905 ("x86_64, traps: Rework bad_iret")
> Signed-off-by: Andy Lutomirski <[email protected]>
> Cc: <[email protected]> # Backport as far back as it would apply
> Cc: Linus Torvalds <[email protected]>
> Cc: Steven Rostedt <[email protected]>
> Link: 
> http://lkml.kernel.org/r/50e33d26adca60816f3ba968875801652507d0c4.1416870125.git.l...@amacapital.net
> Signed-off-by: Ingo Molnar <[email protected]>
> 
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index de801f22128a..07ab8e9733c5 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -387,7 +387,7 @@ NOKPROBE_SYMBOL(do_int3);
>   * for scheduling or signal handling. The actual stack switch is done in
>   * entry.S
>   */
> -asmlinkage __visible struct pt_regs *sync_regs(struct pt_regs *eregs)
> +asmlinkage __visible notrace struct pt_regs *sync_regs(struct pt_regs *eregs)
>  {
>       struct pt_regs *regs = eregs;
>       /* Did already sync */
> @@ -413,7 +413,7 @@ struct bad_iret_stack {
>       struct pt_regs regs;
>  };
>  
> -asmlinkage __visible
> +asmlinkage __visible notrace
>  struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
>  {
>       /*
> @@ -436,6 +436,7 @@ struct bad_iret_stack *fixup_bad_iret(struct 
> bad_iret_stack *s)
>       BUG_ON(!user_mode_vm(&new_stack->regs));
>       return new_stack;
>  }
> +NOKPROBE_SYMBOL(fixup_bad_iret);
>  #endif
>  
>  /*

-- 
Ben Hutchings
The world is coming to an end.  Please log off.
From 0b740af1a1697796b5a9a0b024b22b7e97e9bfd2 Mon Sep 17 00:00:00 2001
From: Andy Lutomirski <[email protected]>
Date: Mon, 24 Nov 2014 17:39:06 -0800
Subject: [PATCH] x86/asm/traps: Disable tracing and kprobes in fixup_bad_iret
 and sync_regs

commit 7ddc6a2199f1da405a2fb68c40db8899b1a8cd87 upstream.

These functions can be executed on the int3 stack, so kprobes
are dangerous. Tracing is probably a bad idea, too.

Fixes: b645af2d5905 ("x86_64, traps: Rework bad_iret")
Signed-off-by: Andy Lutomirski <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Steven Rostedt <[email protected]>
Link: http://lkml.kernel.org/r/50e33d26adca60816f3ba968875801652507d0c4.1416870125.git.l...@amacapital.net
Signed-off-by: Ingo Molnar <[email protected]>
[bwh: Backported to 3.10:
 - Use __kprobes instead of NOKPROBE_SYMBOL()
 - Adjust context]
Signed-off-by: Ben Hutchings <[email protected]>
---
 arch/x86/kernel/traps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 332cafe..0010ed7 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -362,7 +362,7 @@ exit:
  * for scheduling or signal handling. The actual stack switch is done in
  * entry.S
  */
-asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
+asmlinkage notrace __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
 {
 	struct pt_regs *regs = eregs;
 	/* Did already sync */
@@ -387,7 +387,7 @@ struct bad_iret_stack {
 	struct pt_regs regs;
 };
 
-asmlinkage __visible
+asmlinkage __visible notrace __kprobes
 struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
 {
 	/*

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to