From: Takashi Iwai <tiwai@suse.de>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: alsa-devel@alsa-project.org, Jaroslav Kysela <perex@perex.cz>,
LKML <linux-kernel@vger.kernel.org>,
Alexander Potapenko <glider@google.com>,
Kostya Serebryany <kcc@google.com>,
syzkaller <syzkaller@googlegroups.com>,
Sasha Levin <sasha.levin@oracle.com>
Subject: Re: sound: uninterruptible hang in snd_seq_oss_writeq_sync
Date: Tue, 01 Mar 2016 16:31:10 +0100 [thread overview]
Message-ID: <s5h1t7uuse9.wl-tiwai@suse.de> (raw)
In-Reply-To: <CACT4Y+a1tnWaifUF5Nbg7EFABAhPTrbdN=-XG+UQ5VFMyYwF2Q@mail.gmail.com>
On Tue, 01 Mar 2016 16:04:43 +0100,
Dmitry Vyukov wrote:
>
> On Tue, Mar 1, 2016 at 4:01 PM, Dmitry Vyukov <dvyukov@google.com> wrote:
> > On Tue, Mar 1, 2016 at 3:44 PM, Takashi Iwai <tiwai@suse.de> wrote:
> >> On Tue, 01 Mar 2016 13:33:27 +0100,
> >> Dmitry Vyukov wrote:
> >>>
> >>> Hello,
> >>>
> >>> The following program creates an unkillable process:
> >> .....
> >>> The hang stack is:
> >>>
> >>> [<ffffffff85309f77>] snd_seq_oss_writeq_sync+0x327/0x790
> >>> sound/core/seq/oss/seq_oss_writeq.c:121
> >>
> >> This is
> >> wait_event_interruptible_timeout(q->sync_sleep, ! q->sync_event_put, HZ);
> >>
> >> and this should return zero
> >> if (signal_pending(current))
> >> /* interrupted - return 0 to finish sync */
> >> q->sync_event_put = 0;
> >> if (! q->sync_event_put || q->sync_time >= time)
> >> return 0;
> >> return 1;
> >>
> >>> [<ffffffff852fa353>] snd_seq_oss_drain_write+0x113/0x160
> >>
> >> ... and this loop should break:
> >> while (snd_seq_oss_writeq_sync(dp->writeq))
> >> ;
> >>
> >> So, I see no obvious error in the code, so far.
> >>
> >> I'm running your test program now with 8 parallel runs, but I couldn't
> >> reproduce it. Any other specifics?
>
>
> Hummm.. for me this process hangs every time, even if I just run it
> once from console.
> I've now retested in on clean commit
> fc77dbd34c5c99bce46d40a2491937c3bcbd10af (without KASAN/KCOV and with
> release gcc) and also got the same hang.
> I can only think of a different config. I've attached mine, please try with it.
>
> Are signals delivered if we are already in process of dying?
> When I kill -9 this process it does not react, so presumably wait is
> not unblocked...
Good point.
But above all, it doesn't make much sense to loop this sync call.
When wait_event*() returns, it should go out. So, the patch like
below should be good enough and fix your issue, too.
Takashi
---
diff --git a/sound/core/seq/oss/seq_oss_writeq.c b/sound/core/seq/oss/seq_oss_writeq.c
index 1f6788a18444..4014a5469d1a 100644
--- a/sound/core/seq/oss/seq_oss_writeq.c
+++ b/sound/core/seq/oss/seq_oss_writeq.c
@@ -119,12 +119,7 @@ snd_seq_oss_writeq_sync(struct seq_oss_writeq *q)
}
wait_event_interruptible_timeout(q->sync_sleep, ! q->sync_event_put, HZ);
- if (signal_pending(current))
- /* interrupted - return 0 to finish sync */
- q->sync_event_put = 0;
- if (! q->sync_event_put || q->sync_time >= time)
- return 0;
- return 1;
+ return 0;
}
/*
next prev parent reply other threads:[~2016-03-01 15:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 12:33 sound: uninterruptible hang in snd_seq_oss_writeq_sync Dmitry Vyukov
2016-03-01 14:44 ` Takashi Iwai
2016-03-01 14:44 ` Takashi Iwai
2016-03-01 15:01 ` Dmitry Vyukov
2016-03-01 15:01 ` Dmitry Vyukov
2016-03-01 15:04 ` Dmitry Vyukov
2016-03-01 15:31 ` Takashi Iwai [this message]
2016-03-01 15:45 ` Dmitry Vyukov
2016-03-01 17:43 ` Takashi Iwai
2016-03-01 17:43 ` Takashi Iwai
2016-03-02 9:26 ` Dmitry Vyukov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5h1t7uuse9.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kcc@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=sasha.levin@oracle.com \
--cc=syzkaller@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.