syzbot


KASAN: use-after-free Read in snd_timer_open

Status: fixed on 2019/12/13 00:31
Subsystems: sound
[Documentation on labels]
Reported-by: syzbot+4476917c053f60112c99@syzkaller.appspotmail.com
Fix commit: 0c4f09ceec3d ALSA: timer: Fix the breakage of slave link open
First crash: 1718d, last: 1717d
Cause bisection: introduced by (bisect log) :
commit 6a34367e52caea1413eb0a0dcbb524f0c9b67e82
Author: Takashi Iwai <tiwai@suse.de>
Date: Thu Nov 7 19:20:08 2019 +0000

  ALSA: timer: Fix possible race at assigning a timer instance

Crash: KASAN: use-after-free Read in snd_timer_open (log)
Repro: C syz .config
  
Duplicate bugs (3)
duplicates (3):
Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
KASAN: use-after-free Read in check_matching_master_slave sound 1 1718d 1717d 0/27 closed as dup on 2019/11/22 10:55
general protection fault in snd_timer_open sound 1 1718d 1717d 0/27 closed as dup on 2019/11/11 17:38
KASAN: use-after-free Read in snd_timer_close_locked sound 6 1718d 1717d 0/27 closed as dup on 2019/11/11 17:38
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in snd_timer_open 0 (2) 2019/11/11 23:45

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_add_valid+0x9a/0xa0 lib/list_debug.c:26
Read of size 8 at addr ffff88809fda1478 by task syz-executor450/8934

CPU: 0 PID: 8934 Comm: syz-executor450 Not tainted 5.4.0-rc6-next-20191111 #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:634
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
 __list_add_valid+0x9a/0xa0 lib/list_debug.c:26
 __list_add include/linux/list.h:60 [inline]
 list_add_tail include/linux/list.h:93 [inline]
 snd_timer_open+0x245/0x1150 sound/core/timer.c:268
 snd_timer_user_tselect sound/core/timer.c:1738 [inline]
 __snd_timer_user_ioctl.isra.0+0x7ed/0x2070 sound/core/timer.c:2008
 snd_timer_user_ioctl+0x7a/0xa7 sound/core/timer.c:2038
 vfs_ioctl fs/ioctl.c:47 [inline]
 file_ioctl fs/ioctl.c:545 [inline]
 do_vfs_ioctl+0x977/0x14e0 fs/ioctl.c:732
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:749
 __do_sys_ioctl fs/ioctl.c:756 [inline]
 __se_sys_ioctl fs/ioctl.c:754 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:754
 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x444f39
Code: e8 fc ab 02 00 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 bb cd fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffdcbff56d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000444f39
RDX: 0000000020029fcc RSI: 0000000040345410 RDI: 0000000000000003
RBP: 0000000000010a27 R08: 0000000000000004 R09: 00000000004002e0
R10: 000000000000000f R11: 0000000000000246 R12: 0000000000402180
R13: 0000000000402210 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 8933:
 save_stack+0x23/0x90 mm/kasan/common.c:69
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc mm/kasan/common.c:510 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:483
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:524
 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_timer_user_tselect sound/core/timer.c:1725 [inline]
 __snd_timer_user_ioctl.isra.0+0x665/0x2070 sound/core/timer.c:2008
 snd_timer_user_ioctl+0x7a/0xa7 sound/core/timer.c:2038
 vfs_ioctl fs/ioctl.c:47 [inline]
 file_ioctl fs/ioctl.c:545 [inline]
 do_vfs_ioctl+0x977/0x14e0 fs/ioctl.c:732
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:749
 __do_sys_ioctl fs/ioctl.c:756 [inline]
 __se_sys_ioctl fs/ioctl.c:754 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:754
 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8933:
 save_stack+0x23/0x90 mm/kasan/common.c:69
 set_track mm/kasan/common.c:77 [inline]
 kasan_set_free_info mm/kasan/common.c:332 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:471
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:480
 __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_timer_user_tselect sound/core/timer.c:1740 [inline]
 __snd_timer_user_ioctl.isra.0+0x160d/0x2070 sound/core/timer.c:2008
 snd_timer_user_ioctl+0x7a/0xa7 sound/core/timer.c:2038
 vfs_ioctl fs/ioctl.c:47 [inline]
 file_ioctl fs/ioctl.c:545 [inline]
 do_vfs_ioctl+0x977/0x14e0 fs/ioctl.c:732
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:749
 __do_sys_ioctl fs/ioctl.c:756 [inline]
 __se_sys_ioctl fs/ioctl.c:754 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:754
 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809fda1400
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 120 bytes inside of
 256-byte region [ffff88809fda1400, ffff88809fda1500)
The buggy address belongs to the page:
page:ffffea00027f6840 refcount:1 mapcount:0 mapping:ffff8880aa4008c0 index:0xffff88809fda1800
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea0002a96a08 ffff8880aa401638 ffff8880aa4008c0
raw: ffff88809fda1800 ffff88809fda1000 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809fda1300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809fda1380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88809fda1400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                                ^
 ffff88809fda1480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809fda1500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (87):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/11 16:43 linux-next 6980b7f6f9db dc438b91 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/11/11 16:24 linux-next 6980b7f6f9db dc438b91 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/11/11 16:02 linux-next 6980b7f6f9db dc438b91 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/11/11 15:40 linux-next 6980b7f6f9db dc438b91 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/11/12 06:59 linux-next 6980b7f6f9db 048f2d49 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/12 05:57 linux-next 6980b7f6f9db 048f2d49 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/12 03:42 linux-next 6980b7f6f9db 048f2d49 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/12 01:57 linux-next 6980b7f6f9db 048f2d49 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/12 00:57 linux-next 6980b7f6f9db 048f2d49 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 22:48 linux-next 6980b7f6f9db 048f2d49 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 20:01 linux-next 6980b7f6f9db 048f2d49 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 15:04 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 13:40 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 13:39 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 13:33 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 13:33 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 13:18 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 13:18 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 13:09 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 13:00 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 12:50 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 12:44 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 12:18 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 11:36 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 11:33 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 11:31 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 11:27 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 11:26 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 11:15 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 11:12 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 11:08 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 10:56 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 10:49 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 10:48 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 10:28 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 10:12 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 09:48 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 09:45 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 09:40 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 09:37 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 09:34 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 09:29 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 09:23 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 09:23 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 09:23 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 09:10 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/11 09:08 linux-next 6980b7f6f9db dc438b91 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.