==================================================================
BUG: KASAN: use-after-free in d_inode include/linux/dcache.h:516 [inline]
BUG: KASAN: use-after-free in relay_switch_subbuf+0x298/0x6b0 kernel/relay.c:676
Read of size 8 at addr ffff8880739184d0 by task udevd/2980
CPU: 1 PID: 2980 Comm: udevd Not tainted 5.19.0-rc2-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description+0x65/0x4b0 mm/kasan/report.c:313
print_report+0xf4/0x210 mm/kasan/report.c:429
kasan_report+0xfb/0x130 mm/kasan/report.c:491
d_inode include/linux/dcache.h:516 [inline]
relay_switch_subbuf+0x298/0x6b0 kernel/relay.c:676
relay_reserve include/linux/relay.h:248 [inline]
trace_note+0x54b/0x6f0 kernel/trace/blktrace.c:95
trace_note_tsk+0xb9/0x150 kernel/trace/blktrace.c:126
__blk_add_trace+0x9ec/0xd60 kernel/trace/blktrace.c:267
blk_add_trace_rq+0x2b2/0x2f0 kernel/trace/blktrace.c:848
trace_block_rq_complete+0x22a/0x280 include/trace/events/block.h:147
blk_update_request+0x36/0x1040 block/blk-mq.c:786
scsi_end_request+0x92/0x9c0 drivers/scsi/scsi_lib.c:543
scsi_io_completion+0x1af/0x420 drivers/scsi/scsi_lib.c:972
blk_complete_reqs block/blk-mq.c:1013 [inline]
blk_done_softirq+0x119/0x160 block/blk-mq.c:1018
__do_softirq+0x382/0x793 kernel/softirq.c:571
__irq_exit_rcu+0xec/0x170 kernel/softirq.c:650
irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
common_interrupt+0xa4/0xc0 arch/x86/kernel/irq.c:240
asm_common_interrupt+0x27/0x40
RIP: 0010:finish_lock_switch+0x1c5/0x350 kernel/sched/core.c:4877
Code: be ff ff ff ff e8 9b af cc 08 85 c0 74 37 4d 85 e4 75 58 e9 43 01 00 00 4c 89 ff e8 05 9b d5 08 e8 00 18 30 00 fb 48 83 c4 10 <5b> 41 5c 41 5d 41 5e 41 5f 5d c3 0f 0b 4d 85 e4 0f 85 4a ff ff ff
RSP: 0018:ffffc90002d7f568 EFLAGS: 00000282
RAX: 356d09e00f997400 RBX: ffff8880b9b3a8c8 RCX: ffffffff9153de03
RDX: dffffc0000000000 RSI: ffffffff8a8d2120 RDI: ffffffff8ae98a60
RBP: ffff8880b9b3a640 R08: dffffc0000000000 R09: ffffed1017347371
R10: ffffed1017347371 R11: 1ffff11017347370 R12: 0000000000000000
R13: ffff8880b9b3a8d8 R14: dffffc0000000000 R15: ffff8880b9a39b80
finish_task_switch+0x140/0x610 kernel/sched/core.c:4994
context_switch kernel/sched/core.c:5119 [inline]
__schedule+0x95f/0xec0 kernel/sched/core.c:6428
preempt_schedule_irq+0xf7/0x1c0 kernel/sched/core.c:6736
irqentry_exit+0x53/0x80 kernel/entry/common.c:428
asm_common_interrupt+0x27/0x40
RIP: 0010:__sanitizer_cov_trace_switch+0x29/0x100
Code: 00 41 57 41 56 53 48 8b 46 08 48 83 c0 f8 48 c1 c0 3d 48 83 f8 07 0f 87 d6 00 00 00 b9 8b 00 00 00 0f a3 c1 0f 83 c8 00 00 00 <4c> 8b 16 4d 85 d2 0f 84 bc 00 00 00 4c 8b 04 c5 30 d4 91 8a 4c 8b
RSP: 0018:ffffc90002d7f8b8 EFLAGS: 00000297
RAX: 0000000000000000 RBX: ffff88801c325c10 RCX: 000000000000008b
RDX: 0000000000000000 RSI: ffffffff8d105ac0 RDI: 0000000000000072
RBP: 0000000000000072 R08: 0000000000000001 R09: ffffffff83f9d5f2
R10: 0000000000000002 R11: ffff88807d7d1d80 R12: ffffc90002d7fae0
R13: ffff88801c325c0f R14: dffffc0000000000 R15: 000000000000000f
tomoyo_const_part_length security/tomoyo/util.c:642 [inline]
tomoyo_fill_path_info+0xa2/0x380 security/tomoyo/util.c:682
tomoyo_get_realpath security/tomoyo/file.c:153 [inline]
tomoyo_path_perm+0x2aa/0x6b0 security/tomoyo/file.c:822
security_inode_getattr+0xc0/0x140 security/security.c:1344
vfs_getattr+0x26/0x360 fs/stat.c:157
vfs_statx+0x183/0x3f0 fs/stat.c:232
vfs_fstatat fs/stat.c:255 [inline]
__do_sys_newfstatat fs/stat.c:425 [inline]
__se_sys_newfstatat+0xf6/0x790 fs/stat.c:419
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7f94973251da
Code: 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff e9 0b 00 00 00 66 2e 0f 1f 84 00 00 00 00 00 90 41 89 ca b8 06 01 00 00 0f 05 <3d> 00 f0 ff ff 77 07 31 c0 c3 0f 1f 40 00 48 8b 15 69 fc 0c 00 f7
RSP: 002b:00007ffca3590cd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000106
RAX: ffffffffffffffda RBX: 00007ffca3592678 RCX: 00007f94973251da
RDX: 00007ffca3590ce8 RSI: 00007ffca3591178 RDI: 00000000ffffff9c
RBP: 00007ffca3590d78 R08: 0000000000000000 R09: 00007ffca3591450
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffca3591178
R13: 00007ffca3590ce8 R14: 000056437995c910 R15: 0000000000000000
Allocated by task 14571:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:436 [inline]
__kasan_slab_alloc+0xb2/0xe0 mm/kasan/common.c:469
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:750 [inline]
slab_alloc_node mm/slub.c:3214 [inline]
slab_alloc mm/slub.c:3222 [inline]
__kmem_cache_alloc_lru mm/slub.c:3229 [inline]
kmem_cache_alloc_lru+0x175/0x2d0 mm/slub.c:3246
__d_alloc+0x31/0x700 fs/dcache.c:1769
d_alloc+0x48/0x1d0 fs/dcache.c:1849
__lookup_hash+0xc8/0x240 fs/namei.c:1598
filename_create+0x27b/0x500 fs/namei.c:3747
do_symlinkat+0xf6/0x610 fs/namei.c:4360
__do_sys_symlink fs/namei.c:4392 [inline]
__se_sys_symlink fs/namei.c:4390 [inline]
__x64_sys_symlink+0x7a/0x90 fs/namei.c:4390
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
Freed by task 14628:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4c/0x70 mm/kasan/common.c:45
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370
____kasan_slab_free+0xd8/0x110 mm/kasan/common.c:366
kasan_slab_free include/linux/kasan.h:200 [inline]
slab_free_hook mm/slub.c:1727 [inline]
slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1753
slab_free mm/slub.c:3507 [inline]
kmem_cache_free+0xc7/0x270 mm/slub.c:3524
rcu_do_batch kernel/rcu/tree.c:2578 [inline]
rcu_core+0xa0c/0x16d0 kernel/rcu/tree.c:2838
__do_softirq+0x382/0x793 kernel/softirq.c:571
Last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
__kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348
call_rcu+0x163/0x9c0 kernel/rcu/tree.c:3126
__dentry_kill+0x46b/0x5b0 fs/dcache.c:621
dentry_kill+0xbb/0x290
dput+0x1f3/0x410 fs/dcache.c:913
do_unlinkat+0x4d8/0x9a0 fs/namei.c:4263
__do_sys_unlink fs/namei.c:4308 [inline]
__se_sys_unlink fs/namei.c:4306 [inline]
__x64_sys_unlink+0x45/0x50 fs/namei.c:4306
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
Second to last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
__kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348
call_rcu+0x163/0x9c0 kernel/rcu/tree.c:3126
__dentry_kill+0x46b/0x5b0 fs/dcache.c:621
dentry_kill+0xbb/0x290
dput+0x1f3/0x410 fs/dcache.c:913
proc_invalidate_siblings_dcache+0x3a0/0x630 fs/proc/inode.c:151
release_task+0x15a0/0x1890 kernel/exit.c:226
wait_task_zombie kernel/exit.c:1111 [inline]
wait_consider_task+0x196c/0x2cd0 kernel/exit.c:1338
do_wait_thread kernel/exit.c:1401 [inline]
do_wait+0x291/0x9d0 kernel/exit.c:1518
kernel_wait4+0x29c/0x3e0 kernel/exit.c:1681
__do_sys_wait4 kernel/exit.c:1709 [inline]
__se_sys_wait4 kernel/exit.c:1705 [inline]
__x64_sys_wait4+0x130/0x1e0 kernel/exit.c:1705
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
The buggy address belongs to the object at ffff888073918468
which belongs to the cache dentry of size 312
The buggy address is located 104 bytes inside of
312-byte region [ffff888073918468, ffff8880739185a0)
The buggy address belongs to the physical page:
page:ffffea0001ce4600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x73918
head:ffffea0001ce4600 order:1 compound_mapcount:0 compound_pincount:0
memcg:ffff888075d12d01
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea00013c0800 dead000000000003 ffff888140007780
raw: 0000000000000000 0000000000150015 00000001ffffffff ffff888075d12d01
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 9121, tgid 9113 (syz-executor.4), ts 491995172414, free_ts 338847842260
prep_new_page mm/page_alloc.c:2456 [inline]
get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4198
__alloc_pages+0x259/0x560 mm/page_alloc.c:5426
alloc_slab_page+0x70/0xf0 mm/slub.c:1797
allocate_slab+0x5e/0x520 mm/slub.c:1942
new_slab mm/slub.c:2002 [inline]
___slab_alloc+0x41e/0xcd0 mm/slub.c:3002
__slab_alloc mm/slub.c:3089 [inline]
slab_alloc_node mm/slub.c:3180 [inline]
slab_alloc mm/slub.c:3222 [inline]
__kmem_cache_alloc_lru mm/slub.c:3229 [inline]
kmem_cache_alloc_lru+0x221/0x2d0 mm/slub.c:3246
__d_alloc+0x31/0x700 fs/dcache.c:1769
d_alloc fs/dcache.c:1849 [inline]
d_alloc_parallel+0xcb/0x13d0 fs/dcache.c:2601
__lookup_slow+0x110/0x3d0 fs/namei.c:1686
lookup_one_len+0x50a/0x760 fs/namei.c:2730
start_creating+0x183/0x330 fs/debugfs/inode.c:352
__debugfs_create_file+0x74/0x500 fs/debugfs/inode.c:397
relay_create_buf_file kernel/relay.c:363 [inline]
relay_open_buf+0x5c8/0xd00 kernel/relay.c:392
relay_open+0x3cb/0x990 kernel/relay.c:520
do_blk_trace_setup+0x523/0x980 kernel/trace/blktrace.c:559
__blk_trace_setup kernel/trace/blktrace.c:599 [inline]
blk_trace_ioctl+0x325/0x8d0 kernel/trace/blktrace.c:740
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1371 [inline]
free_pcp_prepare+0x812/0x900 mm/page_alloc.c:1421
free_unref_page_prepare mm/page_alloc.c:3343 [inline]
free_unref_page+0x7d/0x390 mm/page_alloc.c:3438
free_slab mm/slub.c:2041 [inline]
discard_slab mm/slub.c:2047 [inline]
__unfreeze_partials+0x1ab/0x200 mm/slub.c:2521
put_cpu_partial+0x116/0x180 mm/slub.c:2597
do_slab_free mm/slub.c:3495 [inline]
___cache_free+0x118/0x1a0 mm/slub.c:3514
qlist_free_all+0x2b/0x70 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x169/0x180 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:446
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:750 [inline]
slab_alloc_node mm/slub.c:3214 [inline]
slab_alloc mm/slub.c:3222 [inline]
__kmem_cache_alloc_lru mm/slub.c:3229 [inline]
kmem_cache_alloc+0x199/0x2f0 mm/slub.c:3239
anon_vma_alloc mm/rmap.c:93 [inline]
anon_vma_fork+0xed/0x540 mm/rmap.c:358
dup_mmap+0x764/0xfc0 kernel/fork.c:658
dup_mm+0x8c/0x310 kernel/fork.c:1524
copy_mm+0x102/0x190 kernel/fork.c:1576
copy_process+0x1931/0x3fa0 kernel/fork.c:2240
kernel_clone+0x22f/0x7a0 kernel/fork.c:2655
__do_sys_clone kernel/fork.c:2789 [inline]
__se_sys_clone kernel/fork.c:2773 [inline]
__x64_sys_clone+0x276/0x2e0 kernel/fork.c:2773
Memory state around the buggy address:
ffff888073918380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888073918400: 00 00 00 00 00 fc fc fc fc fc fc fc fc fa fb fb
>ffff888073918480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888073918500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888073918580: fb fb fb fb fc fc fc fc fc fc fc fc fa fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: be ff ff ff ff mov $0xffffffff,%esi
5: e8 9b af cc 08 callq 0x8ccafa5
a: 85 c0 test %eax,%eax
c: 74 37 je 0x45
e: 4d 85 e4 test %r12,%r12
11: 75 58 jne 0x6b
13: e9 43 01 00 00 jmpq 0x15b
18: 4c 89 ff mov %r15,%rdi
1b: e8 05 9b d5 08 callq 0x8d59b25
20: e8 00 18 30 00 callq 0x301825
25: fb sti
26: 48 83 c4 10 add $0x10,%rsp
* 2a: 5b pop %rbx <-- trapping instruction
2b: 41 5c pop %r12
2d: 41 5d pop %r13
2f: 41 5e pop %r14
31: 41 5f pop %r15
33: 5d pop %rbp
34: c3 retq
35: 0f 0b ud2
37: 4d 85 e4 test %r12,%r12
3a: 0f 85 4a ff ff ff jne 0xffffff8a