====================================================== WARNING: possible circular locking dependency detected 4.16.0-rc4+ #260 Not tainted ------------------------------------------------------ syz-executor7/8338 is trying to acquire lock: (&sb->s_type->i_mutex_key#11){++++}, at: [<000000007d542ced>] inode_lock include/linux/fs.h:713 [inline] (&sb->s_type->i_mutex_key#11){++++}, at: [<000000007d542ced>] shmem_file_llseek+0xef/0x240 mm/shmem.c:2579 but task is already holding lock: (ashmem_mutex){+.+.}, at: [<000000005a8aaf56>] ashmem_llseek+0x56/0x1f0 drivers/staging/android/ashmem.c:326 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (ashmem_mutex){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0x16f/0x1a80 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 ashmem_mmap+0x53/0x410 drivers/staging/android/ashmem.c:362 call_mmap include/linux/fs.h:1786 [inline] mmap_region+0xa99/0x15a0 mm/mmap.c:1705 do_mmap+0x6c0/0xe00 mm/mmap.c:1483 do_mmap_pgoff include/linux/mm.h:2223 [inline] vm_mmap_pgoff+0x1de/0x280 mm/util.c:355 SYSC_mmap_pgoff mm/mmap.c:1533 [inline] SyS_mmap_pgoff+0x462/0x5f0 mm/mmap.c:1491 do_syscall_32_irqs_on arch/x86/entry/common.c:330 [inline] do_fast_syscall_32+0x3ec/0xf9f arch/x86/entry/common.c:392 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 -> #1 (&mm->mmap_sem){++++}: __might_fault+0x13a/0x1d0 mm/memory.c:4571 _copy_to_user+0x2c/0xc0 lib/usercopy.c:25 copy_to_user include/linux/uaccess.h:155 [inline] filldir+0x1a7/0x320 fs/readdir.c:196 dir_emit_dot include/linux/fs.h:3370 [inline] dir_emit_dots include/linux/fs.h:3381 [inline] dcache_readdir+0x12d/0x5e0 fs/libfs.c:192 iterate_dir+0x1ca/0x530 fs/readdir.c:51 SYSC_getdents fs/readdir.c:231 [inline] SyS_getdents+0x225/0x450 fs/readdir.c:212 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> #0 (&sb->s_type->i_mutex_key#11){++++}: lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3920 down_write+0x87/0x120 kernel/locking/rwsem.c:70 inode_lock include/linux/fs.h:713 [inline] shmem_file_llseek+0xef/0x240 mm/shmem.c:2579 vfs_llseek+0xa2/0xd0 fs/read_write.c:300 ashmem_llseek+0xe7/0x1f0 drivers/staging/android/ashmem.c:338 vfs_llseek fs/read_write.c:300 [inline] SYSC_lseek fs/read_write.c:313 [inline] SyS_lseek fs/read_write.c:304 [inline] C_SYSC_lseek fs/read_write.c:325 [inline] compat_SyS_lseek+0xeb/0x170 fs/read_write.c:323 do_syscall_32_irqs_on arch/x86/entry/common.c:330 [inline] do_fast_syscall_32+0x3ec/0xf9f arch/x86/entry/common.c:392 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#11 --> &mm->mmap_sem --> ashmem_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(ashmem_mutex); lock(&mm->mmap_sem); lock(ashmem_mutex); lock(&sb->s_type->i_mutex_key#11); *** DEADLOCK *** 1 lock held by syz-executor7/8338: #0: (ashmem_mutex){+.+.}, at: [<000000005a8aaf56>] ashmem_llseek+0x56/0x1f0 drivers/staging/android/ashmem.c:326 stack backtrace: CPU: 0 PID: 8338 Comm: syz-executor7 Not tainted 4.16.0-rc4+ #260 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x24d lib/dump_stack.c:53 print_circular_bug.isra.38+0x2cd/0x2dc 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+0x30a8/0x3e00 kernel/locking/lockdep.c:3431 lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3920 down_write+0x87/0x120 kernel/locking/rwsem.c:70 inode_lock include/linux/fs.h:713 [inline] shmem_file_llseek+0xef/0x240 mm/shmem.c:2579 vfs_llseek+0xa2/0xd0 fs/read_write.c:300 ashmem_llseek+0xe7/0x1f0 drivers/staging/android/ashmem.c:338 vfs_llseek fs/read_write.c:300 [inline] SYSC_lseek fs/read_write.c:313 [inline] SyS_lseek fs/read_write.c:304 [inline] C_SYSC_lseek fs/read_write.c:325 [inline] compat_SyS_lseek+0xeb/0x170 fs/read_write.c:323 do_syscall_32_irqs_on arch/x86/entry/common.c:330 [inline] do_fast_syscall_32+0x3ec/0xf9f arch/x86/entry/common.c:392 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7fb1c99 RSP: 002b:00000000f77ad09c EFLAGS: 00000286 ORIG_RAX: 0000000000000013 RAX: ffffffffffffffda RBX: 0000000000000013 RCX: 00000000fffffffd RDX: 0000000000000004 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 1 CPU: 0 PID: 8645 Comm: syz-executor7 Not tainted 4.16.0-rc4+ #260 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x24d lib/dump_stack.c:53 fail_dump lib/fault-inject.c:51 [inline] should_fail+0x8c0/0xa40 lib/fault-inject.c:149 should_failslab+0xec/0x120 mm/failslab.c:32 slab_pre_alloc_hook mm/slab.h:422 [inline] slab_alloc mm/slab.c:3365 [inline] kmem_cache_alloc+0x47/0x760 mm/slab.c:3539 ptlock_alloc+0x24/0x70 mm/memory.c:4728 ptlock_init include/linux/mm.h:1796 [inline] pgtable_page_ctor include/linux/mm.h:1830 [inline] pte_alloc_one+0x59/0x100 arch/x86/mm/pgtable.c:32 do_huge_pmd_anonymous_page+0xb6a/0x19e0 mm/huge_memory.c:689 create_huge_pmd mm/memory.c:3870 [inline] __handle_mm_fault+0x178a/0x38c0 mm/memory.c:4074 handle_mm_fault+0x44a/0xb10 mm/memory.c:4140 __do_page_fault+0x5c9/0xc90 arch/x86/mm/fault.c:1422 do_page_fault+0xee/0x730 arch/x86/mm/fault.c:1497 page_fault+0x25/0x50 arch/x86/entry/entry_64.S:1151 RIP: 0010:copy_user_generic_unrolled+0x86/0xc0 arch/x86/lib/copy_user_64.S:65 RSP: 0018:ffff8801b5b3f760 EFLAGS: 00010206 RAX: ffffed0036b67f51 RBX: 0000000020000000 RCX: 0000000000000003 RDX: 0000000000000000 RSI: 0000000020000000 RDI: ffff8801b5b3fa70 RBP: ffff8801b5b3f790 R08: ffffed0036b67f51 R09: ffffed0036b67f51 R10: 0000000000000003 R11: ffffed0036b67f50 R12: 0000000000000018 R13: ffff8801b5b3fa70 R14: 00007ffffffff000 R15: 0000000020000018 copy_from_user include/linux/uaccess.h:147 [inline] do_ip_vs_get_ctl+0x25f/0x1570 net/netfilter/ipvs/ip_vs_ctl.c:2688 compat_nf_sockopt net/netfilter/nf_sockopt.c:141 [inline] compat_nf_getsockopt+0xfd/0x130 net/netfilter/nf_sockopt.c:163 compat_ip_getsockopt+0x18a/0x230 net/ipv4/ip_sockglue.c:1602 inet_csk_compat_getsockopt+0x95/0x120 net/ipv4/inet_connection_sock.c:1028 compat_tcp_getsockopt+0x3d/0x70 net/ipv4/tcp.c:3370 compat_sock_common_getsockopt+0xb2/0x140 net/core/sock.c:2945 C_SYSC_getsockopt net/compat.c:523 [inline] compat_SyS_getsockopt+0x182/0x420 net/compat.c:506 do_syscall_32_irqs_on arch/x86/entry/common.c:330 [inline] do_fast_syscall_32+0x3ec/0xf9f arch/x86/entry/common.c:392 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7fb1c99 RSP: 002b:00000000f77ad09c EFLAGS: 00000286 ORIG_RAX: 000000000000016d RAX: ffffffffffffffda RBX: 0000000000000013 RCX: 0000000000000000 RDX: 0000000000000484 RSI: 0000000020000000 RDI: 0000000020d0cffc RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 1 PID: 8692 Comm: syz-executor1 Not tainted 4.16.0-rc4+ #260 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x24d lib/dump_stack.c:53 fail_dump lib/fault-inject.c:51 [inline] should_fail+0x8c0/0xa40 lib/fault-inject.c:149 should_failslab+0xec/0x120 mm/failslab.c:32 slab_pre_alloc_hook mm/slab.h:422 [inline] slab_alloc_node mm/slab.c:3286 [inline] kmem_cache_alloc_node+0x56/0x760 mm/slab.c:3629 alloc_task_struct_node kernel/fork.c:157 [inline] dup_task_struct kernel/fork.c:770 [inline] copy_process.part.38+0x19b0/0x4b60 kernel/fork.c:1631 copy_process kernel/fork.c:1606 [inline] _do_fork+0x1f7/0xf70 kernel/fork.c:2087 SYSC_clone kernel/fork.c:2194 [inline] SyS_clone+0x37/0x50 kernel/fork.c:2188 do_syscall_32_irqs_on arch/x86/entry/common.c:330 [inline] do_fast_syscall_32+0x3ec/0xf9f arch/x86/entry/common.c:392 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7faec99 RSP: 002b:00000000f77aa09c EFLAGS: 00000286 ORIG_RAX: 0000000000000078 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000020178000 RDX: 0000000020b52ffc RSI: 0000000020e41000 RDI: 00000000208b4000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 1 PID: 8720 Comm: syz-executor4 Not tainted 4.16.0-rc4+ #260 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x24d lib/dump_stack.c:53 fail_dump lib/fault-inject.c:51 [inline] should_fail+0x8c0/0xa40 lib/fault-inject.c:149 should_failslab+0xec/0x120 mm/failslab.c:32 slab_pre_alloc_hook mm/slab.h:422 [inline] slab_alloc_node mm/slab.c:3286 [inline] kmem_cache_alloc_node+0x56/0x760 mm/slab.c:3629 alloc_task_struct_node kernel/fork.c:157 [inline] dup_task_struct kernel/fork.c:770 [inline] copy_process.part.38+0x19b0/0x4b60 kernel/fork.c:1631 copy_process kernel/fork.c:1606 [inline] _do_fork+0x1f7/0xf70 kernel/fork.c:2087 SYSC_clone kernel/fork.c:2194 [inline] SyS_clone+0x37/0x50 kernel/fork.c:2188 do_syscall_32_irqs_on arch/x86/entry/common.c:330 [inline] do_fast_syscall_32+0x3ec/0xf9f arch/x86/entry/common.c:392 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7f95c99 RSP: 002b:00000000f779109c EFLAGS: 00000286 ORIG_RAX: 0000000000000078 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000020178000 RDX: 0000000020b52ffc RSI: 0000000020e41000 RDI: 00000000208b4000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 8725 Comm: syz-executor5 Not tainted 4.16.0-rc4+ #260 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x24d lib/dump_stack.c:53 fail_dump lib/fault-inject.c:51 [inline] should_fail+0x8c0/0xa40 lib/fault-inject.c:149 should_failslab+0xec/0x120 mm/failslab.c:32 slab_pre_alloc_hook mm/slab.h:422 [inline] slab_alloc mm/slab.c:3365 [inline] kmem_cache_alloc+0x47/0x760 mm/slab.c:3539 anon_vma_chain_alloc mm/rmap.c:128 [inline] __anon_vma_prepare+0xbc/0x6b0 mm/rmap.c:182 anon_vma_prepare include/linux/rmap.h:153 [inline] do_huge_pmd_anonymous_page+0x1049/0x19e0 mm/huge_memory.c:678 create_huge_pmd mm/memory.c:3870 [inline] __handle_mm_fault+0x178a/0x38c0 mm/memory.c:4074 handle_mm_fault+0x44a/0xb10 mm/memory.c:4140 __do_page_fault+0x5c9/0xc90 arch/x86/mm/fault.c:1422 do_page_fault+0xee/0x730 arch/x86/mm/fault.c:1497 page_fault+0x25/0x50 arch/x86/entry/entry_64.S:1151 RIP: 0010:__put_user_4+0x1c/0x30 arch/x86/lib/putuser.S:68 RSP: 0018:ffff8801b0df7b70 EFLAGS: 00010297 RAX: 0000000000000b00 RBX: 00007fffffffeffd RCX: 00000000200000c0 RDX: ffff8801b0df7bc0 RSI: ffffc900020a0000 RDI: 0000000000000286 RBP: ffff8801b0df7c50 R08: 0000000000000000 R09: 1ffff100361bef4b R10: ffff8801b0df7a20 R11: ffff8801ade7a188 R12: 1ffff100361bef71 R13: ffff8801c33c2480 R14: 00000000000001fa R15: ffff8801b0df7ba8 C_SYSC_wait4+0xa4/0x140 kernel/exit.c:1707 compat_SyS_wait4+0x2c/0x40 kernel/exit.c:1700 do_syscall_32_irqs_on arch/x86/entry/common.c:330 [inline] do_fast_syscall_32+0x3ec/0xf9f arch/x86/entry/common.c:392 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7f57c99 RSP: 002b:00000000f775309c EFLAGS: 00000286 ORIG_RAX: 0000000000000072 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000200000c0 RDX: 00000000a0000002 RSI: 0000000020000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 1 PID: 8741 Comm: syz-executor5 Not tainted 4.16.0-rc4+ #260 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x24d lib/dump_stack.c:53 fail_dump lib/fault-inject.c:51 [inline] should_fail+0x8c0/0xa40 lib/fault-inject.c:149 should_failslab+0xec/0x120 mm/failslab.c:32 slab_pre_alloc_hook mm/slab.h:422 [inline] slab_alloc mm/slab.c:3365 [inline] kmem_cache_alloc+0x47/0x760 mm/slab.c:3539 anon_vma_alloc mm/rmap.c:81 [inline] __anon_vma_prepare+0x39d/0x6b0 mm/rmap.c:189 anon_vma_prepare include/linux/rmap.h:153 [inline] do_huge_pmd_anonymous_page+0x1049/0x19e0 mm/huge_memory.c:678 create_huge_pmd mm/memory.c:3870 [inline] __handle_mm_fault+0x178a/0x38c0 mm/memory.c:4074 handle_mm_fault+0x44a/0xb10 mm/memory.c:4140 __do_page_fault+0x5c9/0xc90 arch/x86/mm/fault.c:1422 do_page_fault+0xee/0x730 arch/x86/mm/fault.c:1497 page_fault+0x25/0x50 arch/x86/entry/entry_64.S:1151 RIP: 0010:__put_user_4+0x1c/0x30 arch/x86/lib/putuser.S:68 RSP: 0018:ffff8801d5acfb70 EFLAGS: 00010297 RAX: 0000000000000b00 RBX: 00007fffffffeffd RCX: 00000000200000c0 RDX: ffff8801d5acfbc0 RSI: ffffc900020a0000 RDI: 0000000000000286 RBP: ffff8801d5acfc50 R08: 0000000000000000 R09: 1ffff1003ab59f4b R10: ffff8801d5acfa20 R11: ffff8801ae212dc8 R12: 1ffff1003ab59f71 R13: ffff8801a9871680 R14: 00000000000001fd R15: ffff8801d5acfba8 C_SYSC_wait4+0xa4/0x140 kernel/exit.c:1707 compat_SyS_wait4+0x2c/0x40 kernel/exit.c:1700 do_syscall_32_irqs_on arch/x86/entry/common.c:330 [inline] do_fast_syscall_32+0x3ec/0xf9f arch/x86/entry/common.c:392 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7f57c99 RSP: 002b:00000000f775309c EFLAGS: 00000286 ORIG_RAX: 0000000000000072 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000200000c0 RDX: 00000000a0000002 RSI: 0000000020000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 QAT: Invalid ioctl audit: type=1400 audit(1520820417.333:52): avc: denied { setopt } for pid=8879 comm="syz-executor7" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_crypto_socket permissive=1 QAT: Invalid ioctl QAT: Invalid ioctl netlink: 8 bytes leftover after parsing attributes in process `syz-executor7'. netlink: 8 bytes leftover after parsing attributes in process `syz-executor7'. audit: type=1400 audit(1520820418.711:53): avc: denied { setuid } for pid=9435 comm="syz-executor4" capability=7 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=cap_userns permissive=1 QAT: Invalid ioctl IPVS: length: 504 != 24 QAT: Invalid ioctl IPVS: length: 504 != 24 audit: type=1400 audit(1520820420.039:54): avc: denied { create } for pid=10029 comm="syz-executor5" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_rdma_socket permissive=1 syz-executor5 uses obsolete (PF_INET,SOCK_PACKET) QAT: Invalid ioctl audit: type=1400 audit(1520820421.933:55): avc: denied { getrlimit } for pid=10510 comm="syz-executor3" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=process permissive=1