[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150901114120.GN18673@twins.programming.kicks-ass.net>
Date: Tue, 1 Sep 2015 13:41:20 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Frederic Weisbecker <fweisbec@...il.com>
Cc: 平松雅巳 / HIRAMATU,MASAMI
<masami.hiramatsu.pt@...achi.com>,
Andy Lutomirski <luto@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Brian Gerst <brgerst@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
X86 ML <x86@...nel.org>
Subject: Re: [PATCH 1/3] x86/perf/hw_breakpoint: Disallow kernel breakpoints
unless kprobe-safe
On Tue, Sep 01, 2015 at 01:36:08PM +0200, Peter Zijlstra wrote:
> +static inline bool kprobe_blacklisted(unsigned long addr)
> +{
> + return false;
Ah, I think that wants to be true instead, to match the below comment.
> +}
> +
> static inline int kprobes_built_in(void)
> {
> return 0;
> diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
> index 92ce5f4ccc26..7c08e6d1175c 100644
> --- a/kernel/events/hw_breakpoint.c
> +++ b/kernel/events/hw_breakpoint.c
> @@ -384,6 +384,14 @@ static int validate_hw_breakpoint(struct perf_event *bp)
> */
> if (!capable(CAP_SYS_ADMIN))
> return -EPERM;
> +
> + /*
> + * We don't allow kernel breakpoints in places that are not
> + * acceptable for kprobes. On non-kprobes kernels, we don't
> + * allow kernel breakpoints at all.
> + */
> + if (kprobe_blacklisted(bp->attr.bp_addr))
> + return -EINVAL;
> }
>
> return 0;
--
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