================================================================== BUG: KASAN: use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] BUG: KASAN: use-after-free in do_raw_spin_lock+0x28b/0x360 kernel/locking/spinlock_debug.c:114 Read of size 4 at addr ffff888023698974 by task syz-executor139/3607 CPU: 1 PID: 3607 Comm: syz-executor139 Not tainted 6.1.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106 print_address_description+0x74/0x340 mm/kasan/report.c:284 print_report+0x107/0x1f0 mm/kasan/report.c:395 kasan_report+0xcd/0x100 mm/kasan/report.c:495 debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] do_raw_spin_lock+0x28b/0x360 kernel/locking/spinlock_debug.c:114 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0xbf/0x100 kernel/locking/spinlock.c:162 try_to_wake_up+0x9c/0xac0 kernel/sched/core.c:4076 call_timer_fn+0xf5/0x210 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1519 [inline] __run_timers+0x772/0x980 kernel/time/timer.c:1790 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1803 __do_softirq+0x277/0x738 kernel/softirq.c:571 __irq_exit_rcu+0xcf/0x150 kernel/softirq.c:650 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1107 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:160 [inline] RIP: 0010:_raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:202 Code: 00 00 00 00 00 53 48 89 fb 48 83 c7 18 48 8b 74 24 08 e8 1e c4 2a f7 48 89 df e8 26 35 2c f7 e8 d1 9b 51 f7 fb bf 01 00 00 00 b6 84 1e f7 65 8b 05 c7 89 c5 75 85 c0 74 02 5b c3 e8 94 a5 c3 RSP: 0018:ffffc90003e5f6d0 EFLAGS: 00000286 RAX: 0ca42d88e1c65f00 RBX: ffff88801c17dc48 RCX: 0000000000000001 RDX: dffffc0000000000 RSI: 0000000000000000 RDI: 0000000000000001 RBP: ffffc90003e5f850 R08: dffffc0000000000 R09: ffffed100382fb8a R10: ffffed100382fb8a R11: 1ffff1100382fb89 R12: ffff888020109000 R13: dffffc0000000000 R14: 0000000000060801 R15: ffff88801e3ab280 blk_mq_submit_bio+0x116f/0x1da0 block/blk-mq.c:2916 __submit_bio block/blk-core.c:591 [inline] __submit_bio_noacct_mq block/blk-core.c:668 [inline] submit_bio_noacct_nocheck+0xddd/0x1050 block/blk-core.c:685 submit_bh fs/buffer.c:2707 [inline] __sync_dirty_buffer+0x208/0x330 fs/buffer.c:2745 nilfs_sync_super fs/nilfs2/super.c:181 [inline] nilfs_commit_super+0x472/0x940 fs/nilfs2/super.c:297 nilfs_cleanup_super+0x362/0x410 fs/nilfs2/super.c:328 nilfs_put_super+0x96/0x150 fs/nilfs2/super.c:472 generic_shutdown_super+0x130/0x310 fs/super.c:491 kill_block_super+0x79/0xd0 fs/super.c:1427 deactivate_locked_super+0xa7/0xf0 fs/super.c:331 cleanup_mnt+0x494/0x520 fs/namespace.c:1186 task_work_run+0x243/0x300 kernel/task_work.c:179 ptrace_notify+0x29a/0x340 kernel/signal.c:2354 ptrace_report_syscall include/linux/ptrace.h:420 [inline] ptrace_report_syscall_exit include/linux/ptrace.h:482 [inline] syscall_exit_work+0x8c/0xe0 kernel/entry/common.c:251 syscall_exit_to_user_mode_prepare+0x63/0xc0 kernel/entry/common.c:278 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0xa/0x60 kernel/entry/common.c:296 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f9761bf6017 Code: 07 00 48 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffd24e8f598 EFLAGS: 00000202 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f9761bf6017 RDX: 00007ffd24e8f65a RSI: 000000000000000a RDI: 00007ffd24e8f650 RBP: 00007ffd24e8f650 R08: 00000000ffffffff R09: 00007ffd24e8f430 R10: 000055555574f653 R11: 0000000000000202 R12: 00007ffd24e906c0 R13: 000055555574f5f0 R14: 00007ffd24e8f5c0 R15: 000000000000001c Allocated by task 2: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x3d/0x60 mm/kasan/common.c:52 __kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:325 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slub.c:3398 [inline] kmem_cache_alloc_node+0x1ca/0x340 mm/slub.c:3443 alloc_task_struct_node kernel/fork.c:171 [inline] dup_task_struct+0x4e/0x490 kernel/fork.c:966 copy_process+0x637/0x4000 kernel/fork.c:2084 kernel_clone+0x21b/0x620 kernel/fork.c:2671 kernel_thread+0x150/0x1d0 kernel/fork.c:2731 create_kthread kernel/kthread.c:399 [inline] kthreadd+0x57c/0x750 kernel/kthread.c:746 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Last potentially related work creation: kasan_save_stack+0x2b/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:481 call_rcu+0x163/0x9c0 kernel/rcu/tree.c:2796 context_switch kernel/sched/core.c:5194 [inline] __schedule+0x8d1/0xd70 kernel/sched/core.c:6503 schedule+0xcb/0x190 kernel/sched/core.c:6579 io_schedule+0x83/0x100 kernel/sched/core.c:8723 bit_wait_io+0xe/0xc0 kernel/sched/wait_bit.c:209 __wait_on_bit+0xb5/0x170 kernel/sched/wait_bit.c:49 out_of_line_wait_on_bit+0x1c3/0x240 kernel/sched/wait_bit.c:64 wait_on_bit_io include/linux/wait_bit.h:101 [inline] __wait_on_buffer fs/buffer.c:122 [inline] wait_on_buffer include/linux/buffer_head.h:385 [inline] __bread_slow fs/buffer.c:1178 [inline] __bread_gfp+0x262/0x320 fs/buffer.c:1370 sb_bread include/linux/buffer_head.h:338 [inline] nilfs_read_super_block+0x82/0xe0 fs/nilfs2/super.c:843 nilfs_load_super_block+0x148/0xe00 fs/nilfs2/the_nilfs.c:497 init_nilfs+0xb7/0x7d0 fs/nilfs2/the_nilfs.c:577 nilfs_fill_super+0xb1/0x5d0 fs/nilfs2/super.c:1047 nilfs_mount+0x613/0x9b0 fs/nilfs2/super.c:1317 legacy_get_tree+0xea/0x180 fs/fs_context.c:610 vfs_get_tree+0x88/0x270 fs/super.c:1530 do_new_mount+0x289/0xad0 fs/namespace.c:3040 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x2b/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:481 call_rcu+0x163/0x9c0 kernel/rcu/tree.c:2796 context_switch kernel/sched/core.c:5194 [inline] __schedule+0x8d1/0xd70 kernel/sched/core.c:6503 schedule+0xcb/0x190 kernel/sched/core.c:6579 schedule_hrtimeout_range_clock+0x26e/0x460 kernel/time/hrtimer.c:2305 poll_schedule_timeout+0x10b/0x150 fs/select.c:244 do_select+0x1985/0x1b60 fs/select.c:607 core_sys_select+0x729/0x960 fs/select.c:681 do_pselect fs/select.c:763 [inline] __do_sys_pselect6+0x371/0x420 fs/select.c:804 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888023698000 which belongs to the cache task_struct of size 7232 The buggy address is located 2420 bytes inside of 7232-byte region [ffff888023698000, ffff888023699c40) The buggy address belongs to the physical page: page:ffffea00008da600 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802369d7c0 pfn:0x23698 head:ffffea00008da600 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0000965208 ffffea00009e7e08 ffff8881400073c0 raw: ffff88802369d7c0 0000000000040002 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2, tgid 2 (kthreadd), ts 36703962771, free_ts 36605481195 prep_new_page mm/page_alloc.c:2538 [inline] get_page_from_freelist+0x742/0x7c0 mm/page_alloc.c:4287 __alloc_pages+0x259/0x560 mm/page_alloc.c:5554 alloc_slab_page+0x70/0xf0 mm/slub.c:1794 allocate_slab+0x5e/0x4b0 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0x782/0xe20 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] kmem_cache_alloc_node+0x283/0x340 mm/slub.c:3443 alloc_task_struct_node kernel/fork.c:171 [inline] dup_task_struct+0x4e/0x490 kernel/fork.c:966 copy_process+0x637/0x4000 kernel/fork.c:2084 kernel_clone+0x21b/0x620 kernel/fork.c:2671 kernel_thread+0x150/0x1d0 kernel/fork.c:2731 create_kthread kernel/kthread.c:399 [inline] kthreadd+0x57c/0x750 kernel/kthread.c:746 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1458 [inline] free_pcp_prepare+0x80c/0x8f0 mm/page_alloc.c:1508 free_unref_page_prepare mm/page_alloc.c:3386 [inline] free_unref_page+0x7d/0x5f0 mm/page_alloc.c:3482 free_slab mm/slub.c:2031 [inline] discard_slab mm/slub.c:2037 [inline] __unfreeze_partials+0x1ab/0x200 mm/slub.c:2586 put_cpu_partial+0x106/0x170 mm/slub.c:2662 qlist_free_all+0x2b/0x70 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x169/0x180 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:302 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slub.c:3398 [inline] __kmem_cache_alloc_node+0x1d7/0x310 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:954 [inline] __kmalloc_node_track_caller+0x9c/0x1a0 mm/slab_common.c:975 kmalloc_reserve net/core/skbuff.c:437 [inline] __alloc_skb+0x112/0x2b0 net/core/skbuff.c:509 alloc_skb_fclone include/linux/skbuff.h:1317 [inline] tcp_stream_alloc_skb+0x3c/0x300 net/ipv4/tcp.c:862 tcp_sendmsg_locked+0xd70/0x40d0 net/ipv4/tcp.c:1325 tcp_sendmsg+0x2c/0x40 net/ipv4/tcp.c:1483 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg net/socket.c:734 [inline] sock_write_iter+0x3d4/0x540 net/socket.c:1108 call_write_iter include/linux/fs.h:2191 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x7dc/0xc50 fs/read_write.c:584 ksys_write+0x177/0x2a0 fs/read_write.c:637 Memory state around the buggy address: ffff888023698800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888023698880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888023698900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888023698980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888023698a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 00 00 add %al,(%rax) 2: 00 00 add %al,(%rax) 4: 00 53 48 add %dl,0x48(%rbx) 7: 89 fb mov %edi,%ebx 9: 48 83 c7 18 add $0x18,%rdi d: 48 8b 74 24 08 mov 0x8(%rsp),%rsi 12: e8 1e c4 2a f7 callq 0xf72ac435 17: 48 89 df mov %rbx,%rdi 1a: e8 26 35 2c f7 callq 0xf72c3545 1f: e8 d1 9b 51 f7 callq 0xf7519bf5 24: fb sti 25: bf 01 00 00 00 mov $0x1,%edi * 2a: e8 b6 84 1e f7 callq 0xf71e84e5 <-- trapping instruction 2f: 65 8b 05 c7 89 c5 75 mov %gs:0x75c589c7(%rip),%eax # 0x75c589fd 36: 85 c0 test %eax,%eax 38: 74 02 je 0x3c 3a: 5b pop %rbx 3b: c3 retq 3c: e8 .byte 0xe8 3d: 94 xchg %eax,%esp 3e: a5 movsl %ds:(%rsi),%es:(%rdi) 3f: c3 retq