From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753068AbcFFOLJ (ORCPT ); Mon, 6 Jun 2016 10:11:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:33292 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753047AbcFFOLH (ORCPT ); Mon, 6 Jun 2016 10:11:07 -0400 Date: Mon, 06 Jun 2016 16:11:05 +0200 Message-ID: From: Takashi Iwai To: Dmitry Vyukov Cc: Jaroslav Kysela , alsa-devel@alsa-project.org, LKML , Sasha Levin , Alexander Potapenko , Kostya Serebryany , syzkaller Subject: Re: sound: use-after-free in hrtimer_cancel In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 04 Jun 2016 20:27:50 +0200, Dmitry Vyukov wrote: > > On Sat, Jun 4, 2016 at 8:00 PM, Dmitry Vyukov wrote: > > Hello, > > > > The following program triggers use-after-free: > > Forget to mention that you need to run it in a tight parallel loop. It > takes around 5 minutes to reproduce for me. Hmm, this again is a bug that is difficult to trigger... At least, I couldn't reproduce locally. How many processes are you running with stress program? It seems that there is nothing more than opening /dev/audio and does some mmap in the job. Is there any other relevant thing there? Also, this assumes that the first sound card is Dummy driver, right? Check /proc/asound/cards. If it's about snd-dummy driver, one blind shot would be a patch like below. But even if it would fix, it doesn't explain why it's triggered in that way... thanks, Takashi --- diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index c0f8f613f1f1..172dacd925f5 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c @@ -420,6 +420,7 @@ static int dummy_hrtimer_stop(struct snd_pcm_substream *substream) static inline void dummy_hrtimer_sync(struct dummy_hrtimer_pcm *dpcm) { + hrtimer_cancel(&dpcm->timer); tasklet_kill(&dpcm->tasklet); }