From: syzbot <syzbot+47b9baba841bdc075ade@syzkaller.appspotmail.com>
To: akpm@linux-foundation.org, david@kernel.org,
josef@toxicpanda.com, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
muchun.song@linux.dev, nbd@other.debian.org, osalvador@suse.de,
syzkaller-bugs@googlegroups.com
Subject: [syzbot] [nbd?] possible deadlock in mfill_atomic_copy (2)
Date: Tue, 01 Dec 2026 23:33:31 -0800 [thread overview]
Message-ID: <6b0fc9cb.8744ccba.1c9cf9.002d.GAE@google.com> (raw)
Hello,
syzbot found the following issue on:
HEAD commit: 19cc08c1a6a6 Merge tag 'clk-fixes-for-linus-v7.4' of git:/..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10fef8cd580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d07b2352498f5906
dashboard link: https://syzkaller.appspot.com/bug?extid=47b9baba841bdc075ade
compiler: Debian clang version 22.1.8 (1~deb13u5), Debian LLD 22.1.8
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/65750e0780e0/disk-19cc08c1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/7910ac637ef0/vmlinux-19cc08c1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d6b8d3ab3024/bzImage-19cc08c1.xz
AI-generated root cause summary:
In drivers/block/nbd.c, nbd_add_socket() and nbd_genl_reconnect_sock_cb() look
up a userspace socket file descriptor via sockfd_lookup() and call
nbd_reclassify_socket() to assign the socket an NBD-specific lockdep class
(sk_lock-AF_INET-NBD). However, nbd_reclassify_socket() silently returns without
reclassifying if sock_allow_reclassification(sk) is false (e.g., when a
concurrent userspace call or softirq holds sk->sk_lock), leaving the NBD socket
in the generic sk_lock-AF_INET class. Because nbd_mark_nsock_dead() acquires
sk->sk_lock via kernel_sock_shutdown() while holding nsock->tx_lock—which sits
under block-layer and fs_reclaim dependencies (fs_reclaim -> q_usage_counter ->
q->elevator_lock -> set->srcu -> cmd->lock -> nsock->tx_lock)—retaining the
shared sk_lock-AF_INET class links fs_reclaim to mm->mmap_lock (via
tcp_sendmsg_locked() -> __might_fault()) and creates a circular dependency with
hugetlb locking (mm->mmap_lock -> hugetlb_fault_mutex_table -> resv_map->rw_sema
-> fs_reclaim).
full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=47b9baba841bdc075ade
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+47b9baba841bdc075ade@syzkaller.appspotmail.com
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Tainted: G L
------------------------------------------------------
syz.5.1556/10634 is trying to acquire lock:
ffff888067b014e0 (&resv_map->rw_sema){++++}-{4:4}, at: mfill_atomic_hugetlb mm/userfaultfd.c:841 [inline]
ffff888067b014e0 (&resv_map->rw_sema){++++}-{4:4}, at: mfill_atomic mm/userfaultfd.c:974 [inline]
ffff888067b014e0 (&resv_map->rw_sema){++++}-{4:4}, at: mfill_atomic_copy+0xba3/0x14e0 mm/userfaultfd.c:1016
but task is already holding lock:
ffff888022e8e170 (&hugetlb_fault_mutex_table[i]){+.+.}-{4:4}, at: mfill_atomic_hugetlb mm/userfaultfd.c:840 [inline]
ffff888022e8e170 (&hugetlb_fault_mutex_table[i]){+.+.}-{4:4}, at: mfill_atomic mm/userfaultfd.c:974 [inline]
ffff888022e8e170 (&hugetlb_fault_mutex_table[i]){+.+.}-{4:4}, at: mfill_atomic_copy+0xb96/0x14e0 mm/userfaultfd.c:1016
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #9 (&hugetlb_fault_mutex_table[i]){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821
hugetlb_fault+0x3b5/0x1450 mm/hugetlb.c:6165
handle_mm_fault+0x2026/0x2f80 mm/memory.c:7014
faultin_page mm/gup.c:1140 [inline]
__get_user_pages+0x102b/0x1e90 mm/gup.c:1442
populate_vma_page_range+0x311/0x3f0 mm/gup.c:1878
__mm_populate+0x25f/0x390 mm/gup.c:1981
mm_populate include/linux/mm.h:4513 [inline]
vm_mmap_pgoff+0x36e/0x520 mm/util.c:586
ksys_mmap_pgoff+0x57d/0x760 mm/mmap.c:619
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #8 (&mm->mmap_lock){++++}-{4:4}:
__might_fault+0xcb/0x130 mm/memory.c:7607
_copy_from_iter+0x100/0x1680 lib/iov_iter.c:271
copy_from_iter include/linux/uio.h:236 [inline]
copy_from_iter_full include/linux/uio.h:253 [inline]
skb_do_copy_data_nocache include/net/sock.h:2345 [inline]
skb_copy_to_page_nocache include/net/sock.h:2371 [inline]
tcp_sendmsg_locked+0x244e/0x57c0 net/ipv4/tcp.c:1324
tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1467
sock_sendmsg_nosec+0x10f/0x190 net/socket.c:801
__sock_sendmsg net/socket.c:818 [inline]
sock_write_iter+0x2de/0x3e0 net/socket.c:1269
new_sync_write fs/read_write.c:575 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:667
ksys_write+0x150/0x270 fs/read_write.c:719
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #7 (sk_lock-AF_INET){+.+.}-{0:0}:
lock_sock_nested+0x41/0x100 net/core/sock.c:3909
lock_sock include/net/sock.h:1717 [inline]
inet_shutdown+0x6a/0x390 net/ipv4/af_inet.c:913
nbd_mark_nsock_dead+0x2cb/0x550 drivers/block/nbd.c:319
recv_work+0x1d14/0x1e30 drivers/block/nbd.c:1030
process_one_work kernel/workqueue.c:3497 [inline]
process_scheduled_works+0xc5d/0x1650 kernel/workqueue.c:3580
worker_thread+0xa47/0xfb0 kernel/workqueue.c:3661
kthread+0x38b/0x480 kernel/kthread.c:436
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
-> #6 (&nsock->tx_lock){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821
nbd_handle_cmd drivers/block/nbd.c:1143 [inline]
nbd_queue_rq+0x373/0xff0 drivers/block/nbd.c:1207
blk_mq_dispatch_rq_list+0x499/0x1990 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+0xd36/0x1580 block/blk-mq-sched.c:307
blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329
blk_mq_run_work_fn+0x167/0x2f0 block/blk-mq.c:2556
process_one_work kernel/workqueue.c:3497 [inline]
process_scheduled_works+0xc5d/0x1650 kernel/workqueue.c:3580
worker_thread+0xa47/0xfb0 kernel/workqueue.c:3661
kthread+0x38b/0x480 kernel/kthread.c:436
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
-> #5 (&cmd->lock){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821
nbd_queue_rq+0xc1/0xff0 drivers/block/nbd.c:1199
blk_mq_dispatch_rq_list+0x499/0x1990 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+0xd36/0x1580 block/blk-mq-sched.c:307
blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329
blk_mq_run_work_fn+0x167/0x2f0 block/blk-mq.c:2556
process_one_work kernel/workqueue.c:3497 [inline]
process_scheduled_works+0xc5d/0x1650 kernel/workqueue.c:3580
worker_thread+0xa47/0xfb0 kernel/workqueue.c:3661
kthread+0x38b/0x480 kernel/kthread.c:436
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
-> #4 (set->srcu){.+.+}-{0:0}:
srcu_lock_sync include/linux/srcu.h:261 [inline]
__synchronize_srcu+0xca/0x2f0 kernel/rcu/srcutree.c:1662
elevator_switch+0x1e8/0x7b0 block/elevator.c:576
elevator_change+0x2fa/0x480 block/elevator.c:681
elevator_set_default+0x375/0x440 block/elevator.c:754
blk_register_queue+0x404/0x4f0 block/blk-sysfs.c:992
__add_disk+0x6b8/0xdb0 block/genhd.c:531
add_disk_fwnode+0x100/0x3a0 block/genhd.c:600
add_disk include/linux/blkdev.h:799 [inline]
nbd_dev_add+0x733/0xb60 drivers/block/nbd.c:2027
nbd_init+0x168/0x1f0 drivers/block/nbd.c:2744
do_one_initcall+0x250/0x870 init/main.c:1432
do_initcall_level+0x10a/0x1a0 init/main.c:1494
do_initcalls+0x59/0xa0 init/main.c:1510
kernel_init_freeable+0x29d/0x3e0 init/main.c:1745
kernel_init+0x22/0x1d0 init/main.c:1635
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
-> #3 (&q->elevator_lock){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821
elevator_change+0x1af/0x480 block/elevator.c:679
elv_iosched_store+0x50e/0x630 block/elevator.c:831
queue_attr_store+0x207/0x2b0 block/blk-sysfs.c:906
kernfs_fop_write_iter+0x3a4/0x540 fs/kernfs/file.c:345
new_sync_write fs/read_write.c:575 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:667
ksys_write+0x150/0x270 fs/read_write.c:719
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #2 (&q->q_usage_counter(io)#17){++++}-{0:0}:
blk_alloc_queue+0x544/0x690 block/blk-core.c:503
blk_mq_alloc_queue block/blk-mq.c:4471 [inline]
__blk_mq_alloc_disk+0x194/0x390 block/blk-mq.c:4518
loop_add+0x480/0xb40 drivers/block/loop.c:1971
loop_init+0xd7/0x160 drivers/block/loop.c:2210
do_one_initcall+0x250/0x870 init/main.c:1432
do_initcall_level+0x10a/0x1a0 init/main.c:1494
do_initcalls+0x59/0xa0 init/main.c:1510
kernel_init_freeable+0x29d/0x3e0 init/main.c:1745
kernel_init+0x22/0x1d0 init/main.c:1635
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
-> #1 (fs_reclaim){+.+.}-{0:0}:
__fs_reclaim_acquire mm/page_alloc.c:4388 [inline]
fs_reclaim_acquire+0x71/0x100 mm/page_alloc.c:4402
might_alloc include/linux/sched/mm.h:316 [inline]
prepare_alloc_pages+0x149/0x5f0 mm/page_alloc.c:5165
__alloc_frozen_pages_noprof+0x189/0x450 mm/page_alloc.c:5490
alloc_pages_mpol+0x21e/0x390 mm/mempolicy.c:2520
alloc_frozen_pages_noprof mm/mempolicy.c:2591 [inline]
alloc_pages_noprof+0xb1/0x2b0 mm/mempolicy.c:2611
pagetable_alloc_noprof include/linux/mm.h:4014 [inline]
__pud_alloc_one_noprof include/asm-generic/pgalloc.h:181 [inline]
pud_alloc_one_noprof include/asm-generic/pgalloc.h:206 [inline]
__pud_alloc+0x3a/0x460 mm/memory.c:7082
pud_alloc include/linux/mm.h:3924 [inline]
huge_pte_alloc+0x516/0x660 mm/hugetlb.c:7288
hugetlb_fault+0x412/0x1450 mm/hugetlb.c:6173
handle_mm_fault+0x2026/0x2f80 mm/memory.c:7014
faultin_page mm/gup.c:1140 [inline]
__get_user_pages+0x102b/0x1e90 mm/gup.c:1442
populate_vma_page_range+0x311/0x3f0 mm/gup.c:1878
__mm_populate+0x25f/0x390 mm/gup.c:1981
mm_populate include/linux/mm.h:4513 [inline]
vm_mmap_pgoff+0x36e/0x520 mm/util.c:586
ksys_mmap_pgoff+0x57d/0x760 mm/mmap.c:619
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&resv_map->rw_sema){++++}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3209 [inline]
check_prevs_add kernel/locking/lockdep.c:3328 [inline]
validate_chain kernel/locking/lockdep.c:3952 [inline]
__lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288
lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942
down_read+0x45/0x320 kernel/locking/rwsem.c:1574
mfill_atomic_hugetlb mm/userfaultfd.c:841 [inline]
mfill_atomic mm/userfaultfd.c:974 [inline]
mfill_atomic_copy+0xba3/0x14e0 mm/userfaultfd.c:1016
userfaultfd_copy+0x413/0x7e0 mm/userfaultfd.c:4137
userfaultfd_ioctl+0x49a/0x560 mm/userfaultfd.c:4705
vfs_ioctl fs/ioctl.c:52 [inline]
__do_sys_ioctl fs/ioctl.c:598 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
other info that might help us debug this:
Chain exists of:
&resv_map->rw_sema --> &mm->mmap_lock --> &hugetlb_fault_mutex_table[i]
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&hugetlb_fault_mutex_table[i]);
lock(&mm->mmap_lock);
lock(&hugetlb_fault_mutex_table[i]);
rlock(&resv_map->rw_sema);
*** DEADLOCK ***
locks held by syz.5.1556/10634: 3, on CPU#0:
#0: ffff88807e808088 (vm_lock){++++}-{0:0}, at: lock_vma_under_rcu+0x1d1/0x500 mm/mmap_lock.c:339
#1: ffff888076851d70 (&ctx->map_changing_lock){++++}-{4:4}, at: mfill_get_vma+0x166/0x6d0 mm/userfaultfd.c:216
#2: ffff888022e8e170 (&hugetlb_fault_mutex_table[i]){+.+.}-{4:4}, at: mfill_atomic_hugetlb mm/userfaultfd.c:840 [inline]
#2: ffff888022e8e170 (&hugetlb_fault_mutex_table[i]){+.+.}-{4:4}, at: mfill_atomic mm/userfaultfd.c:974 [inline]
#2: ffff888022e8e170 (&hugetlb_fault_mutex_table[i]){+.+.}-{4:4}, at: mfill_atomic_copy+0xb96/0x14e0 mm/userfaultfd.c:1016
stack backtrace:
CPU: 0 UID: 0 PID: 10634 Comm: syz.5.1556 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:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2087
check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2219
check_prev_add kernel/locking/lockdep.c:3209 [inline]
check_prevs_add kernel/locking/lockdep.c:3328 [inline]
validate_chain kernel/locking/lockdep.c:3952 [inline]
__lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288
lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942
down_read+0x45/0x320 kernel/locking/rwsem.c:1574
mfill_atomic_hugetlb mm/userfaultfd.c:841 [inline]
mfill_atomic mm/userfaultfd.c:974 [inline]
mfill_atomic_copy+0xba3/0x14e0 mm/userfaultfd.c:1016
userfaultfd_copy+0x413/0x7e0 mm/userfaultfd.c:4137
userfaultfd_ioctl+0x49a/0x560 mm/userfaultfd.c:4705
vfs_ioctl fs/ioctl.c:52 [inline]
__do_sys_ioctl fs/ioctl.c:598 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f9db03a9b59
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f9db1236028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f9db0635fa0 RCX: 00007f9db03a9b59
RDX: 0000200000000900 RSI: 00000000c028aa03 RDI: 0000000000000003
RBP: 00007f9db043a18b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f9db0636038 R14: 00007f9db0635fa0 R15: 00007ffe4b81b5e8
</TASK>
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
reply other threads:[~2026-12-02 7:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6b0fc9cb.8744ccba.1c9cf9.002d.GAE@google.com \
--to=syzbot+47b9baba841bdc075ade@syzkaller.appspotmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=nbd@other.debian.org \
--cc=osalvador@suse.de \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.