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

Reply via email to