syzbot


KASAN: double-free or invalid-free in 0x2

Status: fixed on 2020/09/01 18:34
Reported-by: syzbot+19f4fe2052e66ee13a6a@syzkaller.appspotmail.com
Fix commit: ccafbed8b2f6 ALSA: seq: oss: Serialize ioctls
First crash: 1378d, last: 1378d
Fix bisection: fixed by (bisect log) :
commit ccafbed8b2f6a9d9298534b39e76da9cb40ff717
Author: Takashi Iwai <tiwai@suse.de>
Date: Tue Aug 4 18:58:15 2020 +0000

  ALSA: seq: oss: Serialize ioctls

  

Sample crash report:
==================================================================
BUG: KASAN: double-free or invalid-free in 0x2

CPU: 1 PID: 15604 Comm: syz-executor.0 Not tainted 4.14.190-syzkaller #0
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+0x1b2/0x283 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_double_free+0x51/0x80 mm/kasan/report.c:333
 kasan_slab_free+0x16f/0x1a0 mm/kasan/kasan.c:514
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xc9/0x250 mm/slab.c:3815
 snd_seq_port_disconnect+0x3f1/0x500 sound/core/seq/seq_ports.c:632
 snd_seq_ioctl_unsubscribe_port+0x1d4/0x370 sound/core/seq/seq_clientmgr.c:1505
 snd_seq_kernel_client_ctl+0xcb/0x110 sound/core/seq/seq_clientmgr.c:2360
 snd_seq_oss_midi_close+0x29c/0x400 sound/core/seq/oss/seq_oss_midi.c:418
 snd_seq_oss_synth_reset+0x39d/0x830 sound/core/seq/oss/seq_oss_synth.c:419
 snd_seq_oss_reset+0x64/0x250 sound/core/seq/oss/seq_oss_init.c:448
 snd_seq_oss_ioctl+0x9a5/0xc30 sound/core/seq/oss/seq_oss_ioctl.c:106
 odev_ioctl+0x4f/0x90 sound/core/seq/oss/seq_oss.c:187
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x45c429
RSP: 002b:00007f201b4d0c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000000154c0 RCX: 000000000045c429
RDX: 0000000000000000 RSI: 0000000000005100 RDI: 0000000000000003
RBP: 000000000078bf38 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000078bf0c
R13: 00007ffd8c30f55f R14: 00007f201b4d19c0 R15: 000000000078bf0c

Allocated by task 15604:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618
 kmalloc include/linux/slab.h:488 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 snd_seq_port_connect+0x5d/0x4d0 sound/core/seq/seq_ports.c:571
 snd_seq_ioctl_subscribe_port+0x1d4/0x370 sound/core/seq/seq_clientmgr.c:1464
 snd_seq_kernel_client_ctl+0xcb/0x110 sound/core/seq/seq_clientmgr.c:2360
 snd_seq_oss_midi_open+0x485/0x590 sound/core/seq/oss/seq_oss_midi.c:377
 snd_seq_oss_synth_setup_midi+0x104/0x4d0 sound/core/seq/oss/seq_oss_synth.c:282
 snd_seq_oss_open+0x7a0/0x920 sound/core/seq/oss/seq_oss_init.c:274
 odev_open+0x62/0x80 sound/core/seq/oss/seq_oss.c:138
 soundcore_open+0x3ee/0x5a0 sound/sound_core.c:640
 chrdev_open+0x23c/0x6d0 fs/char_dev.c:423
 do_dentry_open+0x44b/0xec0 fs/open.c:777
 vfs_open+0x105/0x220 fs/open.c:888
 do_last fs/namei.c:3428 [inline]
 path_openat+0x628/0x2970 fs/namei.c:3569
 do_filp_open+0x179/0x3c0 fs/namei.c:3603
 do_sys_open+0x296/0x410 fs/open.c:1081
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 15605:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xc9/0x250 mm/slab.c:3815
 snd_seq_port_disconnect+0x3f1/0x500 sound/core/seq/seq_ports.c:632
 snd_seq_ioctl_unsubscribe_port+0x1d4/0x370 sound/core/seq/seq_clientmgr.c:1505
 snd_seq_kernel_client_ctl+0xcb/0x110 sound/core/seq/seq_clientmgr.c:2360
 snd_seq_oss_midi_close+0x29c/0x400 sound/core/seq/oss/seq_oss_midi.c:418
 snd_seq_oss_synth_reset+0x39d/0x830 sound/core/seq/oss/seq_oss_synth.c:419
 snd_seq_oss_reset+0x64/0x250 sound/core/seq/oss/seq_oss_init.c:448
 snd_seq_oss_ioctl+0x9a5/0xc30 sound/core/seq/oss/seq_oss_ioctl.c:106
 odev_ioctl+0x4f/0x90 sound/core/seq/oss/seq_oss.c:187
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880a012f6c0
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 0 bytes inside of
 128-byte region [ffff8880a012f6c0, ffff8880a012f740)
The buggy address belongs to the page:
page:ffffea0002804bc0 count:1 mapcount:0 mapping:ffff8880a012f000 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff8880a012f000 0000000000000000 0000000100000015
raw: ffffea000282f1a0 ffffea000235b2a0 ffff88812fe52640 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a012f580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880a012f600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a012f680: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                           ^
 ffff8880a012f700: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880a012f780: 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
2020/07/30 08:59 linux-4.14.y e5a54aa2d312 233283a1 .config console log report syz ci2-linux-4-14
* Struck through repros no longer work on HEAD.