Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1216789

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

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/3] x86/perf/hw_breakpoint: Disallow kernel breakpoints unless kprobe-safe
Date 2015-09-01 13:50 +0200
Message-ID <q3SeB-5tT-3@gated-at.bofh.it> (permalink)
References (1 earlier) <pS9kS-1Uh-9@gated-at.bofh.it> <pTMNd-6DQ-5@gated-at.bofh.it> <pTTOF-kw-17@gated-at.bofh.it> <q3Rsd-4kv-7@gated-at.bofh.it> <q3S4W-5ix-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 1/3] x86/perf/hw_breakpoint: Disallow kernel breakpoints  unless kprobe-safe Frederic Weisbecker <fweisbec@gmail.com> - 2015-09-01 13:00 +0200
  Re: [PATCH 1/3] x86/perf/hw_breakpoint: Disallow kernel breakpoints  unless kprobe-safe Peter Zijlstra <peterz@infradead.org> - 2015-09-01 13:40 +0200
    Re: [PATCH 1/3] x86/perf/hw_breakpoint: Disallow kernel breakpoints  unless kprobe-safe Peter Zijlstra <peterz@infradead.org> - 2015-09-01 13:50 +0200

csiph-web