input: syz1 as /devices/virtual/input/input19 ================================================================== BUG: KASAN: use-after-free in disk_unblock_events+0x55/0x60 block/genhd.c:1543 Read of size 8 at addr ffff8801d7693868 by task blkid/7238 CPU: 0 PID: 7238 Comm: blkid Not tainted 4.4.174+ #17 0000000000000000 a75640fc0e8c75c0 ffff8800a1b7f730 ffffffff81aad1a1 0000000000000000 ffffea00075da400 ffff8801d7693868 0000000000000008 0000000000000000 ffff8800a1b7f768 ffffffff81490120 0000000000000000 Call Trace: [] __dump_stack lib/dump_stack.c:15 [inline] [] dump_stack+0xc1/0x120 lib/dump_stack.c:51 [] print_address_description+0x6f/0x21b mm/kasan/report.c:252 [] kasan_report_error mm/kasan/report.c:351 [inline] [] kasan_report mm/kasan/report.c:408 [inline] [] kasan_report.cold+0x8c/0x2be mm/kasan/report.c:393 [] __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:429 [] disk_unblock_events+0x55/0x60 block/genhd.c:1543 [] __blkdev_get+0x70c/0xdf0 fs/block_dev.c:1297 [] blkdev_get+0x2e8/0x920 fs/block_dev.c:1353 [] blkdev_open+0x1aa/0x250 fs/block_dev.c:1508 [] do_dentry_open+0x38f/0xbd0 fs/open.c:749 [] vfs_open+0x10b/0x210 fs/open.c:862 [] do_last fs/namei.c:3269 [inline] [] path_openat+0x136f/0x4470 fs/namei.c:3406 [] do_filp_open+0x1a1/0x270 fs/namei.c:3440 [] do_sys_open+0x2f8/0x600 fs/open.c:1038 [] SYSC_open fs/open.c:1056 [inline] [] SyS_open+0x2d/0x40 fs/open.c:1051 [] entry_SYSCALL_64_fastpath+0x1e/0x9a Allocated by task 7230: [] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63 [] save_stack mm/kasan/kasan.c:512 [inline] [] set_track mm/kasan/kasan.c:524 [inline] [] kasan_kmalloc.part.0+0x62/0xf0 mm/kasan/kasan.c:616 [] kasan_kmalloc+0xb7/0xd0 mm/kasan/kasan.c:601 [] kmem_cache_alloc_trace+0x123/0x2d0 mm/slub.c:2642 [] kmem_cache_alloc_node_trace include/linux/slab.h:367 [inline] [] kmalloc_node include/linux/slab.h:514 [inline] [] kzalloc_node include/linux/slab.h:631 [inline] [] alloc_disk_node+0x50/0x3c0 block/genhd.c:1282 [] alloc_disk+0x1b/0x20 block/genhd.c:1274 [] loop_add+0x380/0x830 drivers/block/loop.c:1857 [] loop_probe+0x154/0x180 drivers/block/loop.c:1963 [] kobj_lookup+0x221/0x410 drivers/base/map.c:124 [] get_gendisk+0x3c/0x2e0 block/genhd.c:689 [] __blkdev_get+0x39c/0xdf0 fs/block_dev.c:1193 [] blkdev_get+0x2e8/0x920 fs/block_dev.c:1353 [] blkdev_open+0x1aa/0x250 fs/block_dev.c:1508 [] do_dentry_open+0x38f/0xbd0 fs/open.c:749 [] vfs_open+0x10b/0x210 fs/open.c:862 [] do_last fs/namei.c:3269 [inline] [] path_openat+0x136f/0x4470 fs/namei.c:3406 [] do_filp_open+0x1a1/0x270 fs/namei.c:3440 [] do_sys_open+0x2f8/0x600 fs/open.c:1038 [] C_SYSC_open fs/compat.c:1092 [inline] [] compat_SyS_open+0x2a/0x40 fs/compat.c:1090 [] do_syscall_32_irqs_on arch/x86/entry/common.c:330 [inline] [] do_fast_syscall_32+0x32d/0xa90 arch/x86/entry/common.c:397 [] sysenter_flags_fixed+0xd/0x1a Freed by task 7238: [] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63 [] save_stack mm/kasan/kasan.c:512 [inline] [] set_track mm/kasan/kasan.c:524 [inline] [] kasan_slab_free+0xb0/0x190 mm/kasan/kasan.c:589 [] slab_free_hook mm/slub.c:1383 [inline] [] slab_free_freelist_hook mm/slub.c:1405 [inline] [] slab_free mm/slub.c:2859 [inline] [] kfree+0xf4/0x310 mm/slub.c:3749 [] disk_release+0x255/0x330 block/genhd.c:1118 [] device_release+0x7d/0x220 drivers/base/core.c:247 [] kobject_cleanup lib/kobject.c:643 [inline] [] kobject_release lib/kobject.c:672 [inline] [] kref_sub include/linux/kref.h:73 [inline] [] kref_put include/linux/kref.h:98 [inline] [] kobject_put+0x14c/0x260 lib/kobject.c:689 [] put_disk+0x23/0x30 block/genhd.c:1346 [] __blkdev_get+0x66c/0xdf0 fs/block_dev.c:1290 [] blkdev_get+0x2e8/0x920 fs/block_dev.c:1353 [] blkdev_open+0x1aa/0x250 fs/block_dev.c:1508 [] do_dentry_open+0x38f/0xbd0 fs/open.c:749 [] vfs_open+0x10b/0x210 fs/open.c:862 [] do_last fs/namei.c:3269 [inline] [] path_openat+0x136f/0x4470 fs/namei.c:3406 [] do_filp_open+0x1a1/0x270 fs/namei.c:3440 [] do_sys_open+0x2f8/0x600 fs/open.c:1038 [] SYSC_open fs/open.c:1056 [inline] [] SyS_open+0x2d/0x40 fs/open.c:1051 [] entry_SYSCALL_64_fastpath+0x1e/0x9a The buggy address belongs to the object at ffff8801d7693300 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1384 bytes inside of 2048-byte region [ffff8801d7693300, ffff8801d7693b00) The buggy address belongs to the page: audit: type=1400 audit(1552738910.987:27): avc: denied { sigchld } for pid=2130 comm="syz-executor.4" scontext=system_u:object_r:unlabeled_t:s0 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=process permissive=1 kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory accessgeneral protection fault: 0000 [#1] PREEMPT SMP KASAN Modules linked in: CPU: 1 PID: 2126 Comm: syz-executor.2 Not tainted 4.4.174+ #17 task: ffff8801d4bb17c0 task.stack: ffff8801c15d8000 RIP: 0010:[] [] __debug_check_no_obj_freed lib/debugobjects.c:692 [inline] RIP: 0010:[] [] debug_check_no_obj_freed+0x18c/0x6e0 lib/debugobjects.c:729 RSP: 0018:ffff8801c15df878 EFLAGS: 00010006 RAX: 0000000000000003 RBX: 2e66c35d5d415c41 RCX: 000000000000acaa RDX: 05ccd86baba82b88 RSI: ffff8801c15df8f0 RDI: ffffffff8142ac68 RBP: ffff8801c15df958 R08: 0000000000000286 R09: ffff8801d4bb20a8 R10: ffffffff83a4e480 R11: 0000000000000000 R12: dffffc0000000000 R13: ffffff78858d48f7 R14: ffffffff840fa248 R15: 2e66c35d5d415c41 FS: 0000000000000000(0000) GS:ffff8801db700000(0000) knlGS:0000000000000000 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 000000008142ac16 CR3: 0000000002e0a000 CR4: 00000000001606b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Stack: ffff8801d4bb2080 ffff8801d4bb20a8 ffff8801c81bc000 ffff8801c81bc000 ffffffff83aa1530 ffff8801d4bb2088 fffffbfff081f448 1ffff100382bbf1a ffffffff840fa240 ffff8801c81bb000 ffff8801c81bb000 0000000041b58ab3 Call Trace: [] free_pages_prepare+0x505/0x9c0 mm/page_alloc.c:1049 [] free_hot_cold_page+0x40/0x580 mm/page_alloc.c:2112 [] free_hot_cold_page_list+0xa2/0x3c0 mm/page_alloc.c:2160 [] release_pages+0x158/0x680 mm/swap.c:970 [] free_pages_and_swap_cache+0x102/0x140 mm/swap_state.c:266 [] tlb_flush_mmu_free+0x46/0x110 mm/memory.c:255 [] tlb_flush_mmu mm/memory.c:264 [inline] [] tlb_finish_mmu+0x23/0xb0 mm/memory.c:275 [] exit_mmap+0x1f5/0x3a0 mm/mmap.c:2964 [] __mmput kernel/fork.c:717 [inline] [] mmput kernel/fork.c:737 [inline] [] mmput+0xde/0x360 kernel/fork.c:732 [] exit_mm kernel/exit.c:440 [inline] [] do_exit+0x7ee/0x2c60 kernel/exit.c:750 [] do_group_exit+0x111/0x300 kernel/exit.c:893 [] SYSC_exit_group kernel/exit.c:904 [inline] [] SyS_exit_group+0x1d/0x20 kernel/exit.c:902 [] do_syscall_32_irqs_on arch/x86/entry/common.c:330 [inline] [] do_fast_syscall_32+0x32d/0xa90 arch/x86/entry/common.c:397 [] sysenter_flags_fixed+0xd/0x1a Code: ff ff 80 38 00 0f 85 ff 04 00 00 48 8b 85 60 ff ff ff 4c 8b 38 4d 85 ff 0f 84 e6 02 00 00 48 8d 75 98 31 c0 4c 89 fa 48 c1 ea 03 <42> 80 3c 22 00 0f 85 d6 02 00 00 49 8d 7f 18 83 c0 01 49 8b 1f RIP [] __debug_check_no_obj_freed lib/debugobjects.c:692 [inline] RIP [] debug_check_no_obj_freed+0x18c/0x6e0 lib/debugobjects.c:729 RSP ---[ end trace 177170f33cdf4d1f ]---