From: Ingo Molnar <mingo@kernel.org>
To: Petr Mladek <pmladek@suse.cz>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
"David S. Miller" <davem@davemloft.net>,
Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
Ananth NMavinakayanahalli <ananth@in.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Jiri Kosina <jkosina@suse.cz>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] kprobes/x86: Check for invalid ftrace location in __recover_probed_insn()
Date: Fri, 20 Feb 2015 11:19:25 +0100 [thread overview]
Message-ID: <20150220101925.GB25076@gmail.com> (raw)
In-Reply-To: <1424427402-11795-3-git-send-email-pmladek@suse.cz>
* Petr Mladek <pmladek@suse.cz> wrote:
> __recover_probed_insn() should always be called from an address where
> an instructions starts. The check for ftrace_location() might help to
> discover a potential inconsistency. Something goes terribly wrong when
> an address inside the ftrace location is checked. Let's BUG() in this case.
>
> Suggested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Signed-off-by: Petr Mladek <pmladek@suse.cz>
> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> ---
> arch/x86/kernel/kprobes/core.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
> index 2f464b56766a..124577dcf768 100644
> --- a/arch/x86/kernel/kprobes/core.c
> +++ b/arch/x86/kernel/kprobes/core.c
> @@ -228,6 +228,12 @@ __recover_probed_insn(kprobe_opcode_t *buf, unsigned long addr)
> kp = get_kprobe((void *)addr);
> faddr = ftrace_location(addr);
> /*
> + * Addresses inside the ftrace location are refused by
> + * arch_check_ftrace_location(). Something went terribly wrong
> + * if such an address is checked here.
> + */
> + BUG_ON(faddr && faddr != addr);
Crashing the system with a BUG_ON() makes users very sad.
Please use a construct like:
if (WARN_ON(faddr && faddr != addr))
return gently;
I've picked up your first patch.
Thanks,
Ingo
prev parent reply other threads:[~2015-02-20 10:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-02 17:48 [PATCH v2] kprobes/x86: Use 5-byte NOP when the code might be modified by ftrace Petr Mladek
2015-02-03 7:41 ` Masami Hiramatsu
2015-02-03 11:38 ` Petr Mladek
2015-02-03 11:52 ` Masami Hiramatsu
2015-02-03 12:00 ` Petr Mladek
2015-02-18 21:22 ` Ingo Molnar
2015-02-20 10:16 ` Petr Mladek
2015-02-20 10:16 ` [PATCH 1/2] " Petr Mladek
2015-02-20 10:26 ` Ingo Molnar
2015-02-20 12:38 ` Masami Hiramatsu
2015-02-20 12:52 ` Ingo Molnar
2015-02-20 13:25 ` Masami Hiramatsu
2015-02-20 13:34 ` Petr Mladek
2015-02-20 10:16 ` [PATCH 2/2] kprobes/x86: Check for invalid ftrace location in __recover_probed_insn() Petr Mladek
2015-02-20 10:19 ` Ingo Molnar [this message]
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=20150220101925.GB25076@gmail.com \
--to=mingo@kernel.org \
--cc=ananth@in.ibm.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=davem@davemloft.net \
--cc=fweisbec@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=pmladek@suse.cz \
--cc=rostedt@goodmis.org \
/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