[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150717113729.GL12596@twins.programming.kicks-ass.net>
Date: Fri, 17 Jul 2015 13:37:29 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: kaixu xia <xiakaixu@...wei.com>
Cc: ast@...mgrid.com, davem@...emloft.net, acme@...nel.org,
mingo@...hat.com, masami.hiramatsu.pt@...achi.com,
jolsa@...nel.org, wangnan0@...wei.com,
linux-kernel@...r.kernel.org, pi3orama@....com, hekuang@...wei.com
Subject: Re: [RFC PATCH 3/6] bpf: Save the pointer to struct perf_event to map
On Fri, Jul 17, 2015 at 06:43:33PM +0800, kaixu xia wrote:
> +static int replace_map_with_perf_event(void *value)
> +{
> + struct perf_event *event;
> + u32 fd;
> +
> + fd = *(u32 *)value;
> +
> + event = perf_event_get(fd);
> + if (IS_ERR(event))
> + return PTR_ERR(event);
> +
And userspace closes here,
> + if (atomic_long_inc_not_zero(&event->refcount))
And this goes *BOOM*
> + memcpy(value, &event, sizeof(struct perf_event *));
> + else
> + return -ENOENT;
> +
> + return 0;
> +}
Also, why do you think its OK to prod around the internals of perf_event
outside of kernel/events/ ?
--
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