All of lore.kernel.org
 help / color / mirror / Atom feed
* sound: WARNING in snd_rawmidi_kernel_write1
@ 2016-02-01 10:15 Dmitry Vyukov
  2016-02-01 10:36   ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Vyukov @ 2016-02-01 10:15 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, alsa-devel, LKML
  Cc: syzkaller, Kostya Serebryany, Alexander Potapenko, Sasha Levin

Hello,

The following program triggers WARNING in snd_rawmidi_kernel_write1:

// autogenerated by syzkaller (http://github.com/google/syzkaller)
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <fcntl.h>

int main()
{
  int fd;
  struct iovec iov;

  fd = open("/dev/snd/midiC3D0", O_RDWR);
  iov.iov_base = "";
  iov.iov_len = 0;
  writev(fd, &iov, 1);
  return 0;
}


------------[ cut here ]------------
WARNING: CPU: 1 PID: 27775 at sound/core/rawmidi.c:1181
snd_rawmidi_kernel_write1+0x4e1/0x780()
Modules linked in:
CPU: 1 PID: 27775 Comm: syz-executor Not tainted 4.5.0-rc1+ #305
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
 00000000ffffffff ffff88003158f958[  845.661205] ------------[ cut
here ]------------
WARNING: CPU: 3 PID: 27781 at sound/core/rawmidi.c:1181
snd_rawmidi_kernel_write1+0x4e1/0x780()
Modules linked in:
 ffffffff82be11ad 0000000000000000
 ffff880032138000 ffffffff87188ec0 ffff88003158f998 ffffffff813536d9
 ffffffff8527ab31 ffffffff87188ec0 000000000000049d ffff8800321e4b88
Call Trace:
 [<     inline     >] __dump_stack lib/dump_stack.c:15
 [<ffffffff82be11ad>] dump_stack+0x6f/0xa2 lib/dump_stack.c:50
 [<ffffffff813536d9>] warn_slowpath_common+0xd9/0x140 kernel/panic.c:482
 [<ffffffff81353909>] warn_slowpath_null+0x29/0x30 kernel/panic.c:515
 [<ffffffff8527ab31>] snd_rawmidi_kernel_write1+0x4e1/0x780
sound/core/rawmidi.c:1181
 [<ffffffff8527cc93>] snd_rawmidi_write+0x543/0xb30 sound/core/rawmidi.c:1273
 [<ffffffff817b7611>] do_loop_readv_writev+0x141/0x1e0 fs/read_write.c:719
 [<ffffffff817bb478>] do_readv_writev+0x5f8/0x6e0 fs/read_write.c:849
 [<ffffffff817bb696>] vfs_writev+0x86/0xc0 fs/read_write.c:886
 [<     inline     >] SYSC_writev fs/read_write.c:919
 [<ffffffff817be801>] SyS_writev+0x111/0x2b0 fs/read_write.c:911
 [<ffffffff866531b6>] entry_SYSCALL_64_fastpath+0x16/0x7a
arch/x86/entry/entry_64.S:185
---[ end trace 35fa82e449e91fae ]---


On commit 26cd83670f2f5a3d5b5514a1f7d96567cdb9558b

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: sound: WARNING in snd_rawmidi_kernel_write1
  2016-02-01 10:15 sound: WARNING in snd_rawmidi_kernel_write1 Dmitry Vyukov
@ 2016-02-01 10:36   ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2016-02-01 10:36 UTC (permalink / raw)
  To: Dmitry Vyukov
  Cc: alsa-devel, Jaroslav Kysela, LKML, Alexander Potapenko,
	Kostya Serebryany, syzkaller, Sasha Levin

On Mon, 01 Feb 2016 11:15:08 +0100,
Dmitry Vyukov wrote:
> 
> Hello,
> 
> The following program triggers WARNING in snd_rawmidi_kernel_write1:
> 
> // autogenerated by syzkaller (http://github.com/google/syzkaller)
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <sys/uio.h>
> #include <fcntl.h>
> 
> int main()
> {
>   int fd;
>   struct iovec iov;
> 
>   fd = open("/dev/snd/midiC3D0", O_RDWR);

What is the 3rd device?  Please show /proc/asound/cards content.


>   iov.iov_base = "";
>   iov.iov_len = 0;
>   writev(fd, &iov, 1);
>   return 0;
> }
> 
> 
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 27775 at sound/core/rawmidi.c:1181

The fix is easy, just remove snd_BUG_ON() like below.


thanks,

Takashi

---
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index a7759846fbaa..f75d1656272c 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -1178,7 +1178,7 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,
 	long count1, result;
 	struct snd_rawmidi_runtime *runtime = substream->runtime;
 
-	if (snd_BUG_ON(!kernelbuf && !userbuf))
+	if (!kernelbuf && !userbuf)
 		return -EINVAL;
 	if (snd_BUG_ON(!runtime->buffer))
 		return -EINVAL;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: sound: WARNING in snd_rawmidi_kernel_write1
@ 2016-02-01 10:36   ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2016-02-01 10:36 UTC (permalink / raw)
  To: Dmitry Vyukov
  Cc: alsa-devel, Jaroslav Kysela, LKML, Alexander Potapenko,
	Kostya Serebryany, syzkaller, Sasha Levin

On Mon, 01 Feb 2016 11:15:08 +0100,
Dmitry Vyukov wrote:
> 
> Hello,
> 
> The following program triggers WARNING in snd_rawmidi_kernel_write1:
> 
> // autogenerated by syzkaller (http://github.com/google/syzkaller)
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <sys/uio.h>
> #include <fcntl.h>
> 
> int main()
> {
>   int fd;
>   struct iovec iov;
> 
>   fd = open("/dev/snd/midiC3D0", O_RDWR);

What is the 3rd device?  Please show /proc/asound/cards content.


>   iov.iov_base = "";
>   iov.iov_len = 0;
>   writev(fd, &iov, 1);
>   return 0;
> }
> 
> 
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 27775 at sound/core/rawmidi.c:1181

The fix is easy, just remove snd_BUG_ON() like below.


thanks,

Takashi

---
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index a7759846fbaa..f75d1656272c 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -1178,7 +1178,7 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,
 	long count1, result;
 	struct snd_rawmidi_runtime *runtime = substream->runtime;
 
-	if (snd_BUG_ON(!kernelbuf && !userbuf))
+	if (!kernelbuf && !userbuf)
 		return -EINVAL;
 	if (snd_BUG_ON(!runtime->buffer))
 		return -EINVAL;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: sound: WARNING in snd_rawmidi_kernel_write1
  2016-02-01 10:36   ` Takashi Iwai
  (?)
@ 2016-02-02 21:25   ` Dmitry Vyukov
  2016-02-02 23:20     ` Takashi Iwai
  -1 siblings, 1 reply; 6+ messages in thread
From: Dmitry Vyukov @ 2016-02-02 21:25 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: alsa-devel, Jaroslav Kysela, LKML, Alexander Potapenko,
	Kostya Serebryany, syzkaller, Sasha Levin

On Mon, Feb 1, 2016 at 11:36 AM, Takashi Iwai <tiwai@suse.de> wrote:
> On Mon, 01 Feb 2016 11:15:08 +0100,
> Dmitry Vyukov wrote:
>>
>> Hello,
>>
>> The following program triggers WARNING in snd_rawmidi_kernel_write1:
>>
>> // autogenerated by syzkaller (http://github.com/google/syzkaller)
>> #include <unistd.h>
>> #include <sys/types.h>
>> #include <sys/stat.h>
>> #include <sys/uio.h>
>> #include <fcntl.h>
>>
>> int main()
>> {
>>   int fd;
>>   struct iovec iov;
>>
>>   fd = open("/dev/snd/midiC3D0", O_RDWR);
>
> What is the 3rd device?  Please show /proc/asound/cards content.

Missed this question. Here is it. I run qemu with "-soundhw all" flag.

 0 [Dummy          ]: Dummy - Dummy
                      Dummy 1
 1 [Loopback       ]: Loopback - Loopback
                      Loopback 1
 2 [VirMIDI        ]: VirMIDI - VirMIDI
                      Virtual MIDI Card 1
 3 [port           ]: MTPAV - MTPAV on parallel port
                      MTPAV on parallel port at 0x378
 4 [pcsp           ]: PC-Speaker - pcsp
                      Internal PC-Speaker at port 0x61
 5 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xfebf0000 irq 24

But the patch helps with the warning message :)


>>   iov.iov_base = "";
>>   iov.iov_len = 0;
>>   writev(fd, &iov, 1);
>>   return 0;
>> }
>>
>>
>> ------------[ cut here ]------------
>> WARNING: CPU: 1 PID: 27775 at sound/core/rawmidi.c:1181
>
> The fix is easy, just remove snd_BUG_ON() like below.
>
>
> thanks,
>
> Takashi
>
> ---
> diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
> index a7759846fbaa..f75d1656272c 100644
> --- a/sound/core/rawmidi.c
> +++ b/sound/core/rawmidi.c
> @@ -1178,7 +1178,7 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,
>         long count1, result;
>         struct snd_rawmidi_runtime *runtime = substream->runtime;
>
> -       if (snd_BUG_ON(!kernelbuf && !userbuf))
> +       if (!kernelbuf && !userbuf)
>                 return -EINVAL;
>         if (snd_BUG_ON(!runtime->buffer))
>                 return -EINVAL;
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: sound: WARNING in snd_rawmidi_kernel_write1
  2016-02-02 21:25   ` Dmitry Vyukov
@ 2016-02-02 23:20     ` Takashi Iwai
  2016-02-03 13:23       ` Dmitry Vyukov
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2016-02-02 23:20 UTC (permalink / raw)
  To: Dmitry Vyukov
  Cc: alsa-devel, Jaroslav Kysela, LKML, Alexander Potapenko,
	Kostya Serebryany, syzkaller, Sasha Levin

On Tue, 02 Feb 2016 22:25:45 +0100,
Dmitry Vyukov wrote:
> 
> On Mon, Feb 1, 2016 at 11:36 AM, Takashi Iwai <tiwai@suse.de> wrote:
> > On Mon, 01 Feb 2016 11:15:08 +0100,
> > Dmitry Vyukov wrote:
> >>
> >> Hello,
> >>
> >> The following program triggers WARNING in snd_rawmidi_kernel_write1:
> >>
> >> // autogenerated by syzkaller (http://github.com/google/syzkaller)
> >> #include <unistd.h>
> >> #include <sys/types.h>
> >> #include <sys/stat.h>
> >> #include <sys/uio.h>
> >> #include <fcntl.h>
> >>
> >> int main()
> >> {
> >>   int fd;
> >>   struct iovec iov;
> >>
> >>   fd = open("/dev/snd/midiC3D0", O_RDWR);
> >
> > What is the 3rd device?  Please show /proc/asound/cards content.
> 
> Missed this question. Here is it. I run qemu with "-soundhw all" flag.
> 
>  0 [Dummy          ]: Dummy - Dummy
>                       Dummy 1
>  1 [Loopback       ]: Loopback - Loopback
>                       Loopback 1
>  2 [VirMIDI        ]: VirMIDI - VirMIDI
>                       Virtual MIDI Card 1
>  3 [port           ]: MTPAV - MTPAV on parallel port
>                       MTPAV on parallel port at 0x378
>  4 [pcsp           ]: PC-Speaker - pcsp
>                       Internal PC-Speaker at port 0x61
>  5 [Intel          ]: HDA-Intel - HDA Intel
>                       HDA Intel at 0xfebf0000 irq 24
> 
> But the patch helps with the warning message :)

Ah, you enabled MTPAV driver.  Please drop CONFIG_SND_MTPAV for your
testing.  This is known to be unstable and is only for a dedicated
parport device, not meant as a generic device to be covered at all.


Takashi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: sound: WARNING in snd_rawmidi_kernel_write1
  2016-02-02 23:20     ` Takashi Iwai
@ 2016-02-03 13:23       ` Dmitry Vyukov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Vyukov @ 2016-02-03 13:23 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: alsa-devel, Jaroslav Kysela, LKML, Alexander Potapenko,
	Kostya Serebryany, syzkaller, Sasha Levin

On Wed, Feb 3, 2016 at 12:20 AM, Takashi Iwai <tiwai@suse.de> wrote:
> On Tue, 02 Feb 2016 22:25:45 +0100,
> Dmitry Vyukov wrote:
>>
>> On Mon, Feb 1, 2016 at 11:36 AM, Takashi Iwai <tiwai@suse.de> wrote:
>> > On Mon, 01 Feb 2016 11:15:08 +0100,
>> > Dmitry Vyukov wrote:
>> >>
>> >> Hello,
>> >>
>> >> The following program triggers WARNING in snd_rawmidi_kernel_write1:
>> >>
>> >> // autogenerated by syzkaller (http://github.com/google/syzkaller)
>> >> #include <unistd.h>
>> >> #include <sys/types.h>
>> >> #include <sys/stat.h>
>> >> #include <sys/uio.h>
>> >> #include <fcntl.h>
>> >>
>> >> int main()
>> >> {
>> >>   int fd;
>> >>   struct iovec iov;
>> >>
>> >>   fd = open("/dev/snd/midiC3D0", O_RDWR);
>> >
>> > What is the 3rd device?  Please show /proc/asound/cards content.
>>
>> Missed this question. Here is it. I run qemu with "-soundhw all" flag.
>>
>>  0 [Dummy          ]: Dummy - Dummy
>>                       Dummy 1
>>  1 [Loopback       ]: Loopback - Loopback
>>                       Loopback 1
>>  2 [VirMIDI        ]: VirMIDI - VirMIDI
>>                       Virtual MIDI Card 1
>>  3 [port           ]: MTPAV - MTPAV on parallel port
>>                       MTPAV on parallel port at 0x378
>>  4 [pcsp           ]: PC-Speaker - pcsp
>>                       Internal PC-Speaker at port 0x61
>>  5 [Intel          ]: HDA-Intel - HDA Intel
>>                       HDA Intel at 0xfebf0000 irq 24
>>
>> But the patch helps with the warning message :)
>
> Ah, you enabled MTPAV driver.  Please drop CONFIG_SND_MTPAV for your
> testing.  This is known to be unstable and is only for a dedicated
> parport device, not meant as a generic device to be covered at all.


Dropped CONFIG_SND_MTPAV.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-03 13:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01 10:15 sound: WARNING in snd_rawmidi_kernel_write1 Dmitry Vyukov
2016-02-01 10:36 ` Takashi Iwai
2016-02-01 10:36   ` Takashi Iwai
2016-02-02 21:25   ` Dmitry Vyukov
2016-02-02 23:20     ` Takashi Iwai
2016-02-03 13:23       ` Dmitry Vyukov

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.