================================ WARNING: inconsistent lock state 4.17.0-rc2+ #19 Not tainted -------------------------------- inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage. syz-executor787/8291 [HC1[1]:SC0[0]:HE0:SE1] takes: (ptrval) (fs_reclaim){?.+.}, at: fs_reclaim_acquire.part.82+0x0/0x30 mm/page_alloc.c:463 {HARDIRQ-ON-W} state was registered at: lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920 fs_reclaim_acquire.part.82+0x24/0x30 mm/page_alloc.c:3739 fs_reclaim_acquire+0x14/0x20 mm/page_alloc.c:3740 slab_pre_alloc_hook mm/slab.h:418 [inline] slab_alloc_node mm/slab.c:3299 [inline] kmem_cache_alloc_node_trace+0x39/0x770 mm/slab.c:3661 kmalloc_node include/linux/slab.h:550 [inline] kzalloc_node include/linux/slab.h:712 [inline] alloc_worker+0xbd/0x2e0 kernel/workqueue.c:1704 init_rescuer.part.25+0x1f/0x190 kernel/workqueue.c:4000 init_rescuer kernel/workqueue.c:3997 [inline] workqueue_init+0x51f/0x7d0 kernel/workqueue.c:5732 kernel_init_freeable+0x2ad/0x58e init/main.c:1115 kernel_init+0x11/0x1b3 init/main.c:1053 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:412 irq event stamp: 2022 hardirqs last enabled at (2021): [] restore_regs_and_return_to_kernel+0x0/0x2b hardirqs last disabled at (2022): [] interrupt_entry+0xb5/0xf0 arch/x86/entry/entry_64.S:625 softirqs last enabled at (1932): [] __do_softirq+0x778/0xaf5 kernel/softirq.c:311 softirqs last disabled at (1905): [] invoke_softirq kernel/softirq.c:365 [inline] softirqs last disabled at (1905): [] irq_exit+0x1d1/0x200 kernel/softirq.c:405 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(fs_reclaim); lock(fs_reclaim); *** DEADLOCK *** 2 locks held by syz-executor787/8291: #0: (ptrval) (sk_lock-AF_INET){+.+.}, at: lock_sock include/net/sock.h:1469 [inline] #0: (ptrval) (sk_lock-AF_INET){+.+.}, at: do_tcp_setsockopt.isra.40+0x18e/0x2600 net/ipv4/tcp.c:2752 #1: (ptrval) (&mm->mmap_sem){++++}, at: __might_fault+0xfb/0x1e0 mm/memory.c:4554 stack backtrace: CPU: 0 PID: 8291 Comm: syz-executor787 Not tainted 4.17.0-rc2+ #19 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+0x1b9/0x294 lib/dump_stack.c:113 print_usage_bug.cold.59+0x320/0x41a kernel/locking/lockdep.c:2542 valid_state kernel/locking/lockdep.c:2555 [inline] mark_lock_irq kernel/locking/lockdep.c:2749 [inline] mark_lock+0x1034/0x19e0 kernel/locking/lockdep.c:3147 mark_irqflags kernel/locking/lockdep.c:3022 [inline] __lock_acquire+0x1595/0x5140 kernel/locking/lockdep.c:3388 lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920 fs_reclaim_acquire.part.82+0x24/0x30 mm/page_alloc.c:3739 fs_reclaim_acquire+0x14/0x20 mm/page_alloc.c:3740 slab_pre_alloc_hook mm/slab.h:418 [inline] slab_alloc mm/slab.c:3378 [inline] __do_kmalloc mm/slab.c:3716 [inline] __kmalloc+0x45/0x760 mm/slab.c:3727 kmalloc_array include/linux/slab.h:631 [inline] kcalloc include/linux/slab.h:642 [inline] numa_crng_init drivers/char/random.c:798 [inline] crng_reseed+0x427/0x920 drivers/char/random.c:923 credit_entropy_bits+0x98d/0xa30 drivers/char/random.c:708 add_interrupt_randomness+0x494/0x860 drivers/char/random.c:1254 handle_irq_event_percpu+0xf9/0x1c0 kernel/irq/handle.c:191 handle_irq_event+0xa7/0x135 kernel/irq/handle.c:206 handle_edge_irq+0x20f/0x870 kernel/irq/chip.c:791 generic_handle_irq_desc include/linux/irqdesc.h:159 [inline] handle_irq+0x18c/0x2e7 arch/x86/kernel/irq_64.c:77 do_IRQ+0x78/0x190 arch/x86/kernel/irq.c:245 common_interrupt+0xf/0xf arch/x86/entry/entry_64.S:642 RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:783 [inline] RIP: 0010:lock_acquire+0x257/0x520 kernel/locking/lockdep.c:3923 RSP: 0018:ffff8801afa5f910 EFLAGS: 00000286 ORIG_RAX: ffffffffffffffd9 RAX: dffffc0000000000 RBX: 1ffff10035f4bf27 RCX: 0000000000000000 RDX: 1ffffffff11a315d RSI: ffff8801af8ec9f8 RDI: 0000000000000286 RBP: ffff8801afa5fa00 R08: 000000000000698b R09: 0000000000000001 R10: ffff8801af8eca20 R11: ffff8801af8ec1c0 R12: ffff8801af8ec1c0 R13: 0000000000000001 R14: 0000000000000001 R15: 0000000000000000 __might_fault+0x155/0x1e0 mm/memory.c:4555 _copy_from_user+0x30/0x150 lib/usercopy.c:10 copy_from_user include/linux/uaccess.h:147 [inline] tcp_repair_options_est net/ipv4/tcp.c:2639 [inline] do_tcp_setsockopt.isra.40+0x950/0x2600 net/ipv4/tcp.c:2836 tcp_setsockopt+0xc1/0xe0 net/ipv4/tcp.c:3031 sock_common_setsockopt+0x9a/0xe0 net/core/sock.c:3042 __sys_setsockopt+0x1bd/0x390 net/socket.c:1903 __do_sys_setsockopt net/socket.c:1914 [inline] __se_sys_setsockopt net/socket.c:1911 [inline] __x64_sys_setsockopt+0xbe/0x150 net/socket.c:1911 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4418c9 RSP: 002b:00007fff985b7a08 EFLAGS: 00000207 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004418c9 RDX: 0000000000000016 RSI: 0000000000000006 RDI: 0000000000000003 RBP: 0000000000000000 R08: 000000002000023b R09: 0000000000000010 R10: 0000000020000040 R11: 0000000000000207 R12: 0000000000012526 R13: 0000000000402d10 R14: 00000000006cd440 R15: 0000000000000000 BUG: sleeping function called from invalid context at mm/slab.h:421 in_atomic(): 1, irqs_disabled(): 1, pid: 8291, name: syz-executor787 INFO: lockdep is turned off. irq event stamp: 2022 hardirqs last enabled at (2021): [] restore_regs_and_return_to_kernel+0x0/0x2b hardirqs last disabled at (2022): [] interrupt_entry+0xb5/0xf0 arch/x86/entry/entry_64.S:625 softirqs last enabled at (1932): [] __do_softirq+0x778/0xaf5 kernel/softirq.c:311 softirqs last disabled at (1905): [] invoke_softirq kernel/softirq.c:365 [inline] softirqs last disabled at (1905): [] irq_exit+0x1d1/0x200 kernel/softirq.c:405 CPU: 0 PID: 8291 Comm: syz-executor787 Not tainted 4.17.0-rc2+ #19 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+0x1b9/0x294 lib/dump_stack.c:113 ___might_sleep.cold.87+0x11f/0x13a kernel/sched/core.c:6188 __might_sleep+0x95/0x190 kernel/sched/core.c:6141 slab_pre_alloc_hook mm/slab.h:421 [inline] slab_alloc mm/slab.c:3378 [inline] __do_kmalloc mm/slab.c:3716 [inline] __kmalloc+0x2b9/0x760 mm/slab.c:3727 kmalloc_array include/linux/slab.h:631 [inline] kcalloc include/linux/slab.h:642 [inline] numa_crng_init drivers/char/random.c:798 [inline] crng_reseed+0x427/0x920 drivers/char/random.c:923 credit_entropy_bits+0x98d/0xa30 drivers/char/random.c:708 add_interrupt_randomness+0x494/0x860 drivers/char/random.c:1254 handle_irq_event_percpu+0xf9/0x1c0 kernel/irq/handle.c:191 handle_irq_event+0xa7/0x135 kernel/irq/handle.c:206 handle_edge_irq+0x20f/0x870 kernel/irq/chip.c:791 generic_handle_irq_desc include/linux/irqdesc.h:159 [inline] handle_irq+0x18c/0x2e7 arch/x86/kernel/irq_64.c:77 do_IRQ+0x78/0x190 arch/x86/kernel/irq.c:245 common_interrupt+0xf/0xf arch/x86/entry/entry_64.S:642 RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:783 [inline] RIP: 0010:lock_acquire+0x257/0x520 kernel/locking/lockdep.c:3923 RSP: 0018:ffff8801afa5f910 EFLAGS: 00000286 ORIG_RAX: ffffffffffffffd9 RAX: dffffc0000000000 RBX: 1ffff10035f4bf27 RCX: 0000000000000000 RDX: 1ffffffff11a315d RSI: ffff8801af8ec9f8 RDI: 0000000000000286 RBP: ffff8801afa5fa00 R08: 000000000000698b R09: 0000000000000001 R10: ffff8801af8eca20 R11: ffff8801af8ec1c0 R12: ffff8801af8ec1c0 R13: 0000000000000001 R14: 0000000000000001 R15: 0000000000000000 __might_fault+0x155/0x1e0 mm/memory.c:4555 _copy_from_user+0x30/0x150 lib/usercopy.c:10 copy_from_user include/linux/uaccess.h:147 [inline] tcp_repair_options_est net/ipv4/tcp.c:2639 [inline] do_tcp_setsockopt.isra.40+0x950/0x2600 net/ipv4/tcp.c:2836 tcp_setsockopt+0xc1/0xe0 net/ipv4/tcp.c:3031 sock_common_setsockopt+0x9a/0xe0 net/core/sock.c:3042 __sys_setsockopt+0x1bd/0x390 net/socket.c:1903 __do_sys_setsockopt net/socket.c:1914 [inline] __se_sys_setsockopt net/socket.c:1911 [inline] __x64_sys_setsockopt+0xbe/0x150 net/socket.c:1911 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4418c9 RSP: 002b:00007fff985b7a08 EFLAGS: 00000207 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004418c9 RDX: 0000000000000016 RSI: 0000000000000006 RDI: 0000000000000003 RBP: 0000000000000000 R08: 000000002000023b R09: 0000000000000010 R10: 0000000020000040 R11: 0000000000000207 R12: 0000000000012526 R13: 0000000000402d10 R14: 00000000006cd440 R15: 0000000000000000 random: crng init done