syzbot


KASAN: use-after-free Read in snd_seq_ioctl_get_client_pool

Status: fixed on 2019/09/06 20:45
Subsystems: sound
[Documentation on labels]
Reported-by: syzbot+4a75454b9ca2777f35c7@syzkaller.appspotmail.com
Fix commit: 75545304eba6 ALSA: seq: Fix potential concurrent access to the deleted pool
First crash: 1711d, last: 1711d
Discussions (7)
Title Replies (including bot) Last reply
[PATCH 3.16 00/83] 3.16.78-rc1 review 88 (88) 2019/11/21 21:42
[PATCH 4.19 00/93] 4.19.70-stable review 102 (102) 2019/09/06 13:54
[PATCH 4.4 00/77] 4.4.191-stable review 87 (87) 2019/09/06 10:59
[PATCH 5.2 000/143] 5.2.12-stable review 157 (157) 2019/09/06 08:16
[PATCH 4.14 00/57] 4.14.142-stable review 66 (66) 2019/09/06 07:36
[PATCH 4.9 00/83] 4.9.191-stable review 94 (94) 2019/09/06 07:36
KASAN: use-after-free Read in snd_seq_ioctl_get_client_pool 0 (1) 2019/08/22 14:53

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
BUG: KASAN: use-after-free in snd_seq_unused_cells sound/core/seq/seq_memory.h:60 [inline]
BUG: KASAN: use-after-free in snd_seq_ioctl_get_client_pool+0x2e0/0x680 sound/core/seq/seq_clientmgr.c:1839
Read of size 4 at addr ffff8880a8e27b14 by task syz-executor.5/31741

CPU: 0 PID: 31741 Comm: syz-executor.5 Not tainted 5.3.0-rc5 #82
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+0x1d8/0x2f8 lib/dump_stack.c:113
 print_address_description+0x75/0x5b0 mm/kasan/report.c:351
 __kasan_report+0x14b/0x1c0 mm/kasan/report.c:482
 kasan_report+0x26/0x50 mm/kasan/common.c:612
 check_memory_region_inline mm/kasan/generic.c:182 [inline]
 check_memory_region+0x2cf/0x2e0 mm/kasan/generic.c:192
 __kasan_check_read+0x11/0x20 mm/kasan/common.c:92
 atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
 snd_seq_unused_cells sound/core/seq/seq_memory.h:60 [inline]
 snd_seq_ioctl_get_client_pool+0x2e0/0x680 sound/core/seq/seq_clientmgr.c:1839
 snd_seq_ioctl+0x1d1/0x340 sound/core/seq/seq_clientmgr.c:2158
 do_vfs_ioctl+0x744/0x1730 fs/ioctl.c:46
 ksys_ioctl fs/ioctl.c:713 [inline]
 __do_sys_ioctl fs/ioctl.c:720 [inline]
 __se_sys_ioctl fs/ioctl.c:718 [inline]
 __x64_sys_ioctl+0xe3/0x120 fs/ioctl.c:718
 do_syscall_64+0xfe/0x140 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459829
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007faf5e0c4c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459829
RDX: 00000000200003c0 RSI: 00000000c058534b RDI: 0000000000000003
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007faf5e0c56d4
R13: 00000000004cdc18 R14: 00000000004d7ba8 R15: 00000000ffffffff

Allocated by task 31737:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc+0x11c/0x1b0 mm/kasan/common.c:487
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:501
 kmem_cache_alloc_trace+0x221/0x2f0 mm/slab.c:3550
 kmalloc include/linux/slab.h:552 [inline]
 kzalloc include/linux/slab.h:748 [inline]
 snd_seq_pool_new+0x53/0x1b0 sound/core/seq/seq_memory.c:459
 snd_seq_fifo_new+0x72/0x1c0 sound/core/seq/seq_fifo.c:26
 snd_seq_open+0x1e4/0x470 sound/core/seq/seq_clientmgr.c:350
 snd_open+0x313/0x380 sound/core/sound.c:163
 chrdev_open+0x509/0x590 fs/char_dev.c:414
 do_dentry_open+0x73b/0xf90 fs/open.c:797
 vfs_open+0x73/0x80 fs/open.c:906
 do_last fs/namei.c:3416 [inline]
 path_openat+0x1397/0x4460 fs/namei.c:3533
 do_filp_open+0x192/0x3d0 fs/namei.c:3563
 do_sys_open+0x29f/0x560 fs/open.c:1089
 __do_sys_open fs/open.c:1107 [inline]
 __se_sys_open fs/open.c:1102 [inline]
 __x64_sys_open+0x87/0x90 fs/open.c:1102
 do_syscall_64+0xfe/0x140 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 31737:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 __kasan_slab_free+0x12a/0x1e0 mm/kasan/common.c:449
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:457
 __cache_free mm/slab.c:3425 [inline]
 kfree+0x115/0x200 mm/slab.c:3756
 snd_seq_pool_delete+0x9e/0xd0 sound/core/seq/seq_memory.c:487
 snd_seq_fifo_resize+0x1de/0x250 sound/core/seq/seq_fifo.c:262
 snd_seq_ioctl_set_client_pool+0x3c4/0x740 sound/core/seq/seq_clientmgr.c:1880
 snd_seq_ioctl+0x1d1/0x340 sound/core/seq/seq_clientmgr.c:2158
 do_vfs_ioctl+0x744/0x1730 fs/ioctl.c:46
 ksys_ioctl fs/ioctl.c:713 [inline]
 __do_sys_ioctl fs/ioctl.c:720 [inline]
 __se_sys_ioctl fs/ioctl.c:718 [inline]
 __x64_sys_ioctl+0xe3/0x120 fs/ioctl.c:718
 do_syscall_64+0xfe/0x140 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a8e27b00
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 20 bytes inside of
 192-byte region [ffff8880a8e27b00, ffff8880a8e27bc0)
The buggy address belongs to the page:
page:ffffea0002a389c0 refcount:1 mapcount:0 mapping:ffff8880aa400000 index:0x0
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea00026d1008 ffffea0002870048 ffff8880aa400000
raw: 0000000000000000 ffff8880a8e27000 0000000100000010 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a8e27a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a8e27a80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880a8e27b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff8880a8e27b80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880a8e27c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/08/19 21:56 upstream d1abaeb3be7b ee12860b .config console log report ci-upstream-kasan-gce-smack-root
* Struck through repros no longer work on HEAD.