All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: "Ingo Molnar" <mingo@elte.hu>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>
Subject: git pull request for tip/tracing/urgent
Date: Tue, 10 Feb 2009 13:19:31 -0500 (EST)	[thread overview]
Message-ID: <alpine.DEB.1.10.0902101314440.23505@gandalf.stny.rr.com> (raw)


Ingo,

The bug that is fixed by this change can affect users. Most likely it will 
not, since the fault should never happen. But this is a protective 
mechanism, where if it does, that means there is a bug in the tracer.

As you have previously told me, a bug in the tracer should never crash the 
kernel. Since the detection of a fault in the function graph tracer can 
lead to a kernel crash (without this change) I think this qualifies as 
something for 29.

-- Steve


The following patch is in:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git

    branch: tip/tracing/urgent


Steven Rostedt (1):
      tracing, x86: fix fixup section to return to original code

----
 arch/x86/kernel/ftrace.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---------------------------
commit e3944bfac961cd7fc82f3b3143c55dc375748569
Author: Steven Rostedt <srostedt@redhat.com>
Date:   Tue Feb 10 13:07:13 2009 -0500

    tracing, x86: fix fixup section to return to original code
    
    Impact: fix to prevent a kernel crash on fault
    
    If for some reason the pointer to the parent function on the
    stack takes a fault, the fix up code will not return back to
    the original faulting code. This can lead to unpredictable
    results and perhaps even a kernel panic.
    
    A fault should not happen, but if it does, we should simply
    disable the tracer, warn, and continue running the kernel.
    It should not lead to a kernel crash.
    
    Signed-off-by: Steven Rostedt <srostedt@redhat.com>

diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 1b43086..9d549e4 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -491,13 +491,15 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 		"1: " _ASM_MOV " (%[parent_old]), %[old]\n"
 		"2: " _ASM_MOV " %[return_hooker], (%[parent_replaced])\n"
 		"   movl $0, %[faulted]\n"
+		"3:\n"
 
 		".section .fixup, \"ax\"\n"
-		"3: movl $1, %[faulted]\n"
+		"4: movl $1, %[faulted]\n"
+		"   jmp 3b\n"
 		".previous\n"
 
-		_ASM_EXTABLE(1b, 3b)
-		_ASM_EXTABLE(2b, 3b)
+		_ASM_EXTABLE(1b, 4b)
+		_ASM_EXTABLE(2b, 4b)
 
 		: [parent_replaced] "=r" (parent), [old] "=r" (old),
 		  [faulted] "=r" (faulted)


             reply	other threads:[~2009-02-10 18:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-10 18:19 Steven Rostedt [this message]
2009-02-10 18:30 ` git pull request for tip/tracing/urgent Frederic Weisbecker
2009-02-10 23:00   ` Steven Rostedt
2009-02-11  1:28     ` Frederic Weisbecker
2009-02-11  9:02       ` Ingo Molnar
2009-02-11  9:16         ` Tejun Heo
2009-02-11  9:53           ` Ingo Molnar
2009-02-12  1:24             ` H. Peter Anvin
2009-02-11 13:40         ` Frederic Weisbecker
2009-02-11  8:49 ` Ingo Molnar

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=alpine.DEB.1.10.0902101314440.23505@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 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.