mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Dmitry Vyukov" <dvyukov@google.com>
Cc: "syzbot" 
	<bot+31681772ec7a18dde8d3f8caf475f361a89b9514@syzkaller.appspotmail.com>,
	<alsa-devel@alsa-project.org>, <syzkaller-bugs@googlegroups.com>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"LKML" <linux-kernel@vger.kernel.org>
Subject: Re: BUG: unable to handle kernel paging request in snd_seq_oss_readq_puts
Date: Wed, 01 Nov 2017 20:49:10 +0100	[thread overview]
Message-ID: <s5h4lqddbk9.wl-tiwai@suse.de> (raw)
In-Reply-To: <CACT4Y+a2eNABZqqcGe1idMX80pS+HrYgM74BiNz8LZjNXDPKXA@mail.gmail.com>

On Wed, 01 Nov 2017 19:39:46 +0100,
Dmitry Vyukov wrote:
> 
> On Wed, Nov 1, 2017 at 9:38 PM, syzbot
> <bot+31681772ec7a18dde8d3f8caf475f361a89b9514@syzkaller.appspotmail.com>
> wrote:
> > Hello,
> >
> > syzkaller hit the following crash on
> > fc2e8b1a47c14b22c33eb087fca0db58e1f4ed0e
> > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
> > compiler: gcc (GCC) 7.1.1 20170620
> > .config is attached
> > Raw console output is attached.
> > C reproducer is attached
> > syzkaller reproducer is attached. See https://goo.gl/kgGztJ
> > for information about syzkaller reproducers
> 
> This also happened on more recent commits, including upstream
> 9c323bff13f92832e03657cabdd70d731408d621 (Oct 20):

Could you try the patch below with CONFIG_SND_DEBUG=y and see whether
it catches any bad calls?  It's already in for-next branch for 4.15.


thanks,

Takashi

-- 8< --
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: seq: Add sanity check for user-space pointer delivery

The sequencer event may contain a user-space pointer with its
SNDRV_SEQ_EXT_USRPTR bit, and we assure that its delivery is limited
with non-atomic mode.  Otherwise the copy_from_user() may hit the
fault and cause a problem.  Although the core code doesn't set such a
flag (only set at snd_seq_write()), any wild driver may set it
mistakenly and lead to an unexpected crash.

This patch adds a sanity check of such events at the delivery core
code to filter out the invalid invocation in the atomic mode.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/seq/seq_clientmgr.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index ea2d0ae85bd3..f2343f63ba26 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -802,6 +802,10 @@ static int snd_seq_deliver_event(struct snd_seq_client *client, struct snd_seq_e
 		return -EMLINK;
 	}
 
+	if (snd_seq_ev_is_variable(event) &&
+	    snd_BUG_ON(atomic && (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR)))
+		return -EINVAL;
+
 	if (event->queue == SNDRV_SEQ_ADDRESS_SUBSCRIBERS ||
 	    event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS)
 		result = deliver_to_subscribers(client, event, atomic, hop);
-- 
2.14.2

  reply	other threads:[~2017-11-01 19:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 18:38 syzbot
2017-11-01 18:39 ` Dmitry Vyukov
2017-11-01 19:49   ` Takashi Iwai [this message]
2017-11-02  8:58     ` Takashi Iwai
2017-11-07 15:20       ` Takashi Iwai
2017-11-20 12:47     ` Dmitry Vyukov
2017-11-20 12:49       ` Dmitry Vyukov
2017-11-20 13:21       ` Takashi Iwai
2017-11-20 16:31         ` Dmitry Vyukov
2017-11-17 20:10 ` syzbot
2017-11-17 20:16   ` 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=s5h4lqddbk9.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=bot+31681772ec7a18dde8d3f8caf475f361a89b9514@syzkaller.appspotmail.com \
    --cc=dvyukov@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=syzkaller-bugs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome