====================================================== WARNING: possible circular locking dependency detected 4.16.0-rc5+ #262 Not tainted ------------------------------------------------------ syz-executor1/24584 is trying to acquire lock: (&mm->mmap_sem){++++}, at: [<000000004f7c2e61>] __might_fault+0xe0/0x1d0 mm/memory.c:4570 but task is already holding lock: (ashmem_mutex){+.+.}, at: [<000000005d898647>] ashmem_pin_unpin drivers/staging/android/ashmem.c:705 [inline] (ashmem_mutex){+.+.}, at: [<000000005d898647>] ashmem_ioctl+0x3db/0x11b0 drivers/staging/android/ashmem.c:782 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (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 -> #0 (&mm->mmap_sem){++++}: lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3920 __might_fault+0x13a/0x1d0 mm/memory.c:4571 _copy_from_user+0x2c/0x110 lib/usercopy.c:10 copy_from_user include/linux/uaccess.h:147 [inline] ashmem_pin_unpin drivers/staging/android/ashmem.c:710 [inline] ashmem_ioctl+0x438/0x11b0 drivers/staging/android/ashmem.c:782 compat_ashmem_ioctl+0x3e/0x50 drivers/staging/android/ashmem.c:813 C_SYSC_ioctl fs/compat_ioctl.c:1461 [inline] compat_SyS_ioctl+0x151/0x2a30 fs/compat_ioctl.c:1407 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: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(ashmem_mutex); lock(&mm->mmap_sem); lock(ashmem_mutex); lock(&mm->mmap_sem); *** DEADLOCK *** 1 lock held by syz-executor1/24584: #0: (ashmem_mutex){+.+.}, at: [<000000005d898647>] ashmem_pin_unpin drivers/staging/android/ashmem.c:705 [inline] #0: (ashmem_mutex){+.+.}, at: [<000000005d898647>] ashmem_ioctl+0x3db/0x11b0 drivers/staging/android/ashmem.c:782 stack backtrace: CPU: 0 PID: 24584 Comm: syz-executor1 Not tainted 4.16.0-rc5+ #262 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 __might_fault+0x13a/0x1d0 mm/memory.c:4571 _copy_from_user+0x2c/0x110 lib/usercopy.c:10 copy_from_user include/linux/uaccess.h:147 [inline] ashmem_pin_unpin drivers/staging/android/ashmem.c:710 [inline] ashmem_ioctl+0x438/0x11b0 drivers/staging/android/ashmem.c:782 compat_ashmem_ioctl+0x3e/0x50 drivers/staging/android/ashmem.c:813 C_SYSC_ioctl fs/compat_ioctl.c:1461 [inline] compat_SyS_ioctl+0x151/0x2a30 fs/compat_ioctl.c:1407 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:0xf7f23c99 RSP: 002b:00000000f771f09c EFLAGS: 00000286 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000013 RCX: 0000000000007709 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 kauditd_printk_skb: 4 callbacks suppressed audit: type=1400 audit(1520952111.742:200): avc: denied { map } for pid=24610 comm="syz-executor1" path=2F6D656D66643A70707031202864656C6574656429 dev="tmpfs" ino=69740 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:tmpfs_t:s0 tclass=file permissive=1 audit: type=1400 audit(1520952112.086:201): avc: denied { create } for pid=24688 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_crypto_socket permissive=1 audit: type=1400 audit(1520952112.088:202): avc: denied { prog_load } for pid=24688 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=bpf permissive=1 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 25249 Comm: syz-executor4 Not tainted 4.16.0-rc5+ #262 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_trace+0x5a/0x760 mm/slab.c:3648 kmalloc_node include/linux/slab.h:550 [inline] kzalloc_node include/linux/slab.h:712 [inline] __get_vm_area_node+0xae/0x340 mm/vmalloc.c:1402 __vmalloc_node_range+0xa3/0x650 mm/vmalloc.c:1754 __vmalloc_node mm/vmalloc.c:1804 [inline] __vmalloc+0x45/0x50 mm/vmalloc.c:1810 bpf_prog_alloc+0xaa/0x350 kernel/bpf/core.c:84 bpf_prog_create_from_user+0xab/0x2b0 net/core/filter.c:1187 fanout_set_data_cbpf net/packet/af_packet.c:1570 [inline] fanout_set_data net/packet/af_packet.c:1604 [inline] packet_setsockopt+0x1149/0x1ea0 net/packet/af_packet.c:3804 compat_packet_setsockopt+0xe1/0x140 net/packet/af_packet.c:3969 C_SYSC_setsockopt net/compat.c:403 [inline] compat_SyS_setsockopt+0x17c/0x410 net/compat.c:386 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:0xf7f41c99 RSP: 002b:00000000f773d09c EFLAGS: 00000286 ORIG_RAX: 000000000000016e RAX: ffffffffffffffda RBX: 0000000000000013 RCX: 0000000000000107 RDX: 0000000000000016 RSI: 0000000020005ff0 RDI: 0000000000000010 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 CPU: 1 PID: 25253 Comm: syz-executor2 Not tainted 4.16.0-rc5+ #262 syz-executor4: vmalloc: allocation failure: 4096 bytes, mode:0x14080c0(GFP_KERNEL|__GFP_ZERO), nodemask=(null) 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 syz-executor4 cpuset= fail_dump lib/fault-inject.c:51 [inline] should_fail+0x8c0/0xa40 lib/fault-inject.c:149 / mems_allowed=0 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 kmem_cache_zalloc include/linux/slab.h:691 [inline] vmx_create_vcpu+0xc4/0x2f20 arch/x86/kvm/vmx.c:9714 kvm_arch_vcpu_create+0x13e/0x1b0 arch/x86/kvm/x86.c:8053 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:2451 [inline] kvm_vm_ioctl+0x49c/0x1cf0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2949 kvm_vm_compat_ioctl+0x2ed/0x3f0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3141 C_SYSC_ioctl fs/compat_ioctl.c:1461 [inline] compat_SyS_ioctl+0x151/0x2a30 fs/compat_ioctl.c:1407 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:0xf7f2cc99 RSP: 002b:00000000f772809c EFLAGS: 00000286 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000014 RCX: 000000000000ae41 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 CPU: 0 PID: 25249 Comm: syz-executor4 Not tainted 4.16.0-rc5+ #262 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 warn_alloc+0x19a/0x2b0 mm/page_alloc.c:3310 __vmalloc_node_range+0x4f0/0x650 mm/vmalloc.c:1775 __vmalloc_node mm/vmalloc.c:1804 [inline] __vmalloc+0x45/0x50 mm/vmalloc.c:1810 bpf_prog_alloc+0xaa/0x350 kernel/bpf/core.c:84 bpf_prog_create_from_user+0xab/0x2b0 net/core/filter.c:1187 fanout_set_data_cbpf net/packet/af_packet.c:1570 [inline] fanout_set_data net/packet/af_packet.c:1604 [inline] packet_setsockopt+0x1149/0x1ea0 net/packet/af_packet.c:3804 compat_packet_setsockopt+0xe1/0x140 net/packet/af_packet.c:3969 C_SYSC_setsockopt net/compat.c:403 [inline] compat_SyS_setsockopt+0x17c/0x410 net/compat.c:386 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:0xf7f41c99 RSP: 002b:00000000f773d09c EFLAGS: 00000286 ORIG_RAX: 000000000000016e RAX: ffffffffffffffda RBX: 0000000000000013 RCX: 0000000000000107 RDX: 0000000000000016 RSI: 0000000020005ff0 RDI: 0000000000000010 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Mem-Info: active_anon:77447 inactive_anon:64 isolated_anon:185 active_file:3750 inactive_file:8655 isolated_file:0 unevictable:0 dirty:153 writeback:0 unstable:0 slab_reclaimable:10860 slab_unreclaimable:88934 mapped:23956 shmem:201 pagetables:707 bounce:0 free:1407942 free_pcp:489 free_cma:0 Node 0 active_anon:315940kB inactive_anon:256kB active_file:15000kB inactive_file:34620kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:95824kB dirty:612kB writeback:0kB shmem:804kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 215040kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no Node 0 DMA free:15908kB min:164kB low:204kB high:244kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15992kB managed:15908kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB lowmem_reserve[]: 0 2864 6373 6373 Node 0 DMA32 free:2934444kB min:30292kB low:37864kB high:45436kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:3129292kB managed:2935316kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:868kB local_pcp:156kB free_cma:0kB lowmem_reserve[]: 0 0 3509 3509 Node 0 Normal free:2674664kB min:37120kB low:46400kB high:55680kB active_anon:318112kB inactive_anon:256kB active_file:15000kB inactive_file:34620kB unevictable:0kB writepending:612kB present:4718592kB managed:3593744kB mlocked:0kB kernel_stack:5088kB pagetables:2828kB bounce:0kB free_pcp:960kB local_pcp:424kB free_cma:0kB lowmem_reserve[]: 0 0 0 0 Node 0 DMA: 1*4kB (U) 0*8kB 0*16kB 1*32kB (U) 2*64kB (U) 1*128kB (U) 1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (M) 3*4096kB (M) = 15908kB Node 0 DMA32: 3*4kB (M) 4*8kB (UM) 2*16kB (UM) 3*32kB (M) 2*64kB (UM) 1*128kB (M) 3*256kB (UM) 3*512kB (UM) 3*1024kB (UM) 2*2048kB (UM) 714*4096kB (M) = 2934444kB Node 0 Normal: 1106*4kB (UM) 1066*8kB (UME) 1217*16kB (UM) 696*32kB (UM) 480*64kB (UME) 45*128kB (UM) 28*256kB (UME) 40*512kB (UM) 26*1024kB (UME) 11*2048kB (U) 612*4096kB (UM) = 2674728kB Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB 12605 total pagecache pages 0 pages in swap cache Swap cache stats: add 0, delete 0, find 0/0 Free swap = 0kB Total swap = 0kB 1965969 pages RAM 0 pages HighMem/MovableOnly 329727 pages reserved audit: type=1400 audit(1520952115.792:203): avc: denied { setopt } for pid=25351 comm="syz-executor2" 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 audit: type=1400 audit(1520952116.792:204): avc: denied { getrlimit } for pid=25601 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=process permissive=1 audit: type=1400 audit(1520952117.033:205): avc: denied { setgid } for pid=25676 comm="syz-executor2" capability=6 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 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 1 PID: 26657 Comm: syz-executor3 Not tainted 4.16.0-rc5+ #262 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 getname_flags+0xcb/0x580 fs/namei.c:138 getname+0x19/0x20 fs/namei.c:209 do_sys_open+0x2e7/0x6d0 fs/open.c:1053 C_SYSC_openat fs/open.c:1105 [inline] compat_SyS_openat+0x2d/0x40 fs/open.c:1103 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: 0000000000000127 RAX: ffffffffffffffda RBX: 00000000ffffff9c RCX: 0000000020000040 RDX: 0000000000004000 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 0 CPU: 0 PID: 26682 Comm: syz-executor0 Not tainted 4.16.0-rc5+ #262 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 getname_flags+0xcb/0x580 fs/namei.c:138 getname+0x19/0x20 fs/namei.c:209 do_sys_open+0x2e7/0x6d0 fs/open.c:1053 C_SYSC_openat fs/open.c:1105 [inline] compat_SyS_openat+0x2d/0x40 fs/open.c:1103 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:0xf7f36c99 RSP: 002b:00000000f773209c EFLAGS: 00000286 ORIG_RAX: 0000000000000127 RAX: ffffffffffffffda RBX: 00000000ffffff9c RCX: 0000000020000040 RDX: 0000000000004000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000