public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	David Miller <davem@davemloft.net>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	Paul Mundt <lethal@linux-sh.org>,
	Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 3/5] ftrace: allow NULL pointers in mcount_loc
Date: Sat, 15 Nov 2008 16:47:08 -0500	[thread overview]
Message-ID: <20081115214758.332811011@goodmis.org> (raw)
In-Reply-To: 20081115214705.363808961@goodmis.org

[-- Attachment #1: 0003-ftrace-allow-NULL-pointers-in-mcount_loc.patch --]
[-- Type: text/plain, Size: 1146 bytes --]

Impact: let archs insert NULL pointers in mcount_loc section

Due to the way different architecture linkers combine the data sections
of the mcount_loc (the section that lists all the locations that
call mcount), there may be zeros added in that section. This is usually
due to strange alignments that the linker performs, that pads in zeros.

This patch makes the conversion code to nops skip any pointer in
the mcount_loc section that is NULL.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 kernel/trace/ftrace.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 6adad23..2384a9c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1305,6 +1305,14 @@ static int ftrace_convert_nops(struct module *mod,
 	p = start;
 	while (p < end) {
 		addr = ftrace_call_adjust(*p++);
+		/*
+		 * Some architecture linkers will pad between
+		 * the different mcount_loc sections of different
+		 * object files to satisfy alignments.
+		 * Skip any NULL pointers.
+		 */
+		if (!addr)
+			continue;
 		ftrace_record_ip(addr);
 	}
 
-- 
1.5.6.5

-- 

  parent reply	other threads:[~2008-11-15 21:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-15 21:47 [PATCH 0/5] ftrace updates for tip, and ground work for other architectures Steven Rostedt
2008-11-15 21:47 ` [PATCH 1/5] ftrace: replace raw_local_irq_save with local_irq_save Steven Rostedt
2008-11-15 21:47 ` [PATCH 2/5] ftrace: pass module struct to arch dynamic ftrace functions Steven Rostedt
2008-11-15 21:47 ` Steven Rostedt [this message]
2008-11-15 21:47 ` [PATCH 4/5] ftrace: fix dyn ftrace filter Steven Rostedt
2008-11-15 21:47 ` [PATCH 5/5] ftrace: make filtered functions effective on setting Steven Rostedt
2008-11-16  6:39 ` [PATCH 0/5] ftrace updates for tip, and ground work for other architectures 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=20081115214758.332811011@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=srostedt@redhat.com \
    --cc=tglx@linutronix.de \
    /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