Re: [PATCH 1/3] x86/perf/hw_breakpoint: Disallow kernel breakpoints unless kprobe-safe

From: Peter Zijlstra
Date: Tue Sep 01 2015 - 07:41:31 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/