Re: [PATCH v2 net-next] bpf: fix bpf_perf_event_read() helper

From: Alexei Starovoitov
Date: Thu Oct 22 2015 - 11:53:07 EST


On 10/22/15 6:57 AM, Peter Zijlstra wrote:
On Wed, Oct 21, 2015 at 03:58:03PM -0700, Alexei Starovoitov wrote:
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 64754bfecd70..0b6333265872 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3258,7 +3258,7 @@ static inline u64 perf_event_count(struct perf_event *event)
u64 perf_event_read_local(struct perf_event *event)
{
unsigned long flags;
- u64 val;
+ u64 val = -EINVAL;

No, you cannot do this, -EINVAL is a valid count value. You simply must
not call this function on !local events, ever.

agree. Will keep perf_event_read_local() as-is and do all safety
checks on bpf side.


--
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/