====================================================== WARNING: possible circular locking dependency detected 4.14.218-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/14494 is trying to acquire lock: (&event->child_mutex){+.+.}, at: [] perf_event_read_value+0x78/0x410 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4453 but task is already holding lock: (&cpuctx_mutex){+.+.}, at: [] perf_event_ctx_lock_nested+0x14d/0x2c0 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:1241 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #5 (&cpuctx_mutex){+.+.}: __mutex_lock_common syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:893 perf_event_init_cpu+0xb7/0x170 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:11250 perf_event_init+0x2cc/0x308 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:11297 start_kernel+0x46a/0x770 syzkaller/managers/linux-4-14/kernel/init/main.c:620 secondary_startup_64+0xa5/0xb0 syzkaller/managers/linux-4-14/kernel/arch/x86/kernel/head_64.S:240 -> #4 (pmus_lock){+.+.}: __mutex_lock_common syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:893 perf_event_init_cpu+0x2c/0x170 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:11244 cpuhp_invoke_callback+0x1e6/0x1a80 syzkaller/managers/linux-4-14/kernel/kernel/cpu.c:184 cpuhp_up_callbacks syzkaller/managers/linux-4-14/kernel/kernel/cpu.c:572 [inline] _cpu_up+0x219/0x500 syzkaller/managers/linux-4-14/kernel/kernel/cpu.c:1144 do_cpu_up+0x9a/0x160 syzkaller/managers/linux-4-14/kernel/kernel/cpu.c:1179 smp_init+0x197/0x1ac syzkaller/managers/linux-4-14/kernel/kernel/smp.c:578 kernel_init_freeable+0x3f4/0x614 syzkaller/managers/linux-4-14/kernel/init/main.c:1068 kernel_init+0xd/0x162 syzkaller/managers/linux-4-14/kernel/init/main.c:1000 ret_from_fork+0x24/0x30 syzkaller/managers/linux-4-14/kernel/arch/x86/entry/entry_64.S:404 -> #3 (cpu_hotplug_lock.rw_sem){++++}: percpu_down_read_preempt_disable syzkaller/managers/linux-4-14/kernel/./include/linux/percpu-rwsem.h:36 [inline] percpu_down_read syzkaller/managers/linux-4-14/kernel/./include/linux/percpu-rwsem.h:59 [inline] cpus_read_lock+0x39/0xc0 syzkaller/managers/linux-4-14/kernel/kernel/cpu.c:295 static_key_slow_inc+0xe/0x20 syzkaller/managers/linux-4-14/kernel/kernel/jump_label.c:123 tracepoint_add_func+0x516/0x750 syzkaller/managers/linux-4-14/kernel/kernel/tracepoint.c:223 tracepoint_probe_register_prio syzkaller/managers/linux-4-14/kernel/kernel/tracepoint.c:283 [inline] tracepoint_probe_register+0x8c/0xc0 syzkaller/managers/linux-4-14/kernel/kernel/tracepoint.c:304 trace_event_reg+0x272/0x330 syzkaller/managers/linux-4-14/kernel/kernel/trace/trace_events.c:305 perf_trace_event_reg syzkaller/managers/linux-4-14/kernel/kernel/trace/trace_event_perf.c:122 [inline] perf_trace_event_init syzkaller/managers/linux-4-14/kernel/kernel/trace/trace_event_perf.c:197 [inline] perf_trace_init+0x424/0xa30 syzkaller/managers/linux-4-14/kernel/kernel/trace/trace_event_perf.c:221 perf_tp_event_init+0x79/0xf0 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:8138 perf_try_init_event+0x15b/0x1f0 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:9369 perf_init_event syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:9407 [inline] perf_event_alloc.part.0+0xe2d/0x2640 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:9667 perf_event_alloc syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:10020 [inline] SYSC_perf_event_open syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:10124 [inline] SyS_perf_event_open+0x67f/0x24b0 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:10010 do_syscall_64+0x1d5/0x640 syzkaller/managers/linux-4-14/kernel/arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb -> #2 (tracepoints_mutex){+.+.}: __mutex_lock_common syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:893 tracepoint_probe_register_prio syzkaller/managers/linux-4-14/kernel/kernel/tracepoint.c:279 [inline] tracepoint_probe_register+0x68/0xc0 syzkaller/managers/linux-4-14/kernel/kernel/tracepoint.c:304 trace_event_reg+0x272/0x330 syzkaller/managers/linux-4-14/kernel/kernel/trace/trace_events.c:305 perf_trace_event_reg syzkaller/managers/linux-4-14/kernel/kernel/trace/trace_event_perf.c:122 [inline] perf_trace_event_init syzkaller/managers/linux-4-14/kernel/kernel/trace/trace_event_perf.c:197 [inline] perf_trace_init+0x424/0xa30 syzkaller/managers/linux-4-14/kernel/kernel/trace/trace_event_perf.c:221 perf_tp_event_init+0x79/0xf0 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:8138 perf_try_init_event+0x15b/0x1f0 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:9369 perf_init_event syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:9407 [inline] perf_event_alloc.part.0+0xe2d/0x2640 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:9667 perf_event_alloc syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:10020 [inline] SYSC_perf_event_open syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:10124 [inline] SyS_perf_event_open+0x67f/0x24b0 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:10010 do_syscall_64+0x1d5/0x640 syzkaller/managers/linux-4-14/kernel/arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb -> #1 (event_mutex){+.+.}: __mutex_lock_common syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:893 perf_trace_destroy+0x23/0xf0 syzkaller/managers/linux-4-14/kernel/kernel/trace/trace_event_perf.c:234 _free_event+0x321/0xe20 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4244 free_event+0x32/0x40 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4271 perf_event_release_kernel+0x368/0x8a0 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4415 perf_release+0x33/0x40 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4441 __fput+0x25f/0x7a0 syzkaller/managers/linux-4-14/kernel/fs/file_table.c:210 task_work_run+0x11f/0x190 syzkaller/managers/linux-4-14/kernel/kernel/task_work.c:113 exit_task_work syzkaller/managers/linux-4-14/kernel/./include/linux/task_work.h:22 [inline] do_exit+0xa44/0x2850 syzkaller/managers/linux-4-14/kernel/kernel/exit.c:868 do_group_exit+0x100/0x2e0 syzkaller/managers/linux-4-14/kernel/kernel/exit.c:965 SYSC_exit_group syzkaller/managers/linux-4-14/kernel/kernel/exit.c:976 [inline] SyS_exit_group+0x19/0x20 syzkaller/managers/linux-4-14/kernel/kernel/exit.c:974 do_syscall_64+0x1d5/0x640 syzkaller/managers/linux-4-14/kernel/arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb -> #0 (&event->child_mutex){+.+.}: lock_acquire+0x170/0x3f0 syzkaller/managers/linux-4-14/kernel/kernel/locking/lockdep.c:3998 __mutex_lock_common syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:893 perf_event_read_value+0x78/0x410 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4453 perf_read_one syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4575 [inline] __perf_read syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4626 [inline] perf_read+0x3e2/0x7c0 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4639 __vfs_read+0xe4/0x620 syzkaller/managers/linux-4-14/kernel/fs/read_write.c:411 vfs_read+0x139/0x340 syzkaller/managers/linux-4-14/kernel/fs/read_write.c:447 SYSC_read syzkaller/managers/linux-4-14/kernel/fs/read_write.c:574 [inline] SyS_read+0xf2/0x210 syzkaller/managers/linux-4-14/kernel/fs/read_write.c:567 do_syscall_64+0x1d5/0x640 syzkaller/managers/linux-4-14/kernel/arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb other info that might help us debug this: Chain exists of: &event->child_mutex --> pmus_lock --> &cpuctx_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&cpuctx_mutex); lock(pmus_lock); lock(&cpuctx_mutex); lock(&event->child_mutex); *** DEADLOCK *** 1 lock held by syz-executor.0/14494: #0: (&cpuctx_mutex){+.+.}, at: [] perf_event_ctx_lock_nested+0x14d/0x2c0 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:1241 stack backtrace: CPU: 0 PID: 14494 Comm: syz-executor.0 Not tainted 4.14.218-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack syzkaller/managers/linux-4-14/kernel/lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 syzkaller/managers/linux-4-14/kernel/lib/dump_stack.c:58 print_circular_bug.constprop.0.cold+0x2d7/0x41e syzkaller/managers/linux-4-14/kernel/kernel/locking/lockdep.c:1258 check_prev_add syzkaller/managers/linux-4-14/kernel/kernel/locking/lockdep.c:1905 [inline] check_prevs_add syzkaller/managers/linux-4-14/kernel/kernel/locking/lockdep.c:2022 [inline] validate_chain syzkaller/managers/linux-4-14/kernel/kernel/locking/lockdep.c:2464 [inline] __lock_acquire+0x2e0e/0x3f20 syzkaller/managers/linux-4-14/kernel/kernel/locking/lockdep.c:3491 lock_acquire+0x170/0x3f0 syzkaller/managers/linux-4-14/kernel/kernel/locking/lockdep.c:3998 __mutex_lock_common syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 syzkaller/managers/linux-4-14/kernel/kernel/locking/mutex.c:893 perf_event_read_value+0x78/0x410 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4453 perf_read_one syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4575 [inline] __perf_read syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4626 [inline] perf_read+0x3e2/0x7c0 syzkaller/managers/linux-4-14/kernel/kernel/events/core.c:4639 __vfs_read+0xe4/0x620 syzkaller/managers/linux-4-14/kernel/fs/read_write.c:411 vfs_read+0x139/0x340 syzkaller/managers/linux-4-14/kernel/fs/read_write.c:447 SYSC_read syzkaller/managers/linux-4-14/kernel/fs/read_write.c:574 [inline] SyS_read+0xf2/0x210 syzkaller/managers/linux-4-14/kernel/fs/read_write.c:567 do_syscall_64+0x1d5/0x640 syzkaller/managers/linux-4-14/kernel/arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x465b09 RSP: 002b:00007f21c541b188 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 000000000056bf60 RCX: 0000000000465b09 RDX: 0000000000002020 RSI: 00000000200003c0 RDI: 0000000000000003 RBP: 00000000004b069f R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf60 R13: 00007ffc4b45a8ef R14: 00007f21c541b300 R15: 0000000000022000 xt_CT: netfilter: NOTRACK target is deprecated, use CT instead or upgrade iptables xt_helper: cannot load conntrack support for proto=2 xt_CT: netfilter: NOTRACK target is deprecated, use CT instead or upgrade iptables ip_tables: iptables: counters copy to user failed while replacing table input: syz1 as /devices/virtual/input/input5 input: syz1 as /devices/virtual/input/input6 input: syz1 as /devices/virtual/input/input7 xt_conntrack: cannot load conntrack support for proto=2 input: syz1 as /devices/virtual/input/input8 input: syz1 as /devices/virtual/input/input9 uinput: write device info first uinput: write device info first uinput: write device info first IPVS: sync thread started: state = MASTER, mcast_ifn = team_slave_1, syncid = 0, id = 0 arp_tables: arptables: counters copy to user failed while replacing table arp_tables: arptables: counters copy to user failed while replacing table uinput: write device info first netlink: 8 bytes leftover after parsing attributes in process `syz-executor.0'. arp_tables: arptables: counters copy to user failed while replacing table uinput: write device info first arp_tables: arptables: counters copy to user failed while replacing table uinput: write device info first uinput: write device info first arp_tables: arptables: counters copy to user failed while replacing table input: syz1 as /devices/virtual/input/input20 uinput: write device info first input: syz1 as /devices/virtual/input/input22 uinput: write device info first uinput: write device info first uinput: write device info first uinput: write device info first input: syz1 as /devices/virtual/input/input27 input: syz1 as /devices/virtual/input/input28 input: syz1 as /devices/virtual/input/input29 input: syz1 as /devices/virtual/input/input30 Cannot find add_set index 0 as target input: syz1 as /devices/virtual/input/input31 NFQUEUE: number of total queues is 0 input: syz1 as /devices/virtual/input/input32 netlink: 12 bytes leftover after parsing attributes in process `syz-executor.2'. NFQUEUE: number of total queues is 0 input: syz1 as /devices/virtual/input/input33 ipt_rpfilter: unknown options encountered NFQUEUE: number of total queues is 0 input: syz1 as /devices/virtual/input/input34 input: syz1 as /devices/virtual/input/input35 arp_tables: arptables: counters copy to user failed while replacing table arp_tables: arptables: counters copy to user failed while replacing table input: syz1 as /devices/virtual/input/input36 arp_tables: arptables: counters copy to user failed while replacing table input: syz1 as /devices/virtual/input/input37 input: syz1 as /devices/virtual/input/input38 input: syz1 as /devices/virtual/input/input39 input: syz1 as /devices/virtual/input/input40 input: syz1 as /devices/virtual/input/input44 input: syz1 as /devices/virtual/input/input45 input: syz1 as /devices/virtual/input/input46 input: syz1 as /devices/virtual/input/input47 input: syz1 as /devices/virtual/input/input48 input: syz1 as /devices/virtual/input/input49 input: syz1 as /devices/virtual/input/input50 audit: type=1326 audit(1612754706.864:125): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=15844 comm="syz-executor.4" exe="/root/syz-executor.4" sig=31 arch=c000003e syscall=202 compat=0 ip=0x465b09 code=0x0 input: syz1 as /devices/virtual/input/input51 input: syz1 as /devices/virtual/input/input52 input: syz1 as /devices/virtual/input/input53 input: syz1 as /devices/virtual/input/input54 input: syz1 as /devices/virtual/input/input55 input: syz1 as /devices/virtual/input/input56 x_tables: ip_tables: socket match: used from hooks INPUT/FORWARD/OUTPUT, but only valid from PREROUTING/INPUT audit: type=1326 audit(1612754707.854:126): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=16077 comm="syz-executor.3" exe="/root/syz-executor.3" sig=31 arch=c000003e syscall=202 compat=0 ip=0x465b09 code=0xffff0000 audit: type=1326 audit(1612754707.884:127): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=16081 comm="syz-executor.5" exe="/root/syz-executor.5" sig=31 arch=c000003e syscall=202 compat=0 ip=0x465b09 code=0x0 audit: type=1326 audit(1612754707.954:128): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=16099 comm="syz-executor.0" exe="/root/syz-executor.0" sig=31 arch=c000003e syscall=202 compat=0 ip=0x465b09 code=0xffff0000 audit: type=1326 audit(1612754707.994:129): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=16081 comm="syz-executor.5" exe="/root/syz-executor.5" sig=31 arch=c000003e syscall=202 compat=0 ip=0x465b09 code=0x0 audit: type=1326 audit(1612754708.674:130): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=16077 comm="syz-executor.3" exe="/root/syz-executor.3" sig=31 arch=c000003e syscall=202 compat=0 ip=0x465b09 code=0xffff0000 audit: type=1326 audit(1612754708.754:131): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=16118 comm="syz-executor.3" exe="/root/syz-executor.3" sig=31 arch=c000003e syscall=202 compat=0 ip=0x465b09 code=0xffff0000 audit: type=1326 audit(1612754708.784:132): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=16099 comm="syz-executor.0" exe="/root/syz-executor.0" sig=31 arch=c000003e syscall=202 compat=0 ip=0x465b09 code=0xffff0000 audit: type=1326 audit(1612754709.584:133): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=16118 comm="syz-executor.3" exe="/root/syz-executor.3" sig=31 arch=c000003e syscall=202 compat=0 ip=0x465b09 code=0xffff0000 audit: type=1326 audit(1612754709.664:134): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=16145 comm="syz-executor.3" exe="/root/syz-executor.3" sig=31 arch=c000003e syscall=202 compat=0 ip=0x465b09 code=0xffff0000 netlink: 8 bytes leftover after parsing attributes in process `syz-executor.2'.