Re: [PATCH 2/8] perf: Sanitize get_callchain_buffer()

2013-08-01 Thread Frederic Weisbecker
On Thu, Aug 01, 2013 at 03:51:02PM +0200, Jiri Olsa wrote: > On Thu, Aug 01, 2013 at 03:42:28PM +0200, Frederic Weisbecker wrote: > > On Thu, Aug 01, 2013 at 03:29:34PM +0200, Jiri Olsa wrote: > > > On Tue, Jul 23, 2013 at 02:31:00AM +0200, Frederic Weisbecker wrote: > > > SNIP > > > > > > >

Re: [PATCH 2/8] perf: Sanitize get_callchain_buffer()

2013-08-01 Thread Frederic Weisbecker
On Thu, Aug 01, 2013 at 03:54:01PM +0200, Jiri Olsa wrote: > On Thu, Aug 01, 2013 at 03:49:36PM +0200, Frederic Weisbecker wrote: > > On Thu, Aug 01, 2013 at 03:32:17PM +0200, Jiri Olsa wrote: > > > On Thu, Aug 01, 2013 at 03:28:34PM +0200, Frederic Weisbecker wrote: > > > > > > SNIP > > > > > >

Re: [PATCH 2/8] perf: Sanitize get_callchain_buffer()

2013-08-01 Thread Jiri Olsa
On Thu, Aug 01, 2013 at 03:49:36PM +0200, Frederic Weisbecker wrote: > On Thu, Aug 01, 2013 at 03:32:17PM +0200, Jiri Olsa wrote: > > On Thu, Aug 01, 2013 at 03:28:34PM +0200, Frederic Weisbecker wrote: > > > > SNIP > > > > > > also for following case: > > > > > > > > count = atomic_inc_

Re: [PATCH 2/8] perf: Sanitize get_callchain_buffer()

2013-08-01 Thread Jiri Olsa
On Thu, Aug 01, 2013 at 03:42:28PM +0200, Frederic Weisbecker wrote: > On Thu, Aug 01, 2013 at 03:29:34PM +0200, Jiri Olsa wrote: > > On Tue, Jul 23, 2013 at 02:31:00AM +0200, Frederic Weisbecker wrote: > > SNIP > > > > > if (event->attach_state & PERF_ATTACH_TASK) > > >

Re: [PATCH 2/8] perf: Sanitize get_callchain_buffer()

2013-08-01 Thread Frederic Weisbecker
On Thu, Aug 01, 2013 at 03:32:17PM +0200, Jiri Olsa wrote: > On Thu, Aug 01, 2013 at 03:28:34PM +0200, Frederic Weisbecker wrote: > > SNIP > > > > also for following case: > > > > > > count = atomic_inc_return(&nr_callchain_events); > > > if (WARN_ON_ONCE(count < 1)) { > > >

Re: [PATCH 2/8] perf: Sanitize get_callchain_buffer()

2013-08-01 Thread Frederic Weisbecker
On Thu, Aug 01, 2013 at 03:29:34PM +0200, Jiri Olsa wrote: > On Tue, Jul 23, 2013 at 02:31:00AM +0200, Frederic Weisbecker wrote: > SNIP > > > if (event->attach_state & PERF_ATTACH_TASK) > > static_key_slow_inc(&perf_sched_events.key); > > if (event->att

Re: [PATCH 2/8] perf: Sanitize get_callchain_buffer()

2013-08-01 Thread Jiri Olsa
On Tue, Jul 23, 2013 at 02:31:00AM +0200, Frederic Weisbecker wrote: SNIP > if (event->attach_state & PERF_ATTACH_TASK) > static_key_slow_inc(&perf_sched_events.key); > if (event->attr.mmap || event->attr.mmap_data) > @@ -6572,16 +6570,19 @@ done:

Re: [PATCH 2/8] perf: Sanitize get_callchain_buffer()

2013-08-01 Thread Jiri Olsa
On Thu, Aug 01, 2013 at 03:28:34PM +0200, Frederic Weisbecker wrote: SNIP > > also for following case: > > > > count = atomic_inc_return(&nr_callchain_events); > > if (WARN_ON_ONCE(count < 1)) { > > err = -EINVAL; > > goto exit; > > } > >

Re: [PATCH 2/8] perf: Sanitize get_callchain_buffer()

2013-08-01 Thread Frederic Weisbecker
On Thu, Aug 01, 2013 at 03:01:46PM +0200, Jiri Olsa wrote: > On Tue, Jul 23, 2013 at 02:31:00AM +0200, Frederic Weisbecker wrote: > > In case of allocation failure, get_callchain_buffer() keeps the > > refcount incremented for the current event. > > > > As a result, when get_callchain_buffers() re

Re: [PATCH 2/8] perf: Sanitize get_callchain_buffer()

2013-08-01 Thread Jiri Olsa
On Tue, Jul 23, 2013 at 02:31:00AM +0200, Frederic Weisbecker wrote: > In case of allocation failure, get_callchain_buffer() keeps the > refcount incremented for the current event. > > As a result, when get_callchain_buffers() returns an error, > we must cleanup what it did by cancelling its last

[PATCH 2/8] perf: Sanitize get_callchain_buffer()

2013-07-22 Thread Frederic Weisbecker
In case of allocation failure, get_callchain_buffer() keeps the refcount incremented for the current event. As a result, when get_callchain_buffers() returns an error, we must cleanup what it did by cancelling its last refcount with a call to put_callchain_buffers(). This is a hack in order to be