From: Takashi Iwai <tiwai@suse.de>
To: Hillf Danton <hdanton@sina.com>
Cc: syzbot <syzbot+1ee0910eca9c94f71f25@syzkaller.appspotmail.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
syzkaller-bugs@googlegroups.com, tiwai@suse.com
Subject: Re: [syzbot] possible deadlock in snd_timer_interrupt (2)
Date: Mon, 07 Mar 2022 09:31:16 +0100 [thread overview]
Message-ID: <s5hfsnup3jf.wl-tiwai@suse.de> (raw)
In-Reply-To: <20220307080520.3199-1-hdanton@sina.com>
On Mon, 07 Mar 2022 09:05:20 +0100,
Hillf Danton wrote:
>
> Walk around the deadlock by trying to lock tasklist_lock for write on
> timer irq and scheduling workqueue work if any lock owner detected.
Oh no, that's toooo ugly.
And the problem isn't only here; take a look at commits f671a691e299
and 2f488f698fda. There are other users of kill_fasync() with the
hard-IRQ disabled, too.
So, IMO, the handling of tasklist_lock around kill_fasync() looks
broken and the fix should be needed there (or other core part),
instead of messing round each caller's code.
thanks,
Takashi
>
> Only for thoughts now.
>
> Hillf
>
> #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ 38f80f42147f
>
> --- x/sound/core/timer.c
> +++ y/sound/core/timer.c
> @@ -916,7 +916,14 @@ void snd_timer_interrupt(struct snd_time
> }
>
> /* now process all fast callbacks */
> - snd_timer_process_callbacks(timer, &timer->ack_list_head);
> + if (write_trylock(&tasklist_lock)) {
> + write_unlock(&tasklist_lock);
> + snd_timer_process_callbacks(timer, &timer->ack_list_head);
> + } else {
> + /* go the slow path to avoid deadlock by calling kill_fasync() */
> + list_splice_init(&timer->ack_list_head,
> + &timer->sack_list_head);
> + }
>
> /* do we have any slow callbacks? */
> use_work = !list_empty(&timer->sack_list_head);
> --
>
next prev parent reply other threads:[~2022-03-07 8:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-21 18:39 [syzbot] possible deadlock in snd_timer_interrupt (2) syzbot
2022-02-04 2:12 ` syzbot
2022-03-04 14:46 ` syzbot
[not found] ` <20220307080520.3199-1-hdanton@sina.com>
2022-03-07 8:16 ` syzbot
2022-03-07 8:31 ` Takashi Iwai [this message]
[not found] <20220307103434.3310-1-hdanton@sina.com>
2022-03-07 10:48 ` syzbot
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=s5hfsnup3jf.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+1ee0910eca9c94f71f25@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tiwai@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox