bisecting fixing commit since 6dd0e32665e591e9debe3edaf73c2f8135bf047e building syzkaller on 3f3c557402456696073f79aafa65b4d7fa2b8794 testing commit 6dd0e32665e591e9debe3edaf73c2f8135bf047e with gcc (GCC) 8.1.0 kernel signature: 851186fa2fc427991e182b2e7a3b5c0593df070f18f5a1f79a9ffea034568a5d run #0: crashed: KASAN: slab-out-of-bounds Write in snd_rawmidi_kernel_write1 run #1: crashed: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 run #2: crashed: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 run #3: crashed: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 run #4: crashed: KASAN: slab-out-of-bounds Write in snd_rawmidi_kernel_write1 run #5: crashed: KASAN: slab-out-of-bounds Write in snd_rawmidi_kernel_write1 run #6: crashed: KASAN: slab-out-of-bounds Write in snd_rawmidi_kernel_write1 run #7: crashed: KASAN: slab-out-of-bounds Write in snd_rawmidi_kernel_write1 run #8: crashed: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 run #9: crashed: KASAN: slab-out-of-bounds Write in snd_rawmidi_kernel_write1 testing current HEAD 258f0cf7ac3b788a14c0d01aab3c4aea02f8c86e testing commit 258f0cf7ac3b788a14c0d01aab3c4aea02f8c86e with gcc (GCC) 8.1.0 kernel signature: c850ba9bd87581e77025d73940a6d82d2634f0f2f5431609168c16ca38578324 run #0: crashed: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 run #1: crashed: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 run #2: crashed: KASAN: slab-out-of-bounds Write in snd_rawmidi_kernel_write1 run #3: crashed: KASAN: slab-out-of-bounds Write in snd_rawmidi_kernel_write1 run #4: crashed: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 run #5: crashed: KASAN: slab-out-of-bounds Write in snd_rawmidi_kernel_write1 run #6: crashed: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 run #7: crashed: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 run #8: crashed: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 run #9: crashed: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 revisions tested: 2, total time: 41m5.710928262s (build: 19m51.89040579s, test: 19m55.388493649s) the crash still happens on HEAD commit msg: Linux 4.19.123 crash: KASAN: use-after-free Write in snd_rawmidi_kernel_write1 bond0 (unregistering): Releasing backup interface bond_slave_1 bond0 (unregistering): Releasing backup interface bond_slave_0 bond0 (unregistering): Released all slaves ================================================================== BUG: KASAN: use-after-free in _copy_from_user+0x8e/0xd0 lib/usercopy.c:12 Write of size 32 at addr ffff88806f7ee560 by task syz-executor489/26413 CPU: 0 PID: 26413 Comm: syz-executor489 Not tainted 4.19.123-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+0x123/0x177 lib/dump_stack.c:118 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412 check_memory_region_inline mm/kasan/kasan.c:260 [inline] check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267 kasan_check_write+0x14/0x20 mm/kasan/kasan.c:278 _copy_from_user+0x8e/0xd0 lib/usercopy.c:12 copy_from_user include/linux/uaccess.h:147 [inline] snd_rawmidi_kernel_write1+0x2a0/0x5d0 sound/core/rawmidi.c:1282 snd_rawmidi_write+0x271/0xaa0 sound/core/rawmidi.c:1348 __vfs_write+0xe3/0x890 fs/read_write.c:485 vfs_write+0x150/0x4d0 fs/read_write.c:549 ksys_write+0x103/0x260 fs/read_write.c:599 __do_sys_write fs/read_write.c:611 [inline] __se_sys_write fs/read_write.c:608 [inline] __x64_sys_write+0x6e/0xb0 fs/read_write.c:608 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x44a3e9 Code: e8 5c b3 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 2b cc fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007fcd45a0ddb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 000000000044a3e9 RDX: 0000000020000339 RSI: 00000000200001c0 RDI: 0000000000000003 RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c R13: 00007ffc3002ea7f R14: 00007fcd45a0e9c0 R15: 20c49ba5e353f7cf Allocated by task 26413: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553 __do_kmalloc_node mm/slab.c:3689 [inline] __kmalloc_node+0x50/0x70 mm/slab.c:3696 kmalloc_node include/linux/slab.h:557 [inline] kvmalloc_node+0x68/0x70 mm/util.c:423 kvmalloc include/linux/mm.h:577 [inline] kvzalloc include/linux/mm.h:585 [inline] snd_rawmidi_runtime_create sound/core/rawmidi.c:133 [inline] open_substream+0x2e5/0x770 sound/core/rawmidi.c:277 rawmidi_open_priv+0x3fe/0x750 sound/core/rawmidi.c:328 snd_rawmidi_open+0x4d3/0xa20 sound/core/rawmidi.c:425 snd_open+0x1d3/0x37c sound/core/sound.c:175 chrdev_open+0x1ed/0x5c0 fs/char_dev.c:423 do_dentry_open+0x3f1/0x1010 fs/open.c:796 vfs_open+0x9a/0xc0 fs/open.c:902 do_last fs/namei.c:3421 [inline] path_openat+0x6fa/0x3c60 fs/namei.c:3537 do_filp_open+0x177/0x250 fs/namei.c:3567 do_sys_open+0x1dd/0x350 fs/open.c:1085 __do_sys_open fs/open.c:1103 [inline] __se_sys_open fs/open.c:1098 [inline] __x64_sys_open+0x79/0xb0 fs/open.c:1098 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 26416: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3503 [inline] kfree+0xcf/0x220 mm/slab.c:3822 kvfree+0x2c/0x30 mm/util.c:452 resize_runtime_buffer+0x236/0x360 sound/core/rawmidi.c:669 snd_rawmidi_output_params+0xff/0x140 sound/core/rawmidi.c:682 snd_rawmidi_ioctl+0x49e/0x5a0 sound/core/rawmidi.c:759 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0x196/0x10c0 fs/ioctl.c:688 ksys_ioctl+0x62/0x90 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6e/0xb0 fs/ioctl.c:710 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff88806f7ee300 which belongs to the cache kmalloc-4096 of size 4096 The buggy address is located 608 bytes inside of 4096-byte region [ffff88806f7ee300, ffff88806f7ef300) The buggy address belongs to the page: page:ffffea0001bdfb80 count:1 mapcount:0 mapping:ffff88812c29cdc0 index:0x0 compound_mapcount: 0 flags: 0xfffe0000008100(slab|head) raw: 00fffe0000008100 ffffea0001c96e08 ffffea0002353d08 ffff88812c29cdc0 raw: 0000000000000000 ffff88806f7ee300 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88806f7ee400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806f7ee480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88806f7ee500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806f7ee580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806f7ee600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================