======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.3.257/6704 is trying to acquire lock:
ffff88807dc98338 (&mm->mmap_lock){++++}-{4:4}, at: __might_fault+0xaf/0x130 mm/memory.c:7271
but task is already holding lock:
ffff8880358a0fb0 (&ctx->map_changing_lock){.+.+}-{4:4}, at: mfill_get_vma+0x162/0x660 mm/userfaultfd.c:226
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&ctx->map_changing_lock){.+.+}-{4:4}:
down_read+0x47/0x2e0 kernel/locking/rwsem.c:1568
mfill_get_vma+0x162/0x660 mm/userfaultfd.c:226
mfill_atomic mm/userfaultfd.c:900 [inline]
mfill_atomic_copy+0x1a8/0x1580 mm/userfaultfd.c:950
userfaultfd_copy fs/userfaultfd.c:1642 [inline]
userfaultfd_ioctl+0x2bbe/0x4c70 fs/userfaultfd.c:2059
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #1 (vm_lock){++++}-{0:0}:
__vma_start_exclude_readers+0x28a/0x940 mm/mmap_lock.c:125
__vma_start_write+0xdc/0x290 mm/mmap_lock.c:148
vma_start_write include/linux/mmap_lock.h:303 [inline]
mprotect_fixup+0x5eb/0xa80 mm/mprotect.c:768
setup_arg_pages+0x565/0xac0 fs/exec.c:670
load_elf_binary+0xc5e/0x2980 fs/binfmt_elf.c:1029
search_binary_handler fs/exec.c:1664 [inline]
exec_binprm fs/exec.c:1696 [inline]
bprm_execve+0x949/0x1470 fs/exec.c:1748
kernel_execve+0x844/0x930 fs/exec.c:1892
try_to_run_init_process+0x13/0x60 init/main.c:1514
kernel_init+0xad/0x1d0 init/main.c:1642
ret_from_fork+0x51e/0xb90 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
-> #0 (&mm->mmap_lock){++++}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3165 [inline]
check_prevs_add kernel/locking/lockdep.c:3284 [inline]
validate_chain kernel/locking/lockdep.c:3908 [inline]
__lock_acquire+0x15a5/0x2cf0 kernel/locking/lockdep.c:5237
lock_acquire+0xf0/0x2e0 kernel/locking/lockdep.c:5868
__might_fault+0xcb/0x130 mm/memory.c:7271
userfaultfd_continue fs/userfaultfd.c:1813 [inline]
userfaultfd_ioctl+0x2372/0x4c70 fs/userfaultfd.c:2071
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
other info that might help us debug this:
Chain exists of:
&mm->mmap_lock --> vm_lock --> &ctx->map_changing_lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
rlock(&ctx->map_changing_lock);
lock(vm_lock);
lock(&ctx->map_changing_lock);
rlock(&mm->mmap_lock);
*** DEADLOCK ***
2 locks held by syz.3.257/6704:
#0: ffff888079a3b308 (vm_lock){++++}-{0:0}, at: lock_vma_under_rcu+0x1d1/0x500 mm/mmap_lock.c:310
#1: ffff8880358a0fb0 (&ctx->map_changing_lock){.+.+}-{4:4}, at: mfill_get_vma+0x162/0x660 mm/userfaultfd.c:226
stack backtrace:
CPU: 0 UID: 0 PID: 6704 Comm: syz.3.257 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2026
Call Trace:
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_circular_bug+0x2e1/0x300 kernel/locking/lockdep.c:2043
check_noncircular+0x12e/0x150 kernel/locking/lockdep.c:2175
check_prev_add kernel/locking/lockdep.c:3165 [inline]
check_prevs_add kernel/locking/lockdep.c:3284 [inline]
validate_chain kernel/locking/lockdep.c:3908 [inline]
__lock_acquire+0x15a5/0x2cf0 kernel/locking/lockdep.c:5237
lock_acquire+0xf0/0x2e0 kernel/locking/lockdep.c:5868
__might_fault+0xcb/0x130 mm/memory.c:7271
userfaultfd_continue fs/userfaultfd.c:1813 [inline]
userfaultfd_ioctl+0x2372/0x4c70 fs/userfaultfd.c:2071
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f9ff1f9c799
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:00007f9ff2d77028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f9ff2215fa0 RCX: 00007f9ff1f9c799
RDX: 0000200000000280 RSI: 00000000c020aa07 RDI: 0000000000000004
RBP: 00007f9ff2032c99 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f9ff2216038 R14: 00007f9ff2215fa0 R15: 00007fff75ed7148
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
CPU: 1 UID: 0 PID: 6704 Comm: syz.3.257 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2026
RIP: 0010:rwsem_mark_wake+0xfa/0x7c0 kernel/locking/rwsem.c:445
Code: 01 00 74 08 4c 89 f7 e8 44 d8 8d 00 4c 89 74 24 10 4d 8b 26 4d 8d 74 24 18 4c 89 f0 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <0f> b6 04 08 84 c0 0f 85 75 06 00 00 41 83 3e 00 74 64 4c 89 ef be
RSP: 0018:ffffc90003967460 EFLAGS: 00010006
RAX: 0000000000000003 RBX: 0000000000000000 RCX: dffffc0000000000
RDX: 1ffff9200072ce98 RSI: 0000000000000000 RDI: ffff88807dc982d0
RBP: ffffc90003967560 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff5200072cea8 R12: 0000000000000000
R13: ffff88807dc982d0 R14: 0000000000000018 R15: ffffc90003967620
FS: 00007f9ff2d776c0(0000) GS:ffff888124ee2000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f44b1be92f8 CR3: 00000000759f2000 CR4: 00000000003526f0
Call Trace:
rwsem_del_wake_waiter+0x25d/0x2e0 kernel/locking/rwsem.c:612
rwsem_down_read_slowpath+0x76c/0x940 kernel/locking/rwsem.c:1128
__down_read_common kernel/locking/rwsem.c:1291 [inline]
__down_read_killable kernel/locking/rwsem.c:1314 [inline]
down_read_killable+0x9e/0x340 kernel/locking/rwsem.c:1595
mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:601
get_mmap_lock_carefully mm/mmap_lock.c:450 [inline]
lock_mm_and_find_vma+0x2d7/0x340 mm/mmap_lock.c:501
do_user_addr_fault+0x330/0x1340 arch/x86/mm/fault.c:1357
handle_page_fault arch/x86/mm/fault.c:1474 [inline]
exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1527
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618
RIP: 0010:__put_user_8+0xd/0x20 arch/x86/lib/putuser.S:115
Code: 89 01 31 c9 0f 01 ca e9 c1 79 03 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 48 89 cb 48 c1 fb 3f 48 09 d9 0f 01 cb <48> 89 01 31 c9 0f 01 ca e9 96 79 03 00 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc90003967938 EFLAGS: 00050202
RAX: ffffffffffffffea RBX: 0000000000000000 RCX: 0000200000000298
RDX: ffffc900060b2000 RSI: ffffffff8c4a6260 RDI: ffffffff8c4a6220
RBP: ffffc90003967ea8 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffffbfff1d46e44 R12: ffffffffffffffea
R13: ffff8880358a0dc0 R14: fffff5200072cf3c R15: 00007ffffffff000
userfaultfd_continue fs/userfaultfd.c:1813 [inline]
userfaultfd_ioctl+0x2381/0x4c70 fs/userfaultfd.c:2071
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f9ff1f9c799
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:00007f9ff2d77028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f9ff2215fa0 RCX: 00007f9ff1f9c799
RDX: 0000200000000280 RSI: 00000000c020aa07 RDI: 0000000000000004
RBP: 00007f9ff2032c99 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f9ff2216038 R14: 00007f9ff2215fa0 R15: 00007fff75ed7148
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:rwsem_mark_wake+0xfa/0x7c0 kernel/locking/rwsem.c:445
Code: 01 00 74 08 4c 89 f7 e8 44 d8 8d 00 4c 89 74 24 10 4d 8b 26 4d 8d 74 24 18 4c 89 f0 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <0f> b6 04 08 84 c0 0f 85 75 06 00 00 41 83 3e 00 74 64 4c 89 ef be
RSP: 0018:ffffc90003967460 EFLAGS: 00010006
RAX: 0000000000000003 RBX: 0000000000000000 RCX: dffffc0000000000
RDX: 1ffff9200072ce98 RSI: 0000000000000000 RDI: ffff88807dc982d0
RBP: ffffc90003967560 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff5200072cea8 R12: 0000000000000000
R13: ffff88807dc982d0 R14: 0000000000000018 R15: ffffc90003967620
FS: 00007f9ff2d776c0(0000) GS:ffff888124ee2000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f44b1be92f8 CR3: 00000000759f2000 CR4: 00000000003526f0
----------------
Code disassembly (best guess):
0: 01 00 add %eax,(%rax)
2: 74 08 je 0xc
4: 4c 89 f7 mov %r14,%rdi
7: e8 44 d8 8d 00 call 0x8dd850
c: 4c 89 74 24 10 mov %r14,0x10(%rsp)
11: 4d 8b 26 mov (%r14),%r12
14: 4d 8d 74 24 18 lea 0x18(%r12),%r14
19: 4c 89 f0 mov %r14,%rax
1c: 48 c1 e8 03 shr $0x3,%rax
20: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
27: fc ff df
* 2a: 0f b6 04 08 movzbl (%rax,%rcx,1),%eax <-- trapping instruction
2e: 84 c0 test %al,%al
30: 0f 85 75 06 00 00 jne 0x6ab
36: 41 83 3e 00 cmpl $0x0,(%r14)
3a: 74 64 je 0xa0
3c: 4c 89 ef mov %r13,%rdi
3f: be .byte 0xbe