================================================================== BUG: KASAN: use-after-free in d_inode include/linux/dcache.h:522 [inline] BUG: KASAN: use-after-free in relay_switch_subbuf+0x8d5/0x940 kernel/relay.c:761 Read of size 8 at addr ffff8880462ac358 by task syz-executor.2/340954 CPU: 1 PID: 340954 Comm: syz-executor.2 Not tainted 5.10.186 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x107/0x167 lib/dump_stack.c:118 print_address_description.constprop.0+0x1c/0x220 mm/kasan/report.c:377 __kasan_report mm/kasan/report.c:537 [inline] kasan_report.cold+0x37/0x7c mm/kasan/report.c:554 d_inode include/linux/dcache.h:522 [inline] relay_switch_subbuf+0x8d5/0x940 kernel/relay.c:761 relay_reserve include/linux/relay.h:261 [inline] trace_note.constprop.0+0x42f/0x550 kernel/trace/blktrace.c:95 trace_note_tsk kernel/trace/blktrace.c:126 [inline] __blk_add_trace.constprop.0+0xa7a/0xbd0 kernel/trace/blktrace.c:266 blk_add_trace_rq.constprop.0+0x3bd/0x4f0 kernel/trace/blktrace.c:844 trace_block_rq_complete include/trace/events/block.h:115 [inline] blk_update_request+0xa86/0xeb0 block/blk-core.c:1436 scsi_end_request+0x7a/0x8c0 drivers/scsi/scsi_lib.c:570 scsi_io_completion+0x3f0/0x12c0 drivers/scsi/scsi_lib.c:967 scsi_softirq_done+0x11b/0x490 drivers/scsi/scsi_lib.c:1445 blk_done_softirq+0x22f/0x370 block/blk-mq.c:590 __do_softirq+0x1b8/0x7c9 kernel/softirq.c:298 asm_call_irq_on_stack+0x12/0x20 __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline] run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline] do_softirq_own_stack+0x80/0xa0 arch/x86/kernel/irq_64.c:77 invoke_softirq kernel/softirq.c:393 [inline] __irq_exit_rcu kernel/softirq.c:423 [inline] irq_exit_rcu+0x114/0x1b0 kernel/softirq.c:435 sysvec_call_function_single+0x43/0xa0 arch/x86/kernel/smp.c:243 asm_sysvec_call_function_single+0x12/0x20 arch/x86/include/asm/idtentry.h:643 RIP: 0010:_raw_spin_unlock_irq+0x27/0x30 kernel/locking/spinlock.c:200 Code: 44 00 00 55 48 8b 74 24 08 48 89 fd 48 8d 7f 18 e8 ee e4 41 fd 48 89 ef e8 b6 9e 42 fd e8 d1 9a 61 fd fb 65 ff 0d 69 50 1d 7c <5d> e9 63 20 3b 00 0f 1f 00 55 48 89 fd 48 83 c7 18 53 48 89 f3 48 RSP: 0018:ffff88804e9d78a8 EFLAGS: 00000282 RAX: 00000000000003a5 RBX: ffff888048a5b480 RCX: 1ffffffff0acda09 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff83e51ecf RBP: ffff88806cf3b2c0 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000001 R12: ffff88806cf3b2c0 R13: ffff8880353e8000 R14: 0000000000000000 R15: 0000000000000001 finish_lock_switch kernel/sched/core.c:3539 [inline] finish_task_switch+0x126/0x5d0 kernel/sched/core.c:3639 context_switch kernel/sched/core.c:3803 [inline] __schedule+0x82c/0x1ea0 kernel/sched/core.c:4548 schedule+0xcb/0x270 kernel/sched/core.c:4626 freezable_schedule include/linux/freezer.h:172 [inline] futex_wait_queue_me+0x2a7/0x580 kernel/futex/core.c:2607 futex_wait+0x1db/0x5f0 kernel/futex/core.c:2709 do_futex+0xf8a/0x1a60 kernel/futex/core.c:3743 __do_sys_futex+0x2bb/0x480 kernel/futex/core.c:3806 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 RIP: 0033:0x7fe9d88ccb19 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe9d5e42218 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: ffffffffffffffda RBX: 00007fe9d89dff68 RCX: 00007fe9d88ccb19 RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007fe9d89dff68 RBP: 00007fe9d89dff60 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe9d89dff6c R13: 00007ffd81eafdff R14: 00007fe9d5e42300 R15: 0000000000022000 Allocated by task 337227: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xc9/0xd0 mm/kasan/common.c:461 slab_post_alloc_hook mm/slab.h:532 [inline] slab_alloc_node mm/slub.c:2896 [inline] slab_alloc mm/slub.c:2904 [inline] kmem_cache_alloc+0x13b/0x310 mm/slub.c:2909 __d_alloc+0x2a/0x990 fs/dcache.c:1709 d_alloc_pseudo+0x19/0x70 fs/dcache.c:1838 alloc_file_pseudo+0xce/0x250 fs/file_table.c:226 anon_inode_getfile fs/anon_inodes.c:91 [inline] anon_inode_getfile+0xc8/0x1f0 fs/anon_inodes.c:74 __do_sys_perf_event_open+0xf5d/0x2d50 kernel/events/core.c:11988 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Last call_rcu(): kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_record_aux_stack+0xa2/0xb0 mm/kasan/generic.c:346 __call_rcu kernel/rcu/tree.c:2975 [inline] call_rcu+0x8a/0x9c0 kernel/rcu/tree.c:3049 dentry_free+0xc3/0x160 fs/dcache.c:350 __dentry_kill+0x47d/0x5c0 fs/dcache.c:593 dentry_kill fs/dcache.c:717 [inline] dput+0x6d1/0xc90 fs/dcache.c:878 handle_mounts fs/namei.c:1401 [inline] step_into+0xe1c/0x1ce0 fs/namei.c:1698 walk_component+0x171/0x6a0 fs/namei.c:1874 lookup_last fs/namei.c:2319 [inline] path_lookupat+0x1ba/0x860 fs/namei.c:2343 filename_lookup+0x1b1/0x570 fs/namei.c:2376 user_path_at include/linux/namei.h:60 [inline] vfs_statx+0x142/0x3a0 fs/stat.c:193 vfs_fstatat fs/stat.c:215 [inline] vfs_lstat include/linux/fs.h:3147 [inline] __do_sys_newlstat+0x91/0x110 fs/stat.c:369 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Second to last call_rcu(): kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_record_aux_stack+0xa2/0xb0 mm/kasan/generic.c:346 __call_rcu kernel/rcu/tree.c:2975 [inline] call_rcu+0x8a/0x9c0 kernel/rcu/tree.c:3049 dentry_free+0xc3/0x160 fs/dcache.c:350 __dentry_kill+0x47d/0x5c0 fs/dcache.c:593 shrink_dentry_list+0x12f/0x500 fs/dcache.c:1141 shrink_dcache_sb+0x144/0x220 fs/dcache.c:1261 reconfigure_super+0x660/0x8f0 fs/super.c:941 do_remount fs/namespace.c:2636 [inline] path_mount+0x1a75/0x20b0 fs/namespace.c:3221 do_mount fs/namespace.c:3242 [inline] __do_sys_mount fs/namespace.c:3450 [inline] __se_sys_mount fs/namespace.c:3427 [inline] __x64_sys_mount+0x282/0x300 fs/namespace.c:3427 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 The buggy address belongs to the object at ffff8880462ac2f0 which belongs to the cache dentry of size 312 The buggy address is located 104 bytes inside of 312-byte region [ffff8880462ac2f0, ffff8880462ac428) The buggy address belongs to the page: page:00000000af3f3976 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880462aca48 pfn:0x462ac head:00000000af3f3976 order:1 compound_mapcount:0 flags: 0x100000000010200(slab|head) raw: 0100000000010200 ffffea00006b3188 ffffea0001290e08 ffff8880083e6000 raw: ffff8880462aca48 0000000000150003 00000001ffffffff ffff888042f5e701 page dumped because: kasan: bad access detected page->mem_cgroup:ffff888042f5e701 Memory state around the buggy address: ffff8880462ac200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880462ac280: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fb fb >ffff8880462ac300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880462ac380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880462ac400: fb fb fb fb fb fc fc fc fc fc fc fc fc fb fb fb ================================================================== general protection fault, probably for non-canonical address 0xdffffc000000000a: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000050-0x0000000000000057] CPU: 1 PID: 340954 Comm: syz-executor.2 Tainted: G B 5.10.186 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:relay_switch_subbuf+0x216/0x940 kernel/relay.c:761 Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 d3 06 00 00 48 ba 00 00 00 00 00 fc ff df 4c 8b 73 68 49 8d 7e 50 48 89 f9 48 c1 e9 03 <80> 3c 11 00 0f 85 92 06 00 00 49 8b 55 28 49 8b 5e 50 48 b9 00 00 RSP: 0018:ffff88806cf09b80 EFLAGS: 00010016 RAX: 0000000000000001 RBX: ffff8880462ac2f0 RCX: 000000000000000a RDX: dffffc0000000000 RSI: ffffffff83d7e88a RDI: 0000000000000050 RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000003 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000040 R13: ffff888043831800 R14: 0000000000000000 R15: 00000000000000f8 FS: 00007fe9d5e42700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b2d724000 CR3: 0000000058f64000 CR4: 0000000000350ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600 Call Trace: relay_reserve include/linux/relay.h:261 [inline] trace_note.constprop.0+0x42f/0x550 kernel/trace/blktrace.c:95 trace_note_tsk kernel/trace/blktrace.c:126 [inline] __blk_add_trace.constprop.0+0xa7a/0xbd0 kernel/trace/blktrace.c:266 blk_add_trace_rq.constprop.0+0x3bd/0x4f0 kernel/trace/blktrace.c:844 trace_block_rq_complete include/trace/events/block.h:115 [inline] blk_update_request+0xa86/0xeb0 block/blk-core.c:1436 scsi_end_request+0x7a/0x8c0 drivers/scsi/scsi_lib.c:570 scsi_io_completion+0x3f0/0x12c0 drivers/scsi/scsi_lib.c:967 scsi_softirq_done+0x11b/0x490 drivers/scsi/scsi_lib.c:1445 blk_done_softirq+0x22f/0x370 block/blk-mq.c:590 __do_softirq+0x1b8/0x7c9 kernel/softirq.c:298 asm_call_irq_on_stack+0x12/0x20 __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline] run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline] do_softirq_own_stack+0x80/0xa0 arch/x86/kernel/irq_64.c:77 invoke_softirq kernel/softirq.c:393 [inline] __irq_exit_rcu kernel/softirq.c:423 [inline] irq_exit_rcu+0x114/0x1b0 kernel/softirq.c:435 sysvec_call_function_single+0x43/0xa0 arch/x86/kernel/smp.c:243 asm_sysvec_call_function_single+0x12/0x20 arch/x86/include/asm/idtentry.h:643 RIP: 0010:_raw_spin_unlock_irq+0x27/0x30 kernel/locking/spinlock.c:200 Code: 44 00 00 55 48 8b 74 24 08 48 89 fd 48 8d 7f 18 e8 ee e4 41 fd 48 89 ef e8 b6 9e 42 fd e8 d1 9a 61 fd fb 65 ff 0d 69 50 1d 7c <5d> e9 63 20 3b 00 0f 1f 00 55 48 89 fd 48 83 c7 18 53 48 89 f3 48 RSP: 0018:ffff88804e9d78a8 EFLAGS: 00000282 RAX: 00000000000003a5 RBX: ffff888048a5b480 RCX: 1ffffffff0acda09 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff83e51ecf RBP: ffff88806cf3b2c0 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000001 R12: ffff88806cf3b2c0 R13: ffff8880353e8000 R14: 0000000000000000 R15: 0000000000000001 finish_lock_switch kernel/sched/core.c:3539 [inline] finish_task_switch+0x126/0x5d0 kernel/sched/core.c:3639 context_switch kernel/sched/core.c:3803 [inline] __schedule+0x82c/0x1ea0 kernel/sched/core.c:4548 schedule+0xcb/0x270 kernel/sched/core.c:4626 freezable_schedule include/linux/freezer.h:172 [inline] futex_wait_queue_me+0x2a7/0x580 kernel/futex/core.c:2607 futex_wait+0x1db/0x5f0 kernel/futex/core.c:2709 do_futex+0xf8a/0x1a60 kernel/futex/core.c:3743 __do_sys_futex+0x2bb/0x480 kernel/futex/core.c:3806 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 RIP: 0033:0x7fe9d88ccb19 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe9d5e42218 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: ffffffffffffffda RBX: 00007fe9d89dff68 RCX: 00007fe9d88ccb19 RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007fe9d89dff68 RBP: 00007fe9d89dff60 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe9d89dff6c R13: 00007ffd81eafdff R14: 00007fe9d5e42300 R15: 0000000000022000 Modules linked in: ---[ end trace 6a38281100514c7e ]--- RIP: 0010:relay_switch_subbuf+0x216/0x940 kernel/relay.c:761 Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 d3 06 00 00 48 ba 00 00 00 00 00 fc ff df 4c 8b 73 68 49 8d 7e 50 48 89 f9 48 c1 e9 03 <80> 3c 11 00 0f 85 92 06 00 00 49 8b 55 28 49 8b 5e 50 48 b9 00 00 RSP: 0018:ffff88806cf09b80 EFLAGS: 00010016 RAX: 0000000000000001 RBX: ffff8880462ac2f0 RCX: 000000000000000a RDX: dffffc0000000000 RSI: ffffffff83d7e88a RDI: 0000000000000050 RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000003 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000040 R13: ffff888043831800 R14: 0000000000000000 R15: 00000000000000f8 FS: 00007fe9d5e42700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b2d724000 CR3: 0000000058f64000 CR4: 0000000000350ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600 ---------------- Code disassembly (best guess): 0: 44 00 00 add %r8b,(%rax) 3: 55 push %rbp 4: 48 8b 74 24 08 mov 0x8(%rsp),%rsi 9: 48 89 fd mov %rdi,%rbp c: 48 8d 7f 18 lea 0x18(%rdi),%rdi 10: e8 ee e4 41 fd callq 0xfd41e503 15: 48 89 ef mov %rbp,%rdi 18: e8 b6 9e 42 fd callq 0xfd429ed3 1d: e8 d1 9a 61 fd callq 0xfd619af3 22: fb sti 23: 65 ff 0d 69 50 1d 7c decl %gs:0x7c1d5069(%rip) # 0x7c1d5093 * 2a: 5d pop %rbp <-- trapping instruction 2b: e9 63 20 3b 00 jmpq 0x3b2093 30: 0f 1f 00 nopl (%rax) 33: 55 push %rbp 34: 48 89 fd mov %rdi,%rbp 37: 48 83 c7 18 add $0x18,%rdi 3b: 53 push %rbx 3c: 48 89 f3 mov %rsi,%rbx 3f: 48 rex.W