aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/bpf_trace.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-06-30 05:03:36 -0400
committerDavid S. Miller <davem@davemloft.net>2016-06-30 05:03:36 -0400
commitee58b57100ca953da7320c285315a95db2f7053d (patch)
tree77b815a31240adc4d6326346908137fc6c2c3a96 /kernel/trace/bpf_trace.c
parent6f30e8b022c8e3a722928ddb1a2ae0be852fcc0e (diff)
parente7bdea7750eb2a64aea4a08fa5c0a31719c8155d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Several cases of overlapping changes, except the packet scheduler conflicts which deal with the addition of the free list parameter to qdisc_enqueue(). Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/trace/bpf_trace.c')
-rw-r--r--kernel/trace/bpf_trace.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 037ea6ea3cb2..3de25fbed785 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -208,6 +208,10 @@ static u64 bpf_perf_event_read(u64 r1, u64 index, u64 r3, u64 r4, u64 r5)
208 event->pmu->count) 208 event->pmu->count)
209 return -EINVAL; 209 return -EINVAL;
210 210
211 if (unlikely(event->attr.type != PERF_TYPE_HARDWARE &&
212 event->attr.type != PERF_TYPE_RAW))
213 return -EINVAL;
214
211 /* 215 /*
212 * we don't know if the function is run successfully by the 216 * we don't know if the function is run successfully by the
213 * return value. It can be judged in other places, such as 217 * return value. It can be judged in other places, such as
@@ -347,7 +351,8 @@ static const struct bpf_func_proto *kprobe_prog_func_proto(enum bpf_func_id func
347} 351}
348 352
349/* bpf+kprobe programs can access fields of 'struct pt_regs' */ 353/* bpf+kprobe programs can access fields of 'struct pt_regs' */
350static bool kprobe_prog_is_valid_access(int off, int size, enum bpf_access_type type) 354static bool kprobe_prog_is_valid_access(int off, int size, enum bpf_access_type type,
355 enum bpf_reg_type *reg_type)
351{ 356{
352 /* check bounds */ 357 /* check bounds */
353 if (off < 0 || off >= sizeof(struct pt_regs)) 358 if (off < 0 || off >= sizeof(struct pt_regs))
@@ -425,7 +430,8 @@ static const struct bpf_func_proto *tp_prog_func_proto(enum bpf_func_id func_id)
425 } 430 }
426} 431}
427 432
428static bool tp_prog_is_valid_access(int off, int size, enum bpf_access_type type) 433static bool tp_prog_is_valid_access(int off, int size, enum bpf_access_type type,
434 enum bpf_reg_type *reg_type)
429{ 435{
430 if (off < sizeof(void *) || off >= PERF_MAX_TRACE_SIZE) 436 if (off < sizeof(void *) || off >= PERF_MAX_TRACE_SIZE)
431 return false; 437 return false;