mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: syzbot <syzbot+7e6ee55011deeebce15d@syzkaller.appspotmail.com>
Cc: <alsa-devel@alsa-project.org>, <syzkaller-bugs@googlegroups.com>,
	<mingo@kernel.org>, <perex@perex.cz>, <o-takashi@sakamocchi.jp>,
	<linux-kernel@vger.kernel.org>
Subject: Re: WARNING in snd_interval_mulkdiv
Date: Thu, 11 Jan 2018 00:01:16 +0100	[thread overview]
Message-ID: <s5h7espxqrn.wl-tiwai@suse.de> (raw)
In-Reply-To: <001a11449704466f810562709c7c@google.com>

On Wed, 10 Jan 2018 19:58:01 +0100,
syzbot wrote:
> 
> Hello,
> 
> syzkaller hit the following crash on
> cf1fb158230edce8a0482bfb2e59b9c390477fb6
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.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
> 
> 
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+7e6ee55011deeebce15d@syzkaller.appspotmail.com
> It will help syzbot understand when the bug is fixed. See footer for
> details.
> If you forward the report, please keep this part and the footer.
> 
> audit: type=1400 audit(1515606919.914:7): avc:  denied  { map } for
> pid=3501 comm="syzkaller879499" path="/root/syzkaller879499069"
> dev="sda1"  ino=16481
> scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
> tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
> WARNING: CPU: 1 PID: 3501 at sound/core/pcm_lib.c:563 muldiv32
> sound/core/pcm_lib.c:563 [inline]
> WARNING: CPU: 1 PID: 3501 at sound/core/pcm_lib.c:563
> snd_interval_mulkdiv+0x5a9/0x650 sound/core/pcm_lib.c:756
> Kernel panic - not syncing: panic_on_warn set ...
> 
> CPU: 1 PID: 3501 Comm: syzkaller879499 Not tainted 4.15.0-rc7+ #256
> Hardware name: Google Google Compute Engine/Google Compute Engine,
> BIOS  Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x194/0x257 lib/dump_stack.c:53
>  panic+0x1e4/0x41c kernel/panic.c:183
>  __warn+0x1dc/0x200 kernel/panic.c:547
>  report_bug+0x211/0x2d0 lib/bug.c:184
>  fixup_bug.part.11+0x37/0x80 arch/x86/kernel/traps.c:178
>  fixup_bug arch/x86/kernel/traps.c:247 [inline]
>  do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
>  do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
>  invalid_op+0x22/0x40 arch/x86/entry/entry_64.S:1079
> RIP: 0010:muldiv32 sound/core/pcm_lib.c:563 [inline]
> RIP: 0010:snd_interval_mulkdiv+0x5a9/0x650 sound/core/pcm_lib.c:756
> RSP: 0018:ffff8801c04c7478 EFLAGS: 00010293
> RAX: ffff8801c05f43c0 RBX: ffff8801c04c7500 RCX: ffffffff841cb1f9
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000000f4240
> RBP: ffff8801c04c74c0 R08: 000000000000009c R09: ffffed00380bc5e3
> R10: 0000000000000013 R11: ffffed00380bc5e2 R12: ffff8801c05e2ec0
> R13: ffff8801c05e2eb4 R14: ffff8801c05e2ec8 R15: ffff8801c05e2ebc
>  snd_pcm_hw_rule_mulkdiv+0xfd/0x1c0 sound/core/pcm_native.c:2040
>  constrain_params_by_rules+0x625/0x11b0 sound/core/pcm_native.c:400
>  snd_pcm_hw_refine+0x818/0x1070 sound/core/pcm_native.c:502
>  snd_pcm_hw_refine_old_user sound/core/pcm_native.c:3612 [inline]
>  snd_pcm_common_ioctl+0x7f9/0x1f60 sound/core/pcm_native.c:2922
>  snd_pcm_ioctl+0x81/0xb0 sound/core/pcm_native.c:2959
>  vfs_ioctl fs/ioctl.c:46 [inline]
>  do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:686
>  SYSC_ioctl fs/ioctl.c:701 [inline]
>  SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692

This is yet another superfluous WARN_ON() to be removed.
I'm going to queue the fix patch below.


thanks,

Takashi

-- 8< --
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: pcm: Remove yet superfluous WARN_ON()

muldiv32() contains a snd_BUG_ON() (which is morphed as WARN_ON() with
debug option) for checking the case of 0 / 0.  This would be helpful
if this happens only as a logical error; however, since the hw refine
is performed with any data set provided by user, the inconsistent
values that can trigger such a condition might be passed easily.
Actually, syzbot caught this by passing some zero'ed old hw_params
ioctl.

So, having snd_BUG_ON() there is simply superfluous and rather
harmful to give unnecessary confusions.  Let's get rid of it.

Reported-by: syzbot+7e6ee55011deeebce15d@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/pcm_lib.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index db7894bb028c..faa67861cbc1 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -560,7 +560,6 @@ static inline unsigned int muldiv32(unsigned int a, unsigned int b,
 {
 	u_int64_t n = (u_int64_t) a * b;
 	if (c == 0) {
-		snd_BUG_ON(!n);
 		*r = 0;
 		return UINT_MAX;
 	}
-- 
2.15.1

      reply	other threads:[~2018-01-10 23:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 18:58 syzbot
2018-01-10 23:01 ` Takashi Iwai [this message]

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=s5h7espxqrn.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=o-takashi@sakamocchi.jp \
    --cc=perex@perex.cz \
    --cc=syzbot+7e6ee55011deeebce15d@syzkaller.appspotmail.com \
    --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

all inboxes | Powered by JetHome®