[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150220101925.GB25076@gmail.com>
Date: Fri, 20 Feb 2015 11:19:25 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Petr Mladek <pmladek@...e.cz>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
"David S. Miller" <davem@...emloft.net>,
Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
Ananth NMavinakayanahalli <ananth@...ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Jiri Kosina <jkosina@...e.cz>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] kprobes/x86: Check for invalid ftrace location in
__recover_probed_insn()
* Petr Mladek <pmladek@...e.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@...achi.com>
> Signed-off-by: Petr Mladek <pmladek@...e.cz>
> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@...achi.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists