lkml.org 
[lkml]   [2013]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: OOPS in perf_mmap_close()
On Mon, Jun 03, 2013 at 03:26:45PM +0200, Peter Zijlstra wrote:
> On Thu, May 30, 2013 at 08:51:00AM -0400, Vince Weaver wrote:
> > > I'll go prod, thanks again!
>
>
> OK the below builds and seems to survive both test cases and about 10 minutes
> of fuzzing -- fingers crossed.
>
> ---
> @@ -3779,12 +3834,21 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
> return -EINVAL;
>
> WARN_ON_ONCE(event->ctx->parent_ctx);
> +again:
> mutex_lock(&event->mmap_mutex);
> if (event->rb) {
> - if (event->rb->nr_pages == nr_pages)
> - atomic_inc(&event->rb->refcount);
> - else
> + if (event->rb->nr_pages != nr_pages)
{
> ret = -EINVAL;
goto unlock;
}

Seems to cure it... I'm going to let it run over night.

> +
> + if (!atomic_inc_not_zero(&event->rb->mmap_count)) {
> + /*
> + * Raced against perf_mmap_close() through
> + * perf_event_set_output(). Try again, hope for better
> + * luck.
> + */
> + mutex_unlock(&event->mmap_mutex);
> + goto again;
> + }
> goto unlock;
> }
>


\
 
 \ /
  Last update: 2013-06-03 22:01    [W:0.211 / U:0.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site