From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ralf Baechle <ralf@linux-mips.org>,
Wu Zhangjin <wuzhangjin@gmail.com>,
David Daney <ddaney@caviumnetworks.com>,
Li Hong <lihong.hi@gmail.com>,
Matt Fleming <matt@console-pimps.org>
Subject: [PATCH 6/7] tracing: Fix $mcount_regex for MIPS in recordmcount.pl
Date: Thu, 22 Jul 2010 16:24:17 -0400 [thread overview]
Message-ID: <20100722202453.556957214@goodmis.org> (raw)
In-Reply-To: 20100722202411.920807480@goodmis.org
[-- Attachment #1: 0006-tracing-Fix-mcount_regex-for-MIPS-in-recordmcount.pl.patch --]
[-- Type: text/plain, Size: 1969 bytes --]
From: David Daney <ddaney@caviumnetworks.com>
I found this issue in a locally patched 2.6.32.x, current kernels have
moved the offending code to an __init function which is skipped by
recordmcount.pl, so the bug is not currently being exercised.
However, I think the patch is still a good idea, to avoid future
problems if _mcount were to ever have its address taken in normal
code.
This is what I originally saw:
Although arch/mips/kernel/ftrace.c is built without -pg, and thus
contains no calls to _mcount, it does use the address of _mcount
in ftrace_make_nop(). This was causing relocations to be emitted
for _mcount which recordmcount.pl erronously took to be _mcount
call sites. The result was that the text of ftrace_make_nop()
would be patched with garbage leading to a system crash.
In non-module code, all _mcount call sites will have R_MIPS_26
relocations, so we restrict $mcount_regex to only match on these.
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Wu Zhangjin <wuzhangjin@gmail.com>
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
LKML-Reference: <1278712325-12050-1-git-send-email-ddaney@caviumnetworks.com>
Cc: Li Hong <lihong.hi@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
scripts/recordmcount.pl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index f3c9c0a..0171060 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -326,7 +326,7 @@ if ($arch eq "x86_64") {
# 14: R_MIPS_NONE *ABS*
# 18: 00020021 nop
if ($is_module eq "0") {
- $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$";
+ $mcount_regex = "^\\s*([0-9a-fA-F]+): R_MIPS_26\\s+_mcount\$";
} else {
$mcount_regex = "^\\s*([0-9a-fA-F]+): R_MIPS_HI16\\s+_mcount\$";
}
--
1.7.1
next prev parent reply other threads:[~2010-07-22 20:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-22 20:24 [PATCH 0/7] [GIT PULL] tracing: updates Steven Rostedt
2010-07-22 20:24 ` [PATCH 1/7] tracing: Allow to disable cmdline recording Steven Rostedt
2010-07-22 20:24 ` [PATCH 2/7] trace: Reorder struct ring_buffer_per_cpu to remove padding on 64bit Steven Rostedt
2010-07-22 20:24 ` [PATCH 3/7] tracing: Reduce latency and remove percpu trace_seq Steven Rostedt
2010-07-22 20:24 ` [PATCH 4/7] tracing: Shrink max latency ringbuffer if unnecessary Steven Rostedt
2010-07-22 20:24 ` [PATCH 5/7] tracing/documentation: Document dynamic ftracer internals Steven Rostedt
2010-07-22 20:24 ` Steven Rostedt [this message]
2010-07-22 20:24 ` [PATCH 7/7] trace: strlen() return doesnt account for the NULL Steven Rostedt
2010-07-23 7:12 ` [PATCH 0/7] [GIT PULL] tracing: updates 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=20100722202453.556957214@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=ddaney@caviumnetworks.com \
--cc=fweisbec@gmail.com \
--cc=lihong.hi@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@console-pimps.org \
--cc=mingo@elte.hu \
--cc=ralf@linux-mips.org \
--cc=wuzhangjin@gmail.com \
/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