[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210406172322.GA13270@redhat.com>
Date: Tue, 6 Apr 2021 19:23:23 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Hillf Danton <hdanton@...a.com>, Song Liu <songliubraving@...com>,
Peter Zijlstra <peterz@...radead.org>
Cc: Namhyung Kim <namhyung@...nel.org>,
syzbot <syzbot+b804f902bbb6bcf290cb@...kaller.appspotmail.com>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
Greg KH <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: perf_mmap_close() -> put_event() -> event.destroy() can deadlock
Song, Peter, please take a look.
On 04/02, Hillf Danton wrote:
>
> On Thu, 1 Apr 2021 12:53:26 Oleg Nesterov wrote:
> >
> >Hmm, please correct me, but I don't think so. I think mmap_lock -> dup_mmap_sem
> >is not possible.
> >
> Given perf_trace_destroy() in the report, it is a couple of steps in the
> subsequent call chain that it likely takes to reach uprobe_unregister().
>
> perf_trace_destroy()
> perf_trace_event_unreg(p_event)
> tp_event->class->reg(tp_event, TRACE_REG_PERF_UNREGISTER, NULL);
> trace_uprobe_register()
Well, this is not possible, perf_trace_destroy() is only used by perf_tracepoint
pmu. But you are right anyway, event.destroy == perf_uprobe_destroy can lead to
uprobe_unregister(). Thanks.
-------------------------------------------------------------------------------
So. perf_mmap_close() does put_event(event) with mm->mmap_lock held. This can
deadlock if event->destroy == perf_uprobe_destroy: perf_trace_event_close/unreg
takes dup_mmap_sem.
perf_mmap_close() was added by 9bb5d40cd93c9 ("perf: Fix mmap() accounting hole")
and this commit doesn't look right anyway, I'll write another email. However, it
seems that this particular problem was added later by 33ea4b24277b0 ("perf/core:
Implement the 'perf_uprobe' PMU").
Oleg.
Powered by blists - more mailing lists