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>,
Peter Zijlstra <peterz@infradead.org>,
David Miller <davem@davemloft.net>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Pekka Paalanen <pq@iki.fi>,
linuxppc-dev@ozlabs.org, Rusty Russell <rusty@rustcorp.com.au>,
Paul Mackerras <paulus@samba.org>,
Paul Mundt <lethal@linux-sh.org>,
Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 3/4] ftrace,ppc: fix module check in dynamic ftrace code
Date: Mon, 17 Nov 2008 14:09:51 -0500 [thread overview]
Message-ID: <20081117191059.610706327@goodmis.org> (raw)
In-Reply-To: 20081117190948.619751203@goodmis.org
[-- Attachment #1: 0003-ftrace-ppc-fix-module-check-in-dynamic-ftrace-code.patch --]
[-- Type: text/plain, Size: 1583 bytes --]
Impact: fix to module check in making nops in dynamic ftrace for PPC
Paul Mackerras pointed out that the mod test in ftrace_make_nop looks
wrong. It is, but it did not trigger because the logic to ftrace just
happens to miss the bad case.
When ftrace first changes all the calls to mcount into nops, it passes
in the "mod" parameter, and the rec->arch.mod is NULL. This case assigns
the rec->arch.mod to mod and succeeds. From then on, ftrace will pass
in a NULL for mod and the check if mod and rec->arch.mod is the same
is skipped.
The failure of the current test may produce a false positive failuer,
which will cause ftrace to shutdown even if the code was correct. This
patch fixes the test.
Reported-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
arch/powerpc/kernel/ftrace.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 918a5d2..81e338c 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -354,10 +354,13 @@ int ftrace_make_nop(struct module *mod,
}
rec->arch.mod = mod;
} else if (mod) {
- printk(KERN_ERR
- "Record mod %p not equal to passed in mod %p\n",
- rec->arch.mod, mod);
- return -EINVAL;
+ if (mod != rec->arch.mod) {
+ printk(KERN_ERR
+ "Record mod %p not equal to passed in mod %p\n",
+ rec->arch.mod, mod);
+ return -EINVAL;
+ }
+ /* nothing to do if mod == rec->arch.mod */
} else
mod = rec->arch.mod;
--
1.5.6.5
--
next prev parent reply other threads:[~2008-11-17 19:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-17 19:09 [PATCH 0/4] ftrace: PPC port of dynamic ftrace fixes Steven Rostedt
2008-11-17 19:09 ` [PATCH 1/4] ftrace,ppc: consolidate dyn ftrace ppc code between 32 and 64 bit Steven Rostedt
2008-11-17 19:09 ` [PATCH 2/4] ftrace,ppc: fix test of 24bit jump Steven Rostedt
2008-11-17 19:09 ` Steven Rostedt [this message]
2008-11-17 19:09 ` [PATCH 4/4] ftrace,ppc: fix test of branch link Steven Rostedt
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=20081117191059.610706327@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=linuxppc-dev@ozlabs.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=pq@iki.fi \
--cc=rusty@rustcorp.com.au \
--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