================================================================== BUG: KASAN: use-after-free in relay_switch_subbuf+0x8be/0x920 kernel/relay.c:755 Read of size 8 at addr ffff888095523398 by task syz-executor.0/27082 CPU: 1 PID: 27082 Comm: syz-executor.0 Not tainted 5.3.0+ #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+0x172/0x1f0 lib/dump_stack.c:113 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/0x17 mm/kasan/common.c:634 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132 relay_switch_subbuf+0x8be/0x920 kernel/relay.c:755 relay_reserve include/linux/relay.h:261 [inline] trace_note.isra.0+0x5b8/0x6e0 kernel/trace/blktrace.c:93 trace_note_tsk kernel/trace/blktrace.c:124 [inline] __blk_add_trace+0xb70/0xe10 kernel/trace/blktrace.c:264 blk_add_trace_rq+0x185/0x1f0 kernel/trace/blktrace.c:813 blk_add_trace_rq_complete+0x17a/0x1e0 kernel/trace/blktrace.c:842 trace_block_rq_complete include/trace/events/block.h:116 [inline] blk_update_request+0x9e7/0xdc0 block/blk-core.c:1435 scsi_end_request+0x7f/0x840 drivers/scsi/scsi_lib.c:579 scsi_io_completion+0x20a/0x1420 drivers/scsi/scsi_lib.c:963 scsi_finish_command+0x3b7/0x670 drivers/scsi/scsi.c:228 scsi_softirq_done+0x326/0x3b0 drivers/scsi/scsi_lib.c:1477 blk_done_softirq+0x2fe/0x4d0 block/blk-softirq.c:37 __do_softirq+0x262/0x98c kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x19b/0x1e0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] do_IRQ+0xe3/0x280 arch/x86/kernel/irq.c:263 common_interrupt+0xf/0xf arch/x86/entry/entry_64.S:607 RIP: 0010:__debug_check_no_obj_freed lib/debugobjects.c:981 [inline] RIP: 0010:debug_check_no_obj_freed+0x22b/0x43f lib/debugobjects.c:994 Code: ac 4c 89 ef e8 06 b6 03 04 44 39 3d 2f d9 82 06 7d 07 44 89 3d 26 d9 82 06 49 81 c6 00 10 00 00 4c 3b 75 98 0f 85 4c fe ff ff <8b> 45 ac 39 05 08 d9 82 06 7d 06 89 05 00 d9 82 06 80 3d 3d 8f 81 RSP: 0018:ffff888216a7f8f8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffdd RAX: 0000000000000000 RBX: ffffffff8ad53160 RCX: 0000000000000000 RDX: 0000000000000001 RSI: 0000000000000008 RDI: 0000000000000001 RBP: ffff888216a7f970 R08: 1ffffffff14efd2e R09: fffffbfff14efd2f R10: fffffbfff14efd2e R11: ffffffff8a77e977 R12: dffffc0000000000 R13: ffffffff8ad53168 R14: ffff8880a25d0000 R15: 0000000000000000 free_pages_prepare mm/page_alloc.c:1175 [inline] free_pcp_prepare+0x208/0x4f0 mm/page_alloc.c:1199 free_unref_page_prepare mm/page_alloc.c:3008 [inline] free_unref_page+0x11/0x180 mm/page_alloc.c:3057 free_the_page mm/page_alloc.c:4783 [inline] __free_pages mm/page_alloc.c:4791 [inline] __free_pages+0x72/0xb0 mm/page_alloc.c:4788 relay_destroy_buf+0x12d/0x360 kernel/relay.c:215 relay_remove_buf kernel/relay.c:235 [inline] kref_put include/linux/kref.h:65 [inline] relay_close_buf+0x110/0x150 kernel/relay.c:498 relay_close kernel/relay.c:848 [inline] relay_close+0x154/0x440 kernel/relay.c:834 blk_trace_free+0x8c/0x140 kernel/trace/blktrace.c:314 blk_trace_cleanup kernel/trace/blktrace.c:339 [inline] __blk_trace_remove+0x78/0xa0 kernel/trace/blktrace.c:352 blk_trace_ioctl+0x239/0x300 kernel/trace/blktrace.c:725 blkdev_ioctl+0x126/0x1c1a block/ioctl.c:592 block_ioctl+0xee/0x130 fs/block_dev.c:1954 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x459a29 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:00007f9d8fe50c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459a29 RDX: 000000000000ff00 RSI: 0000000000001276 RDI: 0000000000000004 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9d8fe516d4 R13: 00000000004c1119 R14: 00000000004d4450 R15: 00000000ffffffff Allocated by task 8835: 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_slab_alloc+0xf/0x20 mm/kasan/common.c:518 slab_post_alloc_hook mm/slab.h:584 [inline] slab_alloc mm/slab.c:3319 [inline] kmem_cache_alloc+0x121/0x710 mm/slab.c:3483 __d_alloc+0x2e/0x8c0 fs/dcache.c:1688 d_alloc_pseudo+0x1e/0x70 fs/dcache.c:1817 alloc_file_pseudo+0xe2/0x280 fs/file_table.c:225 sock_alloc_file+0x50/0x180 net/socket.c:397 sock_map_fd net/socket.c:420 [inline] __sys_socket+0x150/0x220 net/socket.c:1515 __do_sys_socket net/socket.c:1520 [inline] __se_sys_socket net/socket.c:1518 [inline] __x64_sys_socket+0x73/0xb0 net/socket.c:1518 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 8835: 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:3425 [inline] kmem_cache_free+0x86/0x320 mm/slab.c:3693 __d_free fs/dcache.c:271 [inline] dentry_free fs/dcache.c:348 [inline] dentry_free+0xe9/0x160 fs/dcache.c:336 __dentry_kill+0x457/0x600 fs/dcache.c:593 dentry_kill fs/dcache.c:686 [inline] dput+0x819/0xde0 fs/dcache.c:859 __fput+0x424/0x890 fs/file_table.c:293 ____fput+0x16/0x20 fs/file_table.c:313 task_work_run+0x145/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x316/0x380 arch/x86/entry/common.c:163 prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline] syscall_return_slowpath arch/x86/entry/common.c:274 [inline] do_syscall_64+0x65f/0x760 arch/x86/entry/common.c:300 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff888095523340 which belongs to the cache dentry(65:syz2) of size 288 The buggy address is located 88 bytes inside of 288-byte region [ffff888095523340, ffff888095523460) The buggy address belongs to the page: page:ffffea00025548c0 refcount:1 mapcount:0 mapping:ffff888097c09700 index:0xffff8880955234a0 flags: 0x1fffc0000000200(slab) raw: 01fffc0000000200 ffffea00024cc708 ffffea00024c0348 ffff888097c09700 raw: ffff8880955234a0 ffff888095523080 0000000100000006 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888095523280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888095523300: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb >ffff888095523380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888095523400: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff888095523480: fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================