Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1307434
| Path | csiph.com!news.freedyn.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Takashi Iwai <tiwai@suse.de> |
| Newsgroups | linux.kernel |
| Subject | Re: sound: use-after-free in snd_timer_stop |
| Date | Tue, 12 Jan 2016 15:10:02 +0100 |
| Message-ID | <qQ7O2-1Z5-21@gated-at.bofh.it> (permalink) |
| References | <qQ7O2-1Z5-23@gated-at.bofh.it> |
| User-Agent | Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) 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 | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 62 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | <alsa-devel@alsa-project.org>, "Jie Yang" <yang.jie@intel.com>, "Mark Brown" <broonie@kernel.org>, "Jaroslav Kysela" <perex@perex.cz>, "LKML" <linux-kernel@vger.kernel.org>, "Eric Dumazet" <edumazet@google.com>, "Alexander Potapenko" <glider@google.com>, "Kostya Serebryany" <kcc@google.com>, "syzkaller" <syzkaller@googlegroups.com>, "Sasha Levin" <sasha.levin@oracle.com> |
| X-Original-Date | Tue, 12 Jan 2016 15:05:24 +0100 |
| X-Original-Message-ID | <s5hh9iiyjtn.wl-tiwai@suse.de> |
| X-Original-References | <CACT4Y+borJj9XYEtXzLUbH9gUipPi9TQaj_O8Sw3tNUvFODPZA@mail.gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1307434 |
Show key headers only | View raw
On Tue, 12 Jan 2016 11:22:09 +0100,
Dmitry Vyukov wrote:
>
> Hello,
>
> I've hit the following use-after-free while running syzkaller fuzzer.
> It is followed by a splat of other reports and finally kernel death.
> I wasn't able to reproduce it with a standalone C program (there is
> probably some global state involved). But it reproduces by replaying
> fuzzer logs in a loop (you will need Go toolchain):
>
> $ go get github.com/google/syzkaller
> $ cd $GOPATH/src/github.com/google/syzkaller
> $ make executor execprog
Just a note: I had to run "mkdir bin" beforehand.
Also for my distro, I had to remove -static.
> $ scp bin/syz-executor bin/syz-execprog your@machine
> $ scp snd_timer_stop your@machine # the attached file
> on test machine:
> $ ./syz-execprog -executor ./syz-executor -cover=0 -repeat=0 -procs=16
> snd_timer_stop
I tried this but couldn't reproduce the issue on my machine,
unfortunately. (Instead I hit another kernel panic regarding apparmor
:)
But looking through your log, it seems like a missing race
protection. Does the patch below work for you?
thanks,
Takashi
---
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index 7dfd0f429410..8ea17d0a4299 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -142,8 +142,10 @@ static struct snd_seq_queue *queue_new(int owner, int locked)
static void queue_delete(struct snd_seq_queue *q)
{
/* stop and release the timer */
+ mutex_lock(&q->timer_mutex);
snd_seq_timer_stop(q->timer);
snd_seq_timer_close(q);
+ mutex_unlock(&q->timer_mutex);
/* wait until access free */
snd_use_lock_sync(&q->use_lock);
/* release resources... */
@@ -470,7 +472,9 @@ int snd_seq_queue_timer_close(int queueid)
queue = queueptr(queueid);
if (queue == NULL)
return -EINVAL;
+ mutex_lock(&queue->timer_mutex);
snd_seq_timer_close(queue);
+ mutex_unlock(&queue->timer_mutex);
queuefree(queue);
return result;
}
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: sound: use-after-free in snd_timer_stop Takashi Iwai <tiwai@suse.de> - 2016-01-12 15:10 +0100
Re: sound: use-after-free in snd_timer_stop Takashi Iwai <tiwai@suse.de> - 2016-01-12 15:20 +0100
Re: sound: use-after-free in snd_timer_stop Dmitry Vyukov <dvyukov@google.com> - 2016-01-12 17:50 +0100
Re: sound: use-after-free in snd_timer_stop Takashi Iwai <tiwai@suse.de> - 2016-01-12 18:00 +0100
csiph-web