mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -tip] ftrace: Correctly calculate the first function in the .text section
@ 2009-07-23  9:51 Matt Fleming
  2009-07-23 14:50 ` Steven Rostedt
  0 siblings, 1 reply; 13+ messages in thread
From: Matt Fleming @ 2009-07-23  9:51 UTC (permalink / raw)
  To: Ingo Molnar, Steven Rostedt; +Cc: linux-kernel

This patch fixes a bug whereby recordmcount.pl didn't stop searching
once it had correctly detected the function at the beginning of the
.text section. To stop it searching, I needed to reset $read_function.
The effect of this bug was that some entries in __mcount_loc section
were created with the negative reloc addends. The last text section
found was used as the base and all mcount calls were at a relative
offset to that, so at final link time the addresses were fixed up to
point to somewhere completely bogus.

This all resulted in ftrace dynamically modifying addresses that weren't
actually mcount callsites.

I also noticed another bug and fixed up the condition from,

	if (!defined($ref_func) || !defined($weak{$text})) {
to
	if (!defined($ref_func) && !defined($weak{$text})) {

This now matches the comment above the conditional.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
---
 scripts/recordmcount.pl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 7109e2b..356ff6a 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -414,8 +414,9 @@ while (<IN>) {
 	    $read_function = 0;
 	} else {
 	    # if we already have a function, and this is weak, skip it
-	    if (!defined($ref_func) || !defined($weak{$text})) {
+	    if (!defined($ref_func) && !defined($weak{$text})) {
 		$ref_func = $text;
+		$read_function = 0;
 	    }
 	}
     } elsif ($read_headers && /$mcount_section/) {
-- 
1.6.4.rc0


^ permalink raw reply	[flat|nested] 13+ messages in thread
* [PATCH 0/2] Resend of ftrace recordmcount.pl fixes
@ 2009-08-04  6:06 Matt Fleming
  2009-08-04  6:06 ` [PATCH 1/2] ftrace: Fix the conditional that updates $ref_func Matt Fleming
  0 siblings, 1 reply; 13+ messages in thread
From: Matt Fleming @ 2009-08-04  6:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steven Rostedt, Paul Mundt, Ingo Molnar, Thomas Gelixner

I'm resending these two patches as they seem to be stalled.

Matt Fleming (2):
  ftrace: Fix the conditional that updates $ref_func
  ftrace: Only update $offset when we update $ref_func

 scripts/recordmcount.pl |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


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

end of thread, other threads:[~2009-08-04  8:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-23  9:51 [PATCH -tip] ftrace: Correctly calculate the first function in the .text section Matt Fleming
2009-07-23 14:50 ` Steven Rostedt
2009-07-23 14:52   ` Steven Rostedt
2009-07-27 22:29     ` Paul Mundt
2009-07-27 23:45       ` Steven Rostedt
2009-08-02  8:16         ` Paul Mundt
2009-08-04  8:07           ` Ingo Molnar
2009-08-04  8:08             ` Paul Mundt
2009-07-23 16:16   ` [PATCH 1/2] ftrace: Fix the conditional that updates $ref_func Matt Fleming
2009-07-23 16:16     ` [PATCH 2/2] ftrace: Only update $offset when we update $ref_func Matt Fleming
2009-08-04  8:10       ` [tip:tracing/urgent] " tip-bot for Matt Fleming
2009-08-04  8:10     ` [tip:tracing/urgent] ftrace: Fix the conditional that updates $ref_func tip-bot for Matt Fleming
2009-08-04  6:06 [PATCH 0/2] Resend of ftrace recordmcount.pl fixes Matt Fleming
2009-08-04  6:06 ` [PATCH 1/2] ftrace: Fix the conditional that updates $ref_func Matt Fleming
2009-08-04  6:06   ` [PATCH 2/2] ftrace: Only update $offset when we update $ref_func Matt Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®