====================================================== WARNING: possible circular locking dependency detected 4.16.0+ #11 Not tainted ------------------------------------------------------ syzkaller590080/4504 is trying to acquire lock: 000000008b0b6e1d (&mm->mmap_sem){++++}, at: __might_fault+0xfb/0x1e0 mm/memory.c:4554 but task is already holding lock: 0000000078923368 (sk_lock-AF_INET6){+.+.}, at: lock_sock include/net/sock.h:1469 [inline] 0000000078923368 (sk_lock-AF_INET6){+.+.}, at: sctp_sendmsg+0x125e/0x1d70 net/sctp/socket.c:2062 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (sk_lock-AF_INET6){+.+.}: lock_sock_nested+0xd0/0x120 net/core/sock.c:2844 lock_sock include/net/sock.h:1469 [inline] tcp_mmap+0x1c7/0x14f0 net/ipv4/tcp.c:1759 sock_mmap+0x8e/0xc0 net/socket.c:1144 call_mmap include/linux/fs.h:1789 [inline] mmap_region+0xd13/0x1820 mm/mmap.c:1723 do_mmap+0xc79/0x11d0 mm/mmap.c:1494 do_mmap_pgoff include/linux/mm.h:2237 [inline] vm_mmap_pgoff+0x1fb/0x2a0 mm/util.c:355 ksys_mmap_pgoff+0x4c9/0x640 mm/mmap.c:1544 SYSC_mmap arch/x86/kernel/sys_x86_64.c:100 [inline] SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:91 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> #0 (&mm->mmap_sem){++++}: lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920 __might_fault+0x155/0x1e0 mm/memory.c:4555 _copy_from_iter_full+0x2fd/0xd10 lib/iov_iter.c:607 copy_from_iter_full include/linux/uio.h:124 [inline] sctp_user_addto_chunk+0x70/0x1f0 net/sctp/sm_make_chunk.c:1551 sctp_datamsg_from_user+0x945/0x1540 net/sctp/chunk.c:290 sctp_sendmsg_to_asoc+0xd08/0x2100 net/sctp/socket.c:1951 sctp_sendmsg+0x13a8/0x1d70 net/sctp/socket.c:2123 inet_sendmsg+0x19f/0x690 net/ipv4/af_inet.c:798 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:639 __sys_sendto+0x3d7/0x670 net/socket.c:1789 SYSC_sendto net/socket.c:1801 [inline] SyS_sendto+0x40/0x60 net/socket.c:1797 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(sk_lock-AF_INET6); lock(&mm->mmap_sem); lock(sk_lock-AF_INET6); lock(&mm->mmap_sem); *** DEADLOCK *** 1 lock held by syzkaller590080/4504: #0: 0000000078923368 (sk_lock-AF_INET6){+.+.}, at: lock_sock include/net/sock.h:1469 [inline] #0: 0000000078923368 (sk_lock-AF_INET6){+.+.}, at: sctp_sendmsg+0x125e/0x1d70 net/sctp/socket.c:2062 stack backtrace: CPU: 1 PID: 4504 Comm: syzkaller590080 Not tainted 4.16.0+ #11 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_circular_bug.isra.36.cold.54+0x1bd/0x27d kernel/locking/lockdep.c:1223 check_prev_add kernel/locking/lockdep.c:1863 [inline] check_prevs_add kernel/locking/lockdep.c:1976 [inline] validate_chain kernel/locking/lockdep.c:2417 [inline] __lock_acquire+0x343e/0x5140 kernel/locking/lockdep.c:3431 lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920 __might_fault+0x155/0x1e0 mm/memory.c:4555 _copy_from_iter_full+0x2fd/0xd10 lib/iov_iter.c:607 copy_from_iter_full include/linux/uio.h:124 [inline] sctp_user_addto_chunk+0x70/0x1f0 net/sctp/sm_make_chunk.c:1551 sctp_datamsg_from_user+0x945/0x1540 net/sctp/chunk.c:290 sctp_sendmsg_to_asoc+0xd08/0x2100 net/sctp/socket.c:1951 sctp_sendmsg+0x13a8/0x1d70 net/sctp/socket.c:2123 inet_sendmsg+0x19f/0x690 net/ipv4/af_inet.c:798 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:639 __sys_sendto+0x3d7/0x670 net/socket.c:1789 SYSC_sendto net/socket.c:1801 [inline] SyS_sendto+0x40/0x60 net/socket.c:1797 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x43fd49 RSP: 002b:00007ffd6ce99328 EFLAGS: 00000212 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00000000004002c