device team_slave_0 entered promiscuous mode
device team_slave_1 entered promiscuous mode
bridge0: port 3(team0) entered blocking state
======================================================
bridge0: port 3(team0) entered forwarding state
WARNING: possible circular locking dependency detected
4.14.297-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/12064 is trying to acquire lock:
 (event_mutex){+.+.}, at: [<ffffffff815b25e3>] perf_trace_destroy+0x23/0xf0 kernel/trace/trace_event_perf.c:234

but task is already holding lock:
 (&event->child_mutex){+.+.}, at: [<ffffffff8165a588>] perf_event_release_kernel+0x208/0x8a0 kernel/events/core.c:4405

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #5 (&event->child_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       perf_event_for_each_child+0x82/0x140 kernel/events/core.c:4690
       _perf_ioctl+0x471/0x1a60 kernel/events/core.c:4877
       perf_ioctl+0x55/0x80 kernel/events/core.c:4889
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:500 [inline]
       do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
       SYSC_ioctl fs/ioctl.c:701 [inline]
       SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

-> #4 (&cpuctx_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       perf_event_init_cpu+0xb7/0x170 kernel/events/core.c:11286
       perf_event_init+0x2cc/0x308 kernel/events/core.c:11333
       start_kernel+0x45d/0x763 init/main.c:624
       secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240

-> #3 (pmus_lock){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       perf_event_init_cpu+0x2c/0x170 kernel/events/core.c:11280
       cpuhp_invoke_callback+0x1e6/0x1a80 kernel/cpu.c:186
       cpuhp_up_callbacks kernel/cpu.c:574 [inline]
       _cpu_up+0x21e/0x520 kernel/cpu.c:1193
       do_cpu_up+0x9a/0x160 kernel/cpu.c:1229
       smp_init+0x197/0x1ac kernel/smp.c:578
       kernel_init_freeable+0x406/0x626 init/main.c:1074
       kernel_init+0xd/0x15b init/main.c:1006
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406

-> #2 (cpu_hotplug_lock.rw_sem){++++}:
       percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline]
       percpu_down_read include/linux/percpu-rwsem.h:59 [inline]
       cpus_read_lock+0x39/0xc0 kernel/cpu.c:297
       static_key_slow_inc+0xe/0x20 kernel/jump_label.c:123
       tracepoint_add_func+0x747/0xa40 kernel/tracepoint.c:269
       tracepoint_probe_register_prio kernel/tracepoint.c:331 [inline]
       tracepoint_probe_register+0x8c/0xc0 kernel/tracepoint.c:352
       trace_event_reg+0x272/0x330 kernel/trace/trace_events.c:305
       perf_trace_event_reg kernel/trace/trace_event_perf.c:122 [inline]
       perf_trace_event_init kernel/trace/trace_event_perf.c:197 [inline]
       perf_trace_init+0x424/0xa30 kernel/trace/trace_event_perf.c:221
       perf_tp_event_init+0x79/0xf0 kernel/events/core.c:8140
       perf_try_init_event+0x15b/0x1f0 kernel/events/core.c:9374
       perf_init_event kernel/events/core.c:9412 [inline]
       perf_event_alloc.part.0+0xe2d/0x2640 kernel/events/core.c:9672
       perf_event_alloc kernel/events/core.c:10042 [inline]
       SYSC_perf_event_open kernel/events/core.c:10146 [inline]
       SyS_perf_event_open+0x683/0x2530 kernel/events/core.c:10032
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

-> #1 (tracepoints_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       tracepoint_probe_register_prio kernel/tracepoint.c:327 [inline]
       tracepoint_probe_register+0x68/0xc0 kernel/tracepoint.c:352
       trace_event_reg+0x272/0x330 kernel/trace/trace_events.c:305
       perf_trace_event_reg kernel/trace/trace_event_perf.c:122 [inline]
       perf_trace_event_init kernel/trace/trace_event_perf.c:197 [inline]
       perf_trace_init+0x424/0xa30 kernel/trace/trace_event_perf.c:221
       perf_tp_event_init+0x79/0xf0 kernel/events/core.c:8140
       perf_try_init_event+0x15b/0x1f0 kernel/events/core.c:9374
       perf_init_event kernel/events/core.c:9412 [inline]
       perf_event_alloc.part.0+0xe2d/0x2640 kernel/events/core.c:9672
       perf_event_alloc kernel/events/core.c:10042 [inline]
       SYSC_perf_event_open kernel/events/core.c:10146 [inline]
       SyS_perf_event_open+0x683/0x2530 kernel/events/core.c:10032
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

-> #0 (event_mutex){+.+.}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       perf_trace_destroy+0x23/0xf0 kernel/trace/trace_event_perf.c:234
       _free_event+0x321/0xe20 kernel/events/core.c:4246
       free_event+0x32/0x40 kernel/events/core.c:4273
       perf_event_release_kernel+0x368/0x8a0 kernel/events/core.c:4417
       perf_release+0x33/0x40 kernel/events/core.c:4443
       __fput+0x25f/0x7a0 fs/file_table.c:210
       task_work_run+0x11f/0x190 kernel/task_work.c:113
       exit_task_work include/linux/task_work.h:22 [inline]
       do_exit+0xa44/0x2850 kernel/exit.c:868
       SYSC_exit kernel/exit.c:934 [inline]
       SyS_exit+0x1e/0x20 kernel/exit.c:932
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

other info that might help us debug this:

Chain exists of:
  event_mutex --> &cpuctx_mutex --> &event->child_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&event->child_mutex);
                               lock(&cpuctx_mutex);
                               lock(&event->child_mutex);
  lock(event_mutex);

 *** DEADLOCK ***

2 locks held by syz-executor.0/12064:
 #0:  (&ctx->mutex){+.+.}, at: [<ffffffff8165a57e>] perf_event_release_kernel+0x1fe/0x8a0 kernel/events/core.c:4404
 #1:  (&event->child_mutex){+.+.}, at: [<ffffffff8165a588>] perf_event_release_kernel+0x208/0x8a0 kernel/events/core.c:4405

stack backtrace:
CPU: 1 PID: 12064 Comm: syz-executor.0 Not tainted 4.14.297-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1905 [inline]
 check_prevs_add kernel/locking/lockdep.c:2022 [inline]
 validate_chain kernel/locking/lockdep.c:2464 [inline]
 __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __mutex_lock_common kernel/locking/mutex.c:756 [inline]
 __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
 perf_trace_destroy+0x23/0xf0 kernel/trace/trace_event_perf.c:234
 _free_event+0x321/0xe20 kernel/events/core.c:4246
 free_event+0x32/0x40 kernel/events/core.c:4273
 perf_event_release_kernel+0x368/0x8a0 kernel/events/core.c:4417
 perf_release+0x33/0x40 kernel/events/core.c:4443
 __fput+0x25f/0x7a0 fs/file_table.c:210
 task_work_run+0x11f/0x190 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xa44/0x2850 kernel/exit.c:868
 SYSC_exit kernel/exit.c:934 [inline]
 SyS_exit+0x1e/0x20 kernel/exit.c:932
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3
EXT4-fs (loop3): mounted filesystem without journal. Opts: ,errors=continue
kauditd_printk_skb: 22 callbacks suppressed
audit: type=1804 audit(1667452136.447:10): pid=12187 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir2381707789/syzkaller.WeMhK2/85/file0/bus" dev="loop3" ino=18 res=1
EXT4-fs error (device loop3): ext4_validate_block_bitmap:405: comm syz-executor.3: bg 0: block 5: invalid block bitmap
EXT4-fs (loop3): Delayed block allocation failed for inode 18 at logical offset 0 with max blocks 1 with error 117
EXT4-fs (loop3): This should not happen!! Data will be lost

syz-executor.3 (12187) used greatest stack depth: 23504 bytes left
EXT4-fs (loop3): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
audit: type=1804 audit(1667452136.727:11): pid=12256 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir2381707789/syzkaller.WeMhK2/86/file0/bus" dev="loop3" ino=18 res=1
EXT4-fs error (device loop3): ext4_validate_block_bitmap:405: comm syz-executor.3: bg 0: block 5: invalid block bitmap
EXT4-fs (loop3): Delayed block allocation failed for inode 18 at logical offset 0 with max blocks 1 with error 117
EXT4-fs (loop3): This should not happen!! Data will be lost

EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop3): mounted filesystem without journal. Opts: ,errors=continue
audit: type=1804 audit(1667452137.027:12): pid=12308 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.2" name="/root/syzkaller-testdir3850290465/syzkaller.niU5wq/106/file0/bus" dev="loop2" ino=18 res=1
EXT4-fs error (device loop2): ext4_validate_block_bitmap:405: comm syz-executor.2: bg 0: block 5: invalid block bitmap
EXT4-fs (loop2): Delayed block allocation failed for inode 18 at logical offset 0 with max blocks 1 with error 117
EXT4-fs (loop2): This should not happen!! Data will be lost

syz-executor.2 (12308) used greatest stack depth: 23392 bytes left
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
audit: type=1804 audit(1667452137.267:13): pid=12368 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.0" name="/root/syzkaller-testdir1912149620/syzkaller.EbG1sO/87/file0/bus" dev="loop0" ino=18 res=1
EXT4-fs error (device loop0): ext4_validate_block_bitmap:405: comm syz-executor.0: bg 0: block 5: invalid block bitmap
EXT4-fs (loop0): Delayed block allocation failed for inode 18 at logical offset 0 with max blocks 1 with error 117
EXT4-fs (loop3): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop1): ext4_validate_block_bitmap:405: comm syz-executor.1: bg 0: block 5: invalid block bitmap
EXT4-fs (loop0): This should not happen!! Data will be lost

audit: type=1804 audit(1667452137.307:14): pid=12362 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.1" name="/root/syzkaller-testdir3428672120/syzkaller.3PH2tW/101/file0/bus" dev="loop1" ino=18 res=1
EXT4-fs (loop1): Delayed block allocation failed for inode 18 at logical offset 0 with max blocks 1 with error 117
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop3): ext4_validate_block_bitmap:405: comm syz-executor.3: bg 0: block 5: invalid block bitmap
EXT4-fs (loop1): This should not happen!! Data will be lost

EXT4-fs (loop3): Delayed block allocation failed for inode 18 at logical offset 0 with max blocks 1 with error 117
audit: type=1804 audit(1667452137.387:15): pid=12404 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.2" name="/root/syzkaller-testdir3850290465/syzkaller.niU5wq/107/bus" dev="sda1" ino=14236 res=1
audit: type=1804 audit(1667452137.437:16): pid=12381 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir2381707789/syzkaller.WeMhK2/88/file0/bus" dev="loop3" ino=18 res=1
EXT4-fs (loop3): This should not happen!! Data will be lost

EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
audit: type=1804 audit(1667452137.737:17): pid=12434 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.1" name="/root/syzkaller-testdir3428672120/syzkaller.3PH2tW/102/file0/bus" dev="loop1" ino=18 res=1
EXT4-fs error (device loop1): ext4_validate_block_bitmap:405: comm syz-executor.1: bg 0: block 5: invalid block bitmap
EXT4-fs (loop1): Delayed block allocation failed for inode 18 at logical offset 0 with max blocks 1 with error 117
audit: type=1804 audit(1667452137.747:18): pid=12451 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir3550183520/syzkaller.5hal8Q/92/bus" dev="sda1" ino=14248 res=1
EXT4-fs (loop1): This should not happen!! Data will be lost

audit: type=1804 audit(1667452137.827:19): pid=12462 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.5" name="/root/syzkaller-testdir3550183520/syzkaller.5hal8Q/92/bus" dev="sda1" ino=14248 res=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): ext4_validate_block_bitmap:405: comm syz-executor.2: bg 0: block 5: invalid block bitmap
EXT4-fs (loop2): Delayed block allocation failed for inode 18 at logical offset 0 with max blocks 1 with error 117
EXT4-fs (loop2): This should not happen!! Data will be lost

unregister_netdevice: waiting for ip6gre0 to become free. Usage count = -1
kauditd_printk_skb: 26 callbacks suppressed
audit: type=1804 audit(1667452141.957:46): pid=12599 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir2381707789/syzkaller.WeMhK2/96/bus" dev="sda1" ino=14272 res=1
audit: type=1804 audit(1667452141.997:47): pid=12600 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir3420237477/syzkaller.1NjJce/109/bus" dev="sda1" ino=14277 res=1
audit: type=1804 audit(1667452141.997:48): pid=12601 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.2" name="/root/syzkaller-testdir3850290465/syzkaller.niU5wq/110/bus" dev="sda1" ino=14285 res=1
audit: type=1804 audit(1667452142.007:49): pid=12603 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir3550183520/syzkaller.5hal8Q/95/bus" dev="sda1" ino=14286 res=1
audit: type=1804 audit(1667452142.097:50): pid=12612 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.4" name="/root/syzkaller-testdir3420237477/syzkaller.1NjJce/109/bus" dev="sda1" ino=14277 res=1
audit: type=1804 audit(1667452142.107:51): pid=12607 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.3" name="/root/syzkaller-testdir2381707789/syzkaller.WeMhK2/96/bus" dev="sda1" ino=14272 res=1
audit: type=1804 audit(1667452142.117:52): pid=12611 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.2" name="/root/syzkaller-testdir3850290465/syzkaller.niU5wq/110/bus" dev="sda1" ino=14285 res=1
audit: type=1804 audit(1667452142.147:53): pid=12613 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.5" name="/root/syzkaller-testdir3550183520/syzkaller.5hal8Q/95/bus" dev="sda1" ino=14286 res=1
audit: type=1804 audit(1667452142.277:54): pid=12611 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.2" name="/root/syzkaller-testdir3850290465/syzkaller.niU5wq/110/bus" dev="sda1" ino=14285 res=1
audit: type=1804 audit(1667452142.307:55): pid=12613 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.5" name="/root/syzkaller-testdir3550183520/syzkaller.5hal8Q/95/bus" dev="sda1" ino=14286 res=1
UDF-fs: error (device loop5): udf_read_tagged: read failed, block=256, location=256
UDF-fs: error (device loop5): udf_read_tagged: read failed, block=512, location=512
UDF-fs: warning (device loop5): udf_load_vrs: No anchor found
UDF-fs: Scanning with blocksize 512 failed
UDF-fs: error (device loop5): udf_read_tagged: read failed, block=256, location=256
UDF-fs: INFO Mounting volume 'LinuxUDF', timestamp 2022/09/12 12:00 (1000)