All of lore.kernel.org
 help / color / mirror / Atom feed
* KASAN: use-after-free Read in snd_timer_resolution
@ 2020-01-15 17:16 ` syzbot
  0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2020-01-15 17:16 UTC (permalink / raw)
  To: alsa-devel, linux-kernel, perex, syzkaller-bugs, tiwai

Hello,

syzbot found the following crash on:

HEAD commit:    e033e7d4 Merge branch 'dhowells' (patches from DavidH)
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12f2bb25e00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=d9290aeb7e6cf1c4
dashboard link: https://syzkaller.appspot.com/bug?extid=2b2ef983f973e5c40943
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
userspace arch: i386

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+2b2ef983f973e5c40943@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in snd_timer_resolution+0xf1/0x110  
sound/core/timer.c:441
Read of size 8 at addr ffff888094155800 by task syz-executor.0/18632

CPU: 1 PID: 18632 Comm: syz-executor.0 Not tainted 5.5.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x197/0x210 lib/dump_stack.c:118
  print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
  __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
  kasan_report+0x12/0x20 mm/kasan/common.c:639
  __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
  snd_timer_resolution+0xf1/0x110 sound/core/timer.c:441
  snd_seq_info_timer_read+0x95/0x2f1 sound/core/seq/seq_timer.c:480
  snd_info_seq_show+0xcb/0x120 sound/core/info.c:363
  seq_read+0x4ca/0x1170 fs/seq_file.c:229
  proc_reg_read+0x1fc/0x2c0 fs/proc/inode.c:223
  do_loop_readv_writev fs/read_write.c:714 [inline]
  do_loop_readv_writev fs/read_write.c:701 [inline]
  do_iter_read+0x4a4/0x660 fs/read_write.c:935
  compat_readv+0x187/0x1f0 fs/read_write.c:1186
  do_compat_preadv64+0x190/0x1c0 fs/read_write.c:1235
  __do_compat_sys_preadv fs/read_write.c:1255 [inline]
  __se_compat_sys_preadv fs/read_write.c:1249 [inline]
  __ia32_compat_sys_preadv+0xc7/0x140 fs/read_write.c:1249
  do_syscall_32_irqs_on arch/x86/entry/common.c:337 [inline]
  do_fast_syscall_32+0x27b/0xe16 arch/x86/entry/common.c:408
  entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139
RIP: 0023:0xf7f6da39
Code: 00 00 00 89 d3 5b 5e 5f 5d c3 b8 80 96 98 00 eb c4 8b 04 24 c3 8b 1c  
24 c3 8b 34 24 c3 8b 3c 24 c3 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90  
90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 002b:00000000f5d690cc EFLAGS: 00000296 ORIG_RAX: 000000000000014d
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00000000200017c0
RDX: 00000000000003da RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 18631:
  save_stack+0x23/0x90 mm/kasan/common.c:72
  set_track mm/kasan/common.c:80 [inline]
  __kasan_kmalloc mm/kasan/common.c:513 [inline]
  __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:486
  kasan_kmalloc+0x9/0x10 mm/kasan/common.c:527
  kmem_cache_alloc_trace+0x158/0x790 mm/slab.c:3551
  kmalloc include/linux/slab.h:556 [inline]
  kzalloc include/linux/slab.h:670 [inline]
  snd_timer_instance_new+0x4a/0x300 sound/core/timer.c:96
  snd_seq_timer_open+0x1c0/0x590 sound/core/seq/seq_timer.c:275
  queue_use+0xf1/0x270 sound/core/seq/seq_queue.c:489
  snd_seq_queue_alloc+0x2c5/0x4d0 sound/core/seq/seq_queue.c:176
  snd_seq_ioctl_create_queue+0xb0/0x330 sound/core/seq/seq_clientmgr.c:1548
  snd_seq_kernel_client_ctl+0xf8/0x140 sound/core/seq/seq_clientmgr.c:2353
  alloc_seq_queue.isra.0+0xdc/0x180 sound/core/seq/oss/seq_oss_init.c:357
  snd_seq_oss_open+0x2ff/0x960 sound/core/seq/oss/seq_oss_init.c:215
  odev_open+0x70/0x90 sound/core/seq/oss/seq_oss.c:125
  soundcore_open+0x453/0x610 sound/sound_core.c:593
  chrdev_open+0x245/0x6b0 fs/char_dev.c:414
  do_dentry_open+0x4e6/0x1380 fs/open.c:797
  vfs_open+0xa0/0xd0 fs/open.c:914
  do_last fs/namei.c:3420 [inline]
  path_openat+0x10df/0x4500 fs/namei.c:3537
  do_filp_open+0x1a1/0x280 fs/namei.c:3567
  do_sys_open+0x3fe/0x5d0 fs/open.c:1097
  __do_compat_sys_openat fs/open.c:1143 [inline]
  __se_compat_sys_openat fs/open.c:1141 [inline]
  __ia32_compat_sys_openat+0x98/0xf0 fs/open.c:1141
  do_syscall_32_irqs_on arch/x86/entry/common.c:337 [inline]
  do_fast_syscall_32+0x27b/0xe16 arch/x86/entry/common.c:408
  entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139

Freed by task 18630:
  save_stack+0x23/0x90 mm/kasan/common.c:72
  set_track mm/kasan/common.c:80 [inline]
  kasan_set_free_info mm/kasan/common.c:335 [inline]
  __kasan_slab_free+0x102/0x150 mm/kasan/common.c:474
  kasan_slab_free+0xe/0x10 mm/kasan/common.c:483
  __cache_free mm/slab.c:3426 [inline]
  kfree+0x10a/0x2c0 mm/slab.c:3757
  snd_timer_instance_free sound/core/timer.c:120 [inline]
  snd_timer_instance_free+0x7c/0xa0 sound/core/timer.c:114
  snd_seq_timer_close+0x99/0xe0 sound/core/seq/seq_timer.c:319
  queue_delete+0x52/0xb0 sound/core/seq/seq_queue.c:134
  snd_seq_queue_delete+0x4e/0x70 sound/core/seq/seq_queue.c:196
  snd_seq_ioctl_delete_queue+0x6a/0x90 sound/core/seq/seq_clientmgr.c:1570
  snd_seq_kernel_client_ctl+0xf8/0x140 sound/core/seq/seq_clientmgr.c:2353
  delete_seq_queue.part.0+0xb6/0x120 sound/core/seq/oss/seq_oss_init.c:376
  delete_seq_queue sound/core/seq/oss/seq_oss_init.c:372 [inline]
  snd_seq_oss_release+0x116/0x150 sound/core/seq/oss/seq_oss_init.c:421
  odev_release+0x54/0x80 sound/core/seq/oss/seq_oss.c:140
  __fput+0x2ff/0x890 fs/file_table.c:280
  ____fput+0x16/0x20 fs/file_table.c:313
  task_work_run+0x145/0x1c0 kernel/task_work.c:113
  tracehook_notify_resume include/linux/tracehook.h:188 [inline]
  exit_to_usermode_loop+0x316/0x380 arch/x86/entry/common.c:164
  prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline]
  syscall_return_slowpath arch/x86/entry/common.c:278 [inline]
  do_syscall_32_irqs_on arch/x86/entry/common.c:352 [inline]
  do_fast_syscall_32+0xbbd/0xe16 arch/x86/entry/common.c:408
  entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139

The buggy address belongs to the object at ffff888094155800
  which belongs to the cache kmalloc-256 of size 256
The buggy address is located 0 bytes inside of
  256-byte region [ffff888094155800, ffff888094155900)
The buggy address belongs to the page:
page:ffffea0002505540 refcount:1 mapcount:0 mapping:ffff8880aa4008c0  
index:0x0
raw: 00fffe0000000200 ffffea00024df348 ffffea00024af508 ffff8880aa4008c0
raw: 0000000000000000 ffff888094155000 0000000100000008 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
  ffff888094155700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
  ffff888094155780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff888094155800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                    ^
  ffff888094155880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff888094155900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

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

* [alsa-devel] KASAN: use-after-free Read in snd_timer_resolution
@ 2020-01-15 17:16 ` syzbot
  0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2020-01-15 17:16 UTC (permalink / raw)
  To: alsa-devel, linux-kernel, perex, syzkaller-bugs, tiwai

Hello,

syzbot found the following crash on:

HEAD commit:    e033e7d4 Merge branch 'dhowells' (patches from DavidH)
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12f2bb25e00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=d9290aeb7e6cf1c4
dashboard link: https://syzkaller.appspot.com/bug?extid=2b2ef983f973e5c40943
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
userspace arch: i386

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+2b2ef983f973e5c40943@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in snd_timer_resolution+0xf1/0x110  
sound/core/timer.c:441
Read of size 8 at addr ffff888094155800 by task syz-executor.0/18632

CPU: 1 PID: 18632 Comm: syz-executor.0 Not tainted 5.5.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x197/0x210 lib/dump_stack.c:118
  print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
  __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
  kasan_report+0x12/0x20 mm/kasan/common.c:639
  __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
  snd_timer_resolution+0xf1/0x110 sound/core/timer.c:441
  snd_seq_info_timer_read+0x95/0x2f1 sound/core/seq/seq_timer.c:480
  snd_info_seq_show+0xcb/0x120 sound/core/info.c:363
  seq_read+0x4ca/0x1170 fs/seq_file.c:229
  proc_reg_read+0x1fc/0x2c0 fs/proc/inode.c:223
  do_loop_readv_writev fs/read_write.c:714 [inline]
  do_loop_readv_writev fs/read_write.c:701 [inline]
  do_iter_read+0x4a4/0x660 fs/read_write.c:935
  compat_readv+0x187/0x1f0 fs/read_write.c:1186
  do_compat_preadv64+0x190/0x1c0 fs/read_write.c:1235
  __do_compat_sys_preadv fs/read_write.c:1255 [inline]
  __se_compat_sys_preadv fs/read_write.c:1249 [inline]
  __ia32_compat_sys_preadv+0xc7/0x140 fs/read_write.c:1249
  do_syscall_32_irqs_on arch/x86/entry/common.c:337 [inline]
  do_fast_syscall_32+0x27b/0xe16 arch/x86/entry/common.c:408
  entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139
RIP: 0023:0xf7f6da39
Code: 00 00 00 89 d3 5b 5e 5f 5d c3 b8 80 96 98 00 eb c4 8b 04 24 c3 8b 1c  
24 c3 8b 34 24 c3 8b 3c 24 c3 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90  
90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 002b:00000000f5d690cc EFLAGS: 00000296 ORIG_RAX: 000000000000014d
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00000000200017c0
RDX: 00000000000003da RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 18631:
  save_stack+0x23/0x90 mm/kasan/common.c:72
  set_track mm/kasan/common.c:80 [inline]
  __kasan_kmalloc mm/kasan/common.c:513 [inline]
  __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:486
  kasan_kmalloc+0x9/0x10 mm/kasan/common.c:527
  kmem_cache_alloc_trace+0x158/0x790 mm/slab.c:3551
  kmalloc include/linux/slab.h:556 [inline]
  kzalloc include/linux/slab.h:670 [inline]
  snd_timer_instance_new+0x4a/0x300 sound/core/timer.c:96
  snd_seq_timer_open+0x1c0/0x590 sound/core/seq/seq_timer.c:275
  queue_use+0xf1/0x270 sound/core/seq/seq_queue.c:489
  snd_seq_queue_alloc+0x2c5/0x4d0 sound/core/seq/seq_queue.c:176
  snd_seq_ioctl_create_queue+0xb0/0x330 sound/core/seq/seq_clientmgr.c:1548
  snd_seq_kernel_client_ctl+0xf8/0x140 sound/core/seq/seq_clientmgr.c:2353
  alloc_seq_queue.isra.0+0xdc/0x180 sound/core/seq/oss/seq_oss_init.c:357
  snd_seq_oss_open+0x2ff/0x960 sound/core/seq/oss/seq_oss_init.c:215
  odev_open+0x70/0x90 sound/core/seq/oss/seq_oss.c:125
  soundcore_open+0x453/0x610 sound/sound_core.c:593
  chrdev_open+0x245/0x6b0 fs/char_dev.c:414
  do_dentry_open+0x4e6/0x1380 fs/open.c:797
  vfs_open+0xa0/0xd0 fs/open.c:914
  do_last fs/namei.c:3420 [inline]
  path_openat+0x10df/0x4500 fs/namei.c:3537
  do_filp_open+0x1a1/0x280 fs/namei.c:3567
  do_sys_open+0x3fe/0x5d0 fs/open.c:1097
  __do_compat_sys_openat fs/open.c:1143 [inline]
  __se_compat_sys_openat fs/open.c:1141 [inline]
  __ia32_compat_sys_openat+0x98/0xf0 fs/open.c:1141
  do_syscall_32_irqs_on arch/x86/entry/common.c:337 [inline]
  do_fast_syscall_32+0x27b/0xe16 arch/x86/entry/common.c:408
  entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139

Freed by task 18630:
  save_stack+0x23/0x90 mm/kasan/common.c:72
  set_track mm/kasan/common.c:80 [inline]
  kasan_set_free_info mm/kasan/common.c:335 [inline]
  __kasan_slab_free+0x102/0x150 mm/kasan/common.c:474
  kasan_slab_free+0xe/0x10 mm/kasan/common.c:483
  __cache_free mm/slab.c:3426 [inline]
  kfree+0x10a/0x2c0 mm/slab.c:3757
  snd_timer_instance_free sound/core/timer.c:120 [inline]
  snd_timer_instance_free+0x7c/0xa0 sound/core/timer.c:114
  snd_seq_timer_close+0x99/0xe0 sound/core/seq/seq_timer.c:319
  queue_delete+0x52/0xb0 sound/core/seq/seq_queue.c:134
  snd_seq_queue_delete+0x4e/0x70 sound/core/seq/seq_queue.c:196
  snd_seq_ioctl_delete_queue+0x6a/0x90 sound/core/seq/seq_clientmgr.c:1570
  snd_seq_kernel_client_ctl+0xf8/0x140 sound/core/seq/seq_clientmgr.c:2353
  delete_seq_queue.part.0+0xb6/0x120 sound/core/seq/oss/seq_oss_init.c:376
  delete_seq_queue sound/core/seq/oss/seq_oss_init.c:372 [inline]
  snd_seq_oss_release+0x116/0x150 sound/core/seq/oss/seq_oss_init.c:421
  odev_release+0x54/0x80 sound/core/seq/oss/seq_oss.c:140
  __fput+0x2ff/0x890 fs/file_table.c:280
  ____fput+0x16/0x20 fs/file_table.c:313
  task_work_run+0x145/0x1c0 kernel/task_work.c:113
  tracehook_notify_resume include/linux/tracehook.h:188 [inline]
  exit_to_usermode_loop+0x316/0x380 arch/x86/entry/common.c:164
  prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline]
  syscall_return_slowpath arch/x86/entry/common.c:278 [inline]
  do_syscall_32_irqs_on arch/x86/entry/common.c:352 [inline]
  do_fast_syscall_32+0xbbd/0xe16 arch/x86/entry/common.c:408
  entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139

The buggy address belongs to the object at ffff888094155800
  which belongs to the cache kmalloc-256 of size 256
The buggy address is located 0 bytes inside of
  256-byte region [ffff888094155800, ffff888094155900)
The buggy address belongs to the page:
page:ffffea0002505540 refcount:1 mapcount:0 mapping:ffff8880aa4008c0  
index:0x0
raw: 00fffe0000000200 ffffea00024df348 ffffea00024af508 ffff8880aa4008c0
raw: 0000000000000000 ffff888094155000 0000000100000008 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
  ffff888094155700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
  ffff888094155780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff888094155800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                    ^
  ffff888094155880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff888094155900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: KASAN: use-after-free Read in snd_timer_resolution
  2020-01-15 17:16 ` [alsa-devel] " syzbot
@ 2020-02-02 12:56   ` syzbot
  -1 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2020-02-02 12:56 UTC (permalink / raw)
  To: 20200115203733.26530-1-tiwai, alsa-devel-owner, alsa-devel, arnd,
	baolin.wang, gregkh, linux-kernel, perex, stable-commits, stable,
	syzkaller-bugs, tiwai, tiwai

syzbot has found a reproducer for the following crash on:

HEAD commit:    2747d5fd Add linux-next specific files for 20200116
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1147e101e00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=22f506e7a3a37fe2
dashboard link: https://syzkaller.appspot.com/bug?extid=2b2ef983f973e5c40943
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10c0864ee00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14738df1e00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+2b2ef983f973e5c40943@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in snd_timer_resolution+0xf1/0x110 sound/core/timer.c:487
Read of size 8 at addr ffff88809e0f5a00 by task syz-executor911/9849

CPU: 1 PID: 9849 Comm: syz-executor911 Not tainted 5.5.0-rc6-next-20200116-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x197/0x210 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 __kasan_report.cold+0x1b/0x32 mm/kasan/report.c:506
 kasan_report+0x12/0x20 mm/kasan/common.c:641
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
 snd_timer_resolution+0xf1/0x110 sound/core/timer.c:487
 snd_seq_info_timer_read+0x95/0x2f1 sound/core/seq/seq_timer.c:480
 snd_info_seq_show+0xcb/0x120 sound/core/info.c:362
 seq_read+0x4ca/0x1170 fs/seq_file.c:229
 proc_reg_read+0x1f8/0x2b0 fs/proc/inode.c:223
 do_loop_readv_writev fs/read_write.c:714 [inline]
 do_loop_readv_writev fs/read_write.c:701 [inline]
 do_iter_read+0x4a4/0x660 fs/read_write.c:935
 vfs_readv+0xf0/0x160 fs/read_write.c:997
 do_preadv+0x1c4/0x280 fs/read_write.c:1089
 __do_sys_preadv fs/read_write.c:1139 [inline]
 __se_sys_preadv fs/read_write.c:1134 [inline]
 __x64_sys_preadv+0x9a/0xf0 fs/read_write.c:1134
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x441389
Code: e8 ac e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffc8aa7ce38 EFLAGS: 00000246 ORIG_RAX: 0000000000000127
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441389
RDX: 0000000000000227 RSI: 00000000200017c0 RDI: 0000000000000004
RBP: 00007ffc8aa7ce50 R08: 000000000000000f R09: 00000000000000c2
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402100
R13: 0000000000402190 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 9852:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc mm/kasan/common.c:515 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:488
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529
 kmem_cache_alloc_trace+0x158/0x790 mm/slab.c:3551
 kmalloc include/linux/slab.h:555 [inline]
 kzalloc include/linux/slab.h:669 [inline]
 snd_timer_instance_new+0x4a/0x300 sound/core/timer.c:142
 snd_seq_timer_open+0x1c0/0x590 sound/core/seq/seq_timer.c:275
 queue_use+0xf1/0x270 sound/core/seq/seq_queue.c:489
 snd_seq_queue_alloc+0x2c5/0x4d0 sound/core/seq/seq_queue.c:176
 snd_seq_ioctl_create_queue+0xb0/0x330 sound/core/seq/seq_clientmgr.c:1548
 snd_seq_kernel_client_ctl+0xf8/0x140 sound/core/seq/seq_clientmgr.c:2353
 alloc_seq_queue.isra.0+0xdc/0x180 sound/core/seq/oss/seq_oss_init.c:357
 snd_seq_oss_open+0x2ff/0x960 sound/core/seq/oss/seq_oss_init.c:215
 odev_open+0x70/0x90 sound/core/seq/oss/seq_oss.c:125
 soundcore_open+0x453/0x610 sound/sound_core.c:593
 chrdev_open+0x245/0x6b0 fs/char_dev.c:414
 do_dentry_open+0x4ca/0x1350 fs/open.c:797
 vfs_open+0xa0/0xd0 fs/open.c:914
 do_last fs/namei.c:3487 [inline]
 path_openat+0x12fd/0x34d0 fs/namei.c:3604
 do_filp_open+0x192/0x260 fs/namei.c:3634
 do_sys_openat2+0x633/0x840 fs/open.c:1151
 do_sys_open+0xfc/0x190 fs/open.c:1167
 __do_sys_openat fs/open.c:1181 [inline]
 __se_sys_openat fs/open.c:1176 [inline]
 __x64_sys_openat+0x9d/0x100 fs/open.c:1176
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 9852:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 kasan_set_free_info mm/kasan/common.c:337 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:476
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:485
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x10a/0x2c0 mm/slab.c:3757
 snd_timer_instance_free sound/core/timer.c:166 [inline]
 snd_timer_instance_free+0x7c/0xa0 sound/core/timer.c:160
 snd_seq_timer_close+0x99/0xe0 sound/core/seq/seq_timer.c:319
 queue_delete+0x52/0xb0 sound/core/seq/seq_queue.c:134
 snd_seq_queue_delete+0x4e/0x70 sound/core/seq/seq_queue.c:196
 snd_seq_ioctl_delete_queue+0x6a/0x90 sound/core/seq/seq_clientmgr.c:1570
 snd_seq_kernel_client_ctl+0xf8/0x140 sound/core/seq/seq_clientmgr.c:2353
 delete_seq_queue.part.0+0xb6/0x120 sound/core/seq/oss/seq_oss_init.c:376
 delete_seq_queue sound/core/seq/oss/seq_oss_init.c:372 [inline]
 snd_seq_oss_release+0x116/0x150 sound/core/seq/oss/seq_oss_init.c:421
 odev_release+0x54/0x80 sound/core/seq/oss/seq_oss.c:140
 __fput+0x2ff/0x890 fs/file_table.c:280
 ____fput+0x16/0x20 fs/file_table.c:313
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xbcb/0x2f80 kernel/exit.c:801
 do_group_exit+0x135/0x360 kernel/exit.c:899
 __do_sys_exit_group kernel/exit.c:910 [inline]
 __se_sys_exit_group kernel/exit.c:908 [inline]
 __x64_sys_exit_group+0x44/0x50 kernel/exit.c:908
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809e0f5a00
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 0 bytes inside of
 256-byte region [ffff88809e0f5a00, ffff88809e0f5b00)
The buggy address belongs to the page:
page:ffffea0002783d40 refcount:1 mapcount:0 mapping:ffff8880aa4008c0 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea0002783948 ffffea00027872c8 ffff8880aa4008c0
raw: 0000000000000000 ffff88809e0f5000 0000000100000008 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809e0f5900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809e0f5980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88809e0f5a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88809e0f5a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809e0f5b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


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

* Re: [alsa-devel] KASAN: use-after-free Read in snd_timer_resolution
@ 2020-02-02 12:56   ` syzbot
  0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2020-02-02 12:56 UTC (permalink / raw)
  To: 20200115203733.26530-1-tiwai, alsa-devel-owner, alsa-devel, arnd,
	baolin.wang, gregkh, linux-kernel, perex, stable-commits, stable,
	syzkaller-bugs, tiwai, tiwai

syzbot has found a reproducer for the following crash on:

HEAD commit:    2747d5fd Add linux-next specific files for 20200116
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1147e101e00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=22f506e7a3a37fe2
dashboard link: https://syzkaller.appspot.com/bug?extid=2b2ef983f973e5c40943
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10c0864ee00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14738df1e00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+2b2ef983f973e5c40943@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in snd_timer_resolution+0xf1/0x110 sound/core/timer.c:487
Read of size 8 at addr ffff88809e0f5a00 by task syz-executor911/9849

CPU: 1 PID: 9849 Comm: syz-executor911 Not tainted 5.5.0-rc6-next-20200116-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x197/0x210 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 __kasan_report.cold+0x1b/0x32 mm/kasan/report.c:506
 kasan_report+0x12/0x20 mm/kasan/common.c:641
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
 snd_timer_resolution+0xf1/0x110 sound/core/timer.c:487
 snd_seq_info_timer_read+0x95/0x2f1 sound/core/seq/seq_timer.c:480
 snd_info_seq_show+0xcb/0x120 sound/core/info.c:362
 seq_read+0x4ca/0x1170 fs/seq_file.c:229
 proc_reg_read+0x1f8/0x2b0 fs/proc/inode.c:223
 do_loop_readv_writev fs/read_write.c:714 [inline]
 do_loop_readv_writev fs/read_write.c:701 [inline]
 do_iter_read+0x4a4/0x660 fs/read_write.c:935
 vfs_readv+0xf0/0x160 fs/read_write.c:997
 do_preadv+0x1c4/0x280 fs/read_write.c:1089
 __do_sys_preadv fs/read_write.c:1139 [inline]
 __se_sys_preadv fs/read_write.c:1134 [inline]
 __x64_sys_preadv+0x9a/0xf0 fs/read_write.c:1134
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x441389
Code: e8 ac e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffc8aa7ce38 EFLAGS: 00000246 ORIG_RAX: 0000000000000127
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441389
RDX: 0000000000000227 RSI: 00000000200017c0 RDI: 0000000000000004
RBP: 00007ffc8aa7ce50 R08: 000000000000000f R09: 00000000000000c2
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402100
R13: 0000000000402190 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 9852:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc mm/kasan/common.c:515 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:488
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529
 kmem_cache_alloc_trace+0x158/0x790 mm/slab.c:3551
 kmalloc include/linux/slab.h:555 [inline]
 kzalloc include/linux/slab.h:669 [inline]
 snd_timer_instance_new+0x4a/0x300 sound/core/timer.c:142
 snd_seq_timer_open+0x1c0/0x590 sound/core/seq/seq_timer.c:275
 queue_use+0xf1/0x270 sound/core/seq/seq_queue.c:489
 snd_seq_queue_alloc+0x2c5/0x4d0 sound/core/seq/seq_queue.c:176
 snd_seq_ioctl_create_queue+0xb0/0x330 sound/core/seq/seq_clientmgr.c:1548
 snd_seq_kernel_client_ctl+0xf8/0x140 sound/core/seq/seq_clientmgr.c:2353
 alloc_seq_queue.isra.0+0xdc/0x180 sound/core/seq/oss/seq_oss_init.c:357
 snd_seq_oss_open+0x2ff/0x960 sound/core/seq/oss/seq_oss_init.c:215
 odev_open+0x70/0x90 sound/core/seq/oss/seq_oss.c:125
 soundcore_open+0x453/0x610 sound/sound_core.c:593
 chrdev_open+0x245/0x6b0 fs/char_dev.c:414
 do_dentry_open+0x4ca/0x1350 fs/open.c:797
 vfs_open+0xa0/0xd0 fs/open.c:914
 do_last fs/namei.c:3487 [inline]
 path_openat+0x12fd/0x34d0 fs/namei.c:3604
 do_filp_open+0x192/0x260 fs/namei.c:3634
 do_sys_openat2+0x633/0x840 fs/open.c:1151
 do_sys_open+0xfc/0x190 fs/open.c:1167
 __do_sys_openat fs/open.c:1181 [inline]
 __se_sys_openat fs/open.c:1176 [inline]
 __x64_sys_openat+0x9d/0x100 fs/open.c:1176
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 9852:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 kasan_set_free_info mm/kasan/common.c:337 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:476
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:485
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x10a/0x2c0 mm/slab.c:3757
 snd_timer_instance_free sound/core/timer.c:166 [inline]
 snd_timer_instance_free+0x7c/0xa0 sound/core/timer.c:160
 snd_seq_timer_close+0x99/0xe0 sound/core/seq/seq_timer.c:319
 queue_delete+0x52/0xb0 sound/core/seq/seq_queue.c:134
 snd_seq_queue_delete+0x4e/0x70 sound/core/seq/seq_queue.c:196
 snd_seq_ioctl_delete_queue+0x6a/0x90 sound/core/seq/seq_clientmgr.c:1570
 snd_seq_kernel_client_ctl+0xf8/0x140 sound/core/seq/seq_clientmgr.c:2353
 delete_seq_queue.part.0+0xb6/0x120 sound/core/seq/oss/seq_oss_init.c:376
 delete_seq_queue sound/core/seq/oss/seq_oss_init.c:372 [inline]
 snd_seq_oss_release+0x116/0x150 sound/core/seq/oss/seq_oss_init.c:421
 odev_release+0x54/0x80 sound/core/seq/oss/seq_oss.c:140
 __fput+0x2ff/0x890 fs/file_table.c:280
 ____fput+0x16/0x20 fs/file_table.c:313
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xbcb/0x2f80 kernel/exit.c:801
 do_group_exit+0x135/0x360 kernel/exit.c:899
 __do_sys_exit_group kernel/exit.c:910 [inline]
 __se_sys_exit_group kernel/exit.c:908 [inline]
 __x64_sys_exit_group+0x44/0x50 kernel/exit.c:908
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809e0f5a00
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 0 bytes inside of
 256-byte region [ffff88809e0f5a00, ffff88809e0f5b00)
The buggy address belongs to the page:
page:ffffea0002783d40 refcount:1 mapcount:0 mapping:ffff8880aa4008c0 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea0002783948 ffffea00027872c8 ffff8880aa4008c0
raw: 0000000000000000 ffff88809e0f5000 0000000100000008 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809e0f5900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809e0f5980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88809e0f5a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88809e0f5a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809e0f5b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] KASAN: use-after-free Read in snd_timer_resolution
  2020-01-15 17:16 ` [alsa-devel] " syzbot
  (?)
  (?)
@ 2020-02-03  5:51 ` Hillf Danton
  2020-02-03  6:43     ` [alsa-devel] " Takashi Iwai
  -1 siblings, 1 reply; 7+ messages in thread
From: Hillf Danton @ 2020-02-03  5:51 UTC (permalink / raw)
  To: syzbot
  Cc: alsa-devel, arnd, baolin.wang, tiwai, gregkh, tiwai,
	syzkaller-bugs, linux-kernel, alsa-devel-owner, stable,
	stable-commits, Hillf Danton


Sun, 02 Feb 2020 04:56:10 -0800 (PST)
> syzbot has found a reproducer for the following crash on:
> 
> HEAD commit:    2747d5fd Add linux-next specific files for 20200116
> git tree:       linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=1147e101e00000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=22f506e7a3a37fe2
> dashboard link: https://syzkaller.appspot.com/bug?extid=2b2ef983f973e5c40943
> compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10c0864ee00000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14738df1e00000
> 
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+2b2ef983f973e5c40943@syzkaller.appspotmail.com
> 
> ==================================================================
> BUG: KASAN: use-after-free in snd_timer_resolution+0xf1/0x110 sound/core/timer.c:487
> Read of size 8 at addr ffff88809e0f5a00 by task syz-executor911/9849
> 
> CPU: 1 PID: 9849 Comm: syz-executor911 Not tainted 5.5.0-rc6-next-20200116-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:77 [inline]
>  dump_stack+0x197/0x210 lib/dump_stack.c:118
>  print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
>  __kasan_report.cold+0x1b/0x32 mm/kasan/report.c:506
>  kasan_report+0x12/0x20 mm/kasan/common.c:641
>  __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
>  snd_timer_resolution+0xf1/0x110 sound/core/timer.c:487
>  snd_seq_info_timer_read+0x95/0x2f1 sound/core/seq/seq_timer.c:480
>  snd_info_seq_show+0xcb/0x120 sound/core/info.c:362
>  seq_read+0x4ca/0x1170 fs/seq_file.c:229
>  proc_reg_read+0x1f8/0x2b0 fs/proc/inode.c:223
>  do_loop_readv_writev fs/read_write.c:714 [inline]
>  do_loop_readv_writev fs/read_write.c:701 [inline]
>  do_iter_read+0x4a4/0x660 fs/read_write.c:935
>  vfs_readv+0xf0/0x160 fs/read_write.c:997
>  do_preadv+0x1c4/0x280 fs/read_write.c:1089
>  __do_sys_preadv fs/read_write.c:1139 [inline]
>  __se_sys_preadv fs/read_write.c:1134 [inline]
>  __x64_sys_preadv+0x9a/0xf0 fs/read_write.c:1134
>  do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
> RIP: 0033:0x441389
> Code: e8 ac e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:00007ffc8aa7ce38 EFLAGS: 00000246 ORIG_RAX: 0000000000000127
> RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441389
> RDX: 0000000000000227 RSI: 00000000200017c0 RDI: 0000000000000004
> RBP: 00007ffc8aa7ce50 R08: 000000000000000f R09: 00000000000000c2
> R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402100
> R13: 0000000000402190 R14: 0000000000000000 R15: 0000000000000000
> 
> Allocated by task 9852:
>  save_stack+0x23/0x90 mm/kasan/common.c:72
>  set_track mm/kasan/common.c:80 [inline]
>  __kasan_kmalloc mm/kasan/common.c:515 [inline]
>  __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:488
>  kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529
>  kmem_cache_alloc_trace+0x158/0x790 mm/slab.c:3551
>  kmalloc include/linux/slab.h:555 [inline]
>  kzalloc include/linux/slab.h:669 [inline]
>  snd_timer_instance_new+0x4a/0x300 sound/core/timer.c:142
>  snd_seq_timer_open+0x1c0/0x590 sound/core/seq/seq_timer.c:275
>  queue_use+0xf1/0x270 sound/core/seq/seq_queue.c:489
>  snd_seq_queue_alloc+0x2c5/0x4d0 sound/core/seq/seq_queue.c:176
>  snd_seq_ioctl_create_queue+0xb0/0x330 sound/core/seq/seq_clientmgr.c:1548
>  snd_seq_kernel_client_ctl+0xf8/0x140 sound/core/seq/seq_clientmgr.c:2353
>  alloc_seq_queue.isra.0+0xdc/0x180 sound/core/seq/oss/seq_oss_init.c:357
>  snd_seq_oss_open+0x2ff/0x960 sound/core/seq/oss/seq_oss_init.c:215
>  odev_open+0x70/0x90 sound/core/seq/oss/seq_oss.c:125
>  soundcore_open+0x453/0x610 sound/sound_core.c:593
>  chrdev_open+0x245/0x6b0 fs/char_dev.c:414
>  do_dentry_open+0x4ca/0x1350 fs/open.c:797
>  vfs_open+0xa0/0xd0 fs/open.c:914
>  do_last fs/namei.c:3487 [inline]
>  path_openat+0x12fd/0x34d0 fs/namei.c:3604
>  do_filp_open+0x192/0x260 fs/namei.c:3634
>  do_sys_openat2+0x633/0x840 fs/open.c:1151
>  do_sys_open+0xfc/0x190 fs/open.c:1167
>  __do_sys_openat fs/open.c:1181 [inline]
>  __se_sys_openat fs/open.c:1176 [inline]
>  __x64_sys_openat+0x9d/0x100 fs/open.c:1176
>  do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
> 
> Freed by task 9852:
>  save_stack+0x23/0x90 mm/kasan/common.c:72
>  set_track mm/kasan/common.c:80 [inline]
>  kasan_set_free_info mm/kasan/common.c:337 [inline]
>  __kasan_slab_free+0x102/0x150 mm/kasan/common.c:476
>  kasan_slab_free+0xe/0x10 mm/kasan/common.c:485
>  __cache_free mm/slab.c:3426 [inline]
>  kfree+0x10a/0x2c0 mm/slab.c:3757
>  snd_timer_instance_free sound/core/timer.c:166 [inline]
>  snd_timer_instance_free+0x7c/0xa0 sound/core/timer.c:160
>  snd_seq_timer_close+0x99/0xe0 sound/core/seq/seq_timer.c:319
>  queue_delete+0x52/0xb0 sound/core/seq/seq_queue.c:134
>  snd_seq_queue_delete+0x4e/0x70 sound/core/seq/seq_queue.c:196
>  snd_seq_ioctl_delete_queue+0x6a/0x90 sound/core/seq/seq_clientmgr.c:1570
>  snd_seq_kernel_client_ctl+0xf8/0x140 sound/core/seq/seq_clientmgr.c:2353
>  delete_seq_queue.part.0+0xb6/0x120 sound/core/seq/oss/seq_oss_init.c:376
>  delete_seq_queue sound/core/seq/oss/seq_oss_init.c:372 [inline]
>  snd_seq_oss_release+0x116/0x150 sound/core/seq/oss/seq_oss_init.c:421
>  odev_release+0x54/0x80 sound/core/seq/oss/seq_oss.c:140
>  __fput+0x2ff/0x890 fs/file_table.c:280
>  ____fput+0x16/0x20 fs/file_table.c:313
>  task_work_run+0x145/0x1c0 kernel/task_work.c:113
>  exit_task_work include/linux/task_work.h:22 [inline]
>  do_exit+0xbcb/0x2f80 kernel/exit.c:801
>  do_group_exit+0x135/0x360 kernel/exit.c:899
>  __do_sys_exit_group kernel/exit.c:910 [inline]
>  __se_sys_exit_group kernel/exit.c:908 [inline]
>  __x64_sys_exit_group+0x44/0x50 kernel/exit.c:908
>  do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
> 
> The buggy address belongs to the object at ffff88809e0f5a00
>  which belongs to the cache kmalloc-256 of size 256
> The buggy address is located 0 bytes inside of
>  256-byte region [ffff88809e0f5a00, ffff88809e0f5b00)
> The buggy address belongs to the page:
> page:ffffea0002783d40 refcount:1 mapcount:0 mapping:ffff8880aa4008c0 index:0x0
> flags: 0xfffe0000000200(slab)
> raw: 00fffe0000000200 ffffea0002783948 ffffea00027872c8 ffff8880aa4008c0
> raw: 0000000000000000 ffff88809e0f5000 0000000100000008 0000000000000000
> page dumped because: kasan: bad access detected
> 
> Memory state around the buggy address:
>  ffff88809e0f5900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>  ffff88809e0f5980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> >ffff88809e0f5a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>                    ^
>  ffff88809e0f5a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>  ffff88809e0f5b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ==================================================================

Release resources after all users of queue go home.

--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -128,13 +128,15 @@ static struct snd_seq_queue *queue_new(i
 /* delete queue (destructor) */
 static void queue_delete(struct snd_seq_queue *q)
 {
+	/* wait until access free */
+	snd_use_lock_sync(&q->use_lock);
+
 	/* stop and release the timer */
 	mutex_lock(&q->timer_mutex);
 	snd_seq_timer_stop(q->timer);
 	snd_seq_timer_close(q);
 	mutex_unlock(&q->timer_mutex);
-	/* wait until access free */
-	snd_use_lock_sync(&q->use_lock);
+
 	/* release resources... */
 	snd_seq_prioq_delete(&q->tickq);
 	snd_seq_prioq_delete(&q->timeq);

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: KASAN: use-after-free Read in snd_timer_resolution
  2020-02-03  5:51 ` Hillf Danton
@ 2020-02-03  6:43     ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2020-02-03  6:43 UTC (permalink / raw)
  To: Hillf Danton
  Cc: syzbot, alsa-devel-owner, alsa-devel, arnd, baolin.wang, gregkh,
	linux-kernel, perex, stable-commits, stable, syzkaller-bugs,
	tiwai

On Mon, 03 Feb 2020 06:51:22 +0100,
Hillf Danton wrote:
> 
> 
> Sun, 02 Feb 2020 04:56:10 -0800 (PST)
> > syzbot has found a reproducer for the following crash on:
> > 
> > HEAD commit:    2747d5fd Add linux-next specific files for 20200116

This looks like a fairly old head, and missing the fix that is already
included in 5.5 release:
60adcfde92fa40fcb2dbf7cc52f9b096e0cd109a
    ALSA: seq: Fix racy access for queue timer in proc read
    

thanks,

Takashi

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

* Re: [alsa-devel] KASAN: use-after-free Read in snd_timer_resolution
@ 2020-02-03  6:43     ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2020-02-03  6:43 UTC (permalink / raw)
  To: Hillf Danton
  Cc: alsa-devel, arnd, baolin.wang, gregkh, tiwai, syzkaller-bugs,
	linux-kernel, alsa-devel-owner, stable, stable-commits, syzbot

On Mon, 03 Feb 2020 06:51:22 +0100,
Hillf Danton wrote:
> 
> 
> Sun, 02 Feb 2020 04:56:10 -0800 (PST)
> > syzbot has found a reproducer for the following crash on:
> > 
> > HEAD commit:    2747d5fd Add linux-next specific files for 20200116

This looks like a fairly old head, and missing the fix that is already
included in 5.5 release:
60adcfde92fa40fcb2dbf7cc52f9b096e0cd109a
    ALSA: seq: Fix racy access for queue timer in proc read
    

thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

end of thread, other threads:[~2020-02-05 17:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 17:16 KASAN: use-after-free Read in snd_timer_resolution syzbot
2020-01-15 17:16 ` [alsa-devel] " syzbot
2020-02-02 12:56 ` syzbot
2020-02-02 12:56   ` [alsa-devel] " syzbot
2020-02-03  5:51 ` Hillf Danton
2020-02-03  6:43   ` Takashi Iwai
2020-02-03  6:43     ` [alsa-devel] " Takashi Iwai

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.