====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ syz.8.2498/12962 is trying to acquire lock: ffffffff901db8a0 (fs_reclaim){+.+.}-{0:0}, at: might_alloc include/linux/sched/mm.h:316 [inline] ffffffff901db8a0 (fs_reclaim){+.+.}-{0:0}, at: prepare_alloc_pages+0x166/0x5b0 mm/page_alloc.c:5165 but task is already holding lock: ffff888057f03258 (mapping.invalidate_lock#9){++++}-{4:4}, at: filemap_invalidate_lock_shared include/linux/fs.h:1092 [inline] ffff888057f03258 (mapping.invalidate_lock#9){++++}-{4:4}, at: secretmem_fault+0x1c5/0xbe0 mm/secretmem.c:125 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #8 (mapping.invalidate_lock#9){++++}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 down_read+0x94/0x4c0 kernel/locking/rwsem.c:1574 filemap_invalidate_lock_shared include/linux/fs.h:1092 [inline] secretmem_fault+0x1c5/0xbe0 mm/secretmem.c:125 __do_fault+0x10b/0x440 mm/memory.c:5693 do_shared_fault mm/memory.c:6208 [inline] do_fault+0x524/0x1780 mm/memory.c:6282 do_pte_missing mm/memory.c:4800 [inline] handle_pte_fault mm/memory.c:6697 [inline] __handle_mm_fault+0x1858/0x2f40 mm/memory.c:6849 handle_mm_fault+0x363/0xa30 mm/memory.c:7016 do_user_addr_fault+0x745/0x12f0 arch/x86/mm/fault.c:1394 handle_page_fault arch/x86/mm/fault.c:1483 [inline] exc_page_fault+0x6f/0xd0 arch/x86/mm/fault.c:1536 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595 -> #7 (&mm->mmap_lock){++++}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __might_fault+0xde/0x140 mm/memory.c:7607 _inline_copy_from_user include/linux/uaccess.h:169 [inline] _copy_from_user+0x29/0xd0 lib/usercopy.c:18 copy_from_user include/linux/uaccess.h:222 [inline] csum_and_copy_from_user include/net/checksum.h:31 [inline] copy_from_user_iter_csum net/core/skbuff.c:7703 [inline] iterate_ubuf include/linux/iov_iter.h:30 [inline] iterate_and_advance2 include/linux/iov_iter.h:302 [inline] csum_and_copy_from_iter_full+0x21a/0x1fe0 net/core/skbuff.c:7715 ip_generic_getfrag+0x172/0x270 net/ipv4/ip_output.c:949 raw6_getfrag+0x22c/0x290 net/ipv6/raw.c:743 __ip6_append_data+0x37e8/0x4b10 net/ipv6/ip6_output.c:1739 ip6_append_data net/ipv6/ip6_output.c:1894 [inline] ip6_append_data+0x10b/0x410 net/ipv6/ip6_output.c:1863 rawv6_sendmsg+0x169c/0x4630 net/ipv6/raw.c:917 inet_sendmsg+0x11c/0x140 net/ipv4/af_inet.c:866 sock_sendmsg_nosec net/socket.c:800 [inline] __sock_sendmsg net/socket.c:818 [inline] ____sys_sendmsg+0x9a0/0xb90 net/socket.c:2713 ___sys_sendmsg+0x208/0x270 net/socket.c:2770 __sys_sendmsg+0x160/0x210 net/socket.c:2802 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #6 (sk_lock-AF_INET6){+.+.}-{0:0}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 lock_sock_nested+0x41/0xf0 net/core/sock.c:3909 lock_sock include/net/sock.h:1717 [inline] inet_shutdown+0x67/0x410 net/ipv4/af_inet.c:913 nbd_mark_nsock_dead+0xae/0x5c0 drivers/block/nbd.c:319 sock_shutdown+0x16b/0x200 drivers/block/nbd.c:420 nbd_clear_sock drivers/block/nbd.c:1464 [inline] nbd_config_put+0x3d5/0x9b0 drivers/block/nbd.c:1493 nbd_genl_connect+0xd72/0x1770 drivers/block/nbd.c:2320 genl_family_rcv_msg_doit+0x214/0x300 net/netlink/genetlink.c:1114 genl_family_rcv_msg net/netlink/genetlink.c:1194 [inline] genl_rcv_msg+0x560/0x800 net/netlink/genetlink.c:1209 netlink_rcv_skb+0x159/0x420 net/netlink/af_netlink.c:2585 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218 netlink_unicast_kernel net/netlink/af_netlink.c:1336 [inline] netlink_unicast+0x668/0x950 net/netlink/af_netlink.c:1362 netlink_sendmsg+0x9ac/0x10c0 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:800 [inline] __sock_sendmsg net/socket.c:818 [inline] ____sys_sendmsg+0xa13/0xb90 net/socket.c:2713 ___sys_sendmsg+0x208/0x270 net/socket.c:2770 __sys_sendmsg+0x160/0x210 net/socket.c:2802 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #5 (&nsock->tx_lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 nbd_handle_cmd drivers/block/nbd.c:1143 [inline] nbd_queue_rq+0x42d/0xfa0 drivers/block/nbd.c:1207 blk_mq_dispatch_rq_list+0x428/0x1e60 block/blk-mq.c:2141 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline] blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline] __blk_mq_sched_dispatch_requests+0xcea/0x1620 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd7/0x1c0 block/blk-mq-sched.c:329 blk_mq_run_work_fn+0x130/0x380 block/blk-mq.c:2555 process_one_work+0xaeb/0x1b40 kernel/workqueue.c:3497 process_scheduled_works kernel/workqueue.c:3580 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3661 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #4 (&cmd->lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 nbd_queue_rq+0xba/0xfa0 drivers/block/nbd.c:1199 blk_mq_dispatch_rq_list+0x428/0x1e60 block/blk-mq.c:2141 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline] blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline] __blk_mq_sched_dispatch_requests+0xcea/0x1620 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd7/0x1c0 block/blk-mq-sched.c:329 blk_mq_run_work_fn+0x130/0x380 block/blk-mq.c:2555 process_one_work+0xaeb/0x1b40 kernel/workqueue.c:3497 process_scheduled_works kernel/workqueue.c:3580 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3661 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #3 (set->srcu){.+.+}-{0:0}: lock_sync kernel/locking/lockdep.c:5991 [inline] lock_sync+0xb5/0x120 kernel/locking/lockdep.c:5979 srcu_lock_sync include/linux/srcu.h:261 [inline] __synchronize_srcu+0xa2/0x310 kernel/rcu/srcutree.c:1662 blk_mq_wait_quiesce_done block/blk-mq.c:284 [inline] blk_mq_wait_quiesce_done block/blk-mq.c:281 [inline] blk_mq_quiesce_queue block/blk-mq.c:304 [inline] blk_mq_quiesce_queue+0x149/0x1c0 block/blk-mq.c:299 elevator_switch+0x17b/0x7e0 block/elevator.c:576 elevator_change+0x352/0x530 block/elevator.c:681 elevator_set_default+0x29e/0x360 block/elevator.c:754 blk_register_queue+0x49e/0x640 block/blk-sysfs.c:992 __add_disk+0x7dd/0xf10 block/genhd.c:531 add_disk_fwnode+0x118/0x480 block/genhd.c:600 add_disk include/linux/blkdev.h:799 [inline] nbd_dev_add+0x779/0xb10 drivers/block/nbd.c:2027 nbd_init+0x2c5/0x2e0 drivers/block/nbd.c:2744 do_one_initcall+0x11c/0x6f0 init/main.c:1432 do_initcall_level init/main.c:1494 [inline] do_initcalls init/main.c:1510 [inline] do_basic_setup init/main.c:1530 [inline] kernel_init_freeable+0x6ea/0x7b0 init/main.c:1745 kernel_init+0x21/0x1e0 init/main.c:1635 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #2 (&q->elevator_lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 elevator_change+0x1bc/0x530 block/elevator.c:679 elevator_set_none+0x92/0xf0 block/elevator.c:769 blk_mq_elv_switch_none block/blk-mq.c:5171 [inline] __blk_mq_update_nr_hw_queues block/blk-mq.c:5216 [inline] blk_mq_update_nr_hw_queues+0x4e1/0x1690 block/blk-mq.c:5284 nbd_start_device+0x1a6/0xbd0 drivers/block/nbd.c:1531 nbd_genl_connect+0xfc2/0x1770 drivers/block/nbd.c:2311 genl_family_rcv_msg_doit+0x214/0x300 net/netlink/genetlink.c:1114 genl_family_rcv_msg net/netlink/genetlink.c:1194 [inline] genl_rcv_msg+0x560/0x800 net/netlink/genetlink.c:1209 netlink_rcv_skb+0x159/0x420 net/netlink/af_netlink.c:2585 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218 netlink_unicast_kernel net/netlink/af_netlink.c:1336 [inline] netlink_unicast+0x668/0x950 net/netlink/af_netlink.c:1362 netlink_sendmsg+0x9ac/0x10c0 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:800 [inline] __sock_sendmsg net/socket.c:818 [inline] ____sys_sendmsg+0xa13/0xb90 net/socket.c:2713 ___sys_sendmsg+0x208/0x270 net/socket.c:2770 __sys_sendmsg+0x160/0x210 net/socket.c:2802 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&q->q_usage_counter(io)#49){++++}-{0:0}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 blk_alloc_queue+0x610/0x790 block/blk-core.c:503 blk_mq_alloc_queue+0x174/0x290 block/blk-mq.c:4471 __blk_mq_alloc_disk+0x29/0x120 block/blk-mq.c:4518 nbd_dev_add+0x491/0xb10 drivers/block/nbd.c:1997 nbd_init+0x2c5/0x2e0 drivers/block/nbd.c:2744 do_one_initcall+0x11c/0x6f0 init/main.c:1432 do_initcall_level init/main.c:1494 [inline] do_initcalls init/main.c:1510 [inline] do_basic_setup init/main.c:1530 [inline] kernel_init_freeable+0x6ea/0x7b0 init/main.c:1745 kernel_init+0x21/0x1e0 init/main.c:1635 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #0 (fs_reclaim){+.+.}-{0:0}: check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __fs_reclaim_acquire mm/page_alloc.c:4388 [inline] fs_reclaim_acquire+0xc4/0x100 mm/page_alloc.c:4402 might_alloc include/linux/sched/mm.h:316 [inline] prepare_alloc_pages+0x166/0x5b0 mm/page_alloc.c:5165 __alloc_frozen_pages_noprof+0x1b9/0x31e0 mm/page_alloc.c:5490 alloc_pages_mpol+0x201/0x560 mm/mempolicy.c:2520 alloc_pages_noprof mm/mempolicy.c:2611 [inline] folio_alloc_noprof+0x22/0x250 mm/mempolicy.c:2621 secretmem_fault+0x399/0xbe0 mm/secretmem.c:130 __do_fault+0x10b/0x440 mm/memory.c:5693 do_shared_fault mm/memory.c:6208 [inline] do_fault+0x524/0x1780 mm/memory.c:6282 do_pte_missing mm/memory.c:4800 [inline] handle_pte_fault mm/memory.c:6697 [inline] __handle_mm_fault+0x1858/0x2f40 mm/memory.c:6849 handle_mm_fault+0x363/0xa30 mm/memory.c:7016 do_user_addr_fault+0x745/0x12f0 arch/x86/mm/fault.c:1394 handle_page_fault arch/x86/mm/fault.c:1483 [inline] exc_page_fault+0x6f/0xd0 arch/x86/mm/fault.c:1536 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595 other info that might help us debug this: Chain exists of: fs_reclaim --> &mm->mmap_lock --> mapping.invalidate_lock#9 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(mapping.invalidate_lock#9); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#9); lock(fs_reclaim); *** DEADLOCK *** locks held by syz.8.2498/12962: 2, on CPU#0: #0: ffff888036dcccc0 (&mm->mmap_lock){++++}-{4:4}, at: mmap_read_trylock include/linux/mmap_lock.h:635 [inline] #0: ffff888036dcccc0 (&mm->mmap_lock){++++}-{4:4}, at: get_mmap_lock_carefully mm/mmap_lock.c:568 [inline] #0: ffff888036dcccc0 (&mm->mmap_lock){++++}-{4:4}, at: lock_mm_and_find_vma+0x35/0x750 mm/mmap_lock.c:628 #1: ffff888057f03258 (mapping.invalidate_lock#9){++++}-{4:4}, at: filemap_invalidate_lock_shared include/linux/fs.h:1092 [inline] #1: ffff888057f03258 (mapping.invalidate_lock#9){++++}-{4:4}, at: secretmem_fault+0x1c5/0xbe0 mm/secretmem.c:125 stack backtrace: CPU: 0 UID: 0 PID: 12962 Comm: syz.8.2498 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_circular_bug.cold+0x178/0x1be kernel/locking/lockdep.c:2087 check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2219 check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __fs_reclaim_acquire mm/page_alloc.c:4388 [inline] fs_reclaim_acquire+0xc4/0x100 mm/page_alloc.c:4402 might_alloc include/linux/sched/mm.h:316 [inline] prepare_alloc_pages+0x166/0x5b0 mm/page_alloc.c:5165 __alloc_frozen_pages_noprof+0x1b9/0x31e0 mm/page_alloc.c:5490 alloc_pages_mpol+0x201/0x560 mm/mempolicy.c:2520 alloc_pages_noprof mm/mempolicy.c:2611 [inline] folio_alloc_noprof+0x22/0x250 mm/mempolicy.c:2621 secretmem_fault+0x399/0xbe0 mm/secretmem.c:130 __do_fault+0x10b/0x440 mm/memory.c:5693 do_shared_fault mm/memory.c:6208 [inline] do_fault+0x524/0x1780 mm/memory.c:6282 do_pte_missing mm/memory.c:4800 [inline] handle_pte_fault mm/memory.c:6697 [inline] __handle_mm_fault+0x1858/0x2f40 mm/memory.c:6849 handle_mm_fault+0x363/0xa30 mm/memory.c:7016 do_user_addr_fault+0x745/0x12f0 arch/x86/mm/fault.c:1394 handle_page_fault arch/x86/mm/fault.c:1483 [inline] exc_page_fault+0x6f/0xd0 arch/x86/mm/fault.c:1536 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595 RIP: 0033:0x7f38c5468b82 Code: 30 48 8b 14 24 48 85 d2 74 17 8b 44 24 10 0f c8 89 c0 48 89 44 24 10 48 83 fa 01 0f 85 aa 02 00 00 48 8b 44 24 18 8b 74 24 10 <89> 30 e9 1e fe ff ff 48 8b 44 24 18 8b 10 48 8b 04 24 48 85 c0 0f RSP: 002b:00007fffd3b1ef10 EFLAGS: 00010246 RAX: 0000200000000040 RBX: 0000000000000004 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 00005555634703d8 RBP: 00007fffd3b1f038 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000100000001 R11: 0000000000000004 R12: 00007f38c5835fac R13: 00007fffd3b1f070 R14: 000000000006bddf R15: 00007f38c5835fa0