====================================================== WARNING: possible circular locking dependency detected 4.14.155-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.4/548 is trying to acquire lock: (pmus_lock){+.+.}, at: [<0000000042f186a9>] swevent_hlist_get kernel/events/core.c:7917 [inline] (pmus_lock){+.+.}, at: [<0000000042f186a9>] perf_swevent_init+0x123/0x4f0 kernel/events/core.c:7977 but task is already holding lock: (&cpuctx_mutex/1){+.+.}, at: [<00000000ec783bb8>] perf_event_ctx_lock_nested+0x15a/0x2d0 kernel/events/core.c:1241 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&cpuctx_mutex/1){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xf7/0x13e0 kernel/locking/mutex.c:893 mutex_lock_double kernel/events/core.c:9939 [inline] __perf_event_ctx_lock_double kernel/events/core.c:9998 [inline] SYSC_perf_event_open kernel/events/core.c:10263 [inline] SyS_perf_event_open+0x12cf/0x2560 kernel/events/core.c:10018 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> #1 (&cpuctx_mutex){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xf7/0x13e0 kernel/locking/mutex.c:893 perf_event_init_cpu+0xa8/0x150 kernel/events/core.c:11261 perf_event_init+0x289/0x2c5 kernel/events/core.c:11308 start_kernel+0x583/0x890 init/main.c:645 secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240 -> #0 (pmus_lock){+.+.}: lock_acquire+0x12b/0x360 kernel/locking/lockdep.c:3994 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xf7/0x13e0 kernel/locking/mutex.c:893 swevent_hlist_get kernel/events/core.c:7917 [inline] perf_swevent_init+0x123/0x4f0 kernel/events/core.c:7977 perf_try_init_event+0xe5/0x200 kernel/events/core.c:9363 perf_init_event kernel/events/core.c:9401 [inline] perf_event_alloc.part.0+0xd1e/0x21d0 kernel/events/core.c:9661 perf_event_alloc kernel/events/core.c:10028 [inline] SYSC_perf_event_open kernel/events/core.c:10135 [inline] SyS_perf_event_open+0x6eb/0x2560 kernel/events/core.c:10018 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 other info that might help us debug this: Chain exists of: pmus_lock --> &cpuctx_mutex --> &cpuctx_mutex/1 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&cpuctx_mutex/1); lock(&cpuctx_mutex); lock(&cpuctx_mutex/1); lock(pmus_lock); *** DEADLOCK *** 3 locks held by syz-executor.4/548: #0: (&sig->cred_guard_mutex){+.+.}, at: [<000000007f9e7ebb>] SYSC_perf_event_open kernel/events/core.c:10115 [inline] #0: (&sig->cred_guard_mutex){+.+.}, at: [<000000007f9e7ebb>] SyS_perf_event_open+0x1359/0x2560 kernel/events/core.c:10018 #1: (&pmus_srcu){....}, at: [<00000000ec7aa143>] perf_event_alloc.part.0+0xb39/0x21d0 kernel/events/core.c:9655 #2: (&cpuctx_mutex/1){+.+.}, at: [<00000000ec783bb8>] perf_event_ctx_lock_nested+0x15a/0x2d0 kernel/events/core.c:1241 stack backtrace: CPU: 1 PID: 548 Comm: syz-executor.4 Not tainted 4.14.155-syzkaller #0 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0xe5/0x154 lib/dump_stack.c:58 print_circular_bug.isra.0.cold+0x2dc/0x425 kernel/locking/lockdep.c:1258 check_prev_add kernel/locking/lockdep.c:1901 [inline] check_prevs_add kernel/locking/lockdep.c:2018 [inline] validate_chain kernel/locking/lockdep.c:2460 [inline] __lock_acquire+0x2f5f/0x4320 kernel/locking/lockdep.c:3487 lock_acquire+0x12b/0x360 kernel/locking/lockdep.c:3994 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xf7/0x13e0 kernel/locking/mutex.c:893 swevent_hlist_get kernel/events/core.c:7917 [inline] perf_swevent_init+0x123/0x4f0 kernel/events/core.c:7977 perf_try_init_event+0xe5/0x200 kernel/events/core.c:9363 perf_init_event kernel/events/core.c:9401 [inline] perf_event_alloc.part.0+0xd1e/0x21d0 kernel/events/core.c:9661 perf_event_alloc kernel/events/core.c:10028 [inline] SYSC_perf_event_open kernel/events/core.c:10135 [inline] SyS_perf_event_open+0x6eb/0x2560 kernel/events/core.c:10018 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x45a639 RSP: 002b:00007f725b7dfc78 EFLAGS: 00000246 ORIG_RAX: 000000000000012a RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 000000000045a639 RDX: 0800000000000000 RSI: 0000000000000000 RDI: 000000002001d000 RBP: 000000000075c118 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000006 R11: 0000000000000246 R12: 00007f725b7e06d4 R13: 00000000004c7b91 R14: 00000000004ddb70 R15: 00000000ffffffff kauditd_printk_skb: 92 callbacks suppressed audit: type=1400 audit(2000001960.660:287392): avc: denied { map } for pid=560 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001960.660:287393): avc: denied { map } for pid=560 comm="blkid" path="/etc/ld.so.cache" dev="sda1" ino=2503 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001960.730:287394): avc: denied { map } for pid=561 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001960.730:287395): avc: denied { map } for pid=561 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001960.940:287396): avc: denied { map } for pid=562 comm="syz-executor.1" path="/root/syz-executor.1" dev="sda1" ino=2339 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001960.940:287397): avc: denied { map } for pid=562 comm="syz-executor.1" path="/root/syz-executor.1" dev="sda1" ino=2339 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001960.940:287398): avc: denied { map } for pid=562 comm="syz-executor.1" path="/root/syzkaller-shm745525924" dev="sda1" ino=16488 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001960.950:287399): avc: denied { map } for pid=562 comm="syz-executor.1" path="/root/syzkaller-shm025750963" dev="sda1" ino=16489 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001960.950:287400): avc: denied { map } for pid=562 comm="syz-executor.1" path="/sys/kernel/debug/kcov" dev="debugfs" ino=5044 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:gpg_exec_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001960.960:287401): avc: denied { map } for pid=562 comm="syz-executor.1" path="/sys/kernel/debug/kcov" dev="debugfs" ino=5044 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:gpg_exec_t:s0 tclass=file permissive=1 selinux_nlmsg_perm: 8 callbacks suppressed SELinux: unrecognized netlink message: protocol=0 nlmsg_type=2405 sclass=netlink_route_socket pig=814 comm=syz-executor.4 kauditd_printk_skb: 496 callbacks suppressed audit: type=1400 audit(2000001965.740:287898): avc: denied { map } for pid=816 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001965.740:287899): avc: denied { map } for pid=816 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001965.740:287900): avc: denied { map } for pid=816 comm="blkid" path="/lib/x86_64-linux-gnu/libblkid.so.1.1.0" dev="sda1" ino=2825 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001965.750:287901): avc: denied { map } for pid=816 comm="blkid" path="/lib/x86_64-linux-gnu/libc-2.13.so" dev="sda1" ino=2784 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001965.750:287902): avc: denied { map } for pid=816 comm="blkid" path="/lib/x86_64-linux-gnu/libc-2.13.so" dev="sda1" ino=2784 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001965.750:287903): avc: denied { map } for pid=810 comm="syz-executor.1" path="/root/syzkaller-testdir889220055/syzkaller.18gExz/1/file0/bus" dev="ramfs" ino=217548 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:ramfs_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001965.760:287904): avc: denied { map } for pid=816 comm="blkid" path="/lib/x86_64-linux-gnu/libuuid.so.1.3.0" dev="sda1" ino=2819 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001965.760:287905): avc: denied { map } for pid=816 comm="blkid" path="/lib/x86_64-linux-gnu/libuuid.so.1.3.0" dev="sda1" ino=2819 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001966.300:287906): avc: denied { map } for pid=823 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000001966.320:287907): avc: denied { map } for pid=823 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=2405 sclass=netlink_route_socket pig=828 comm=syz-executor.4 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=2405 sclass=netlink_route_socket pig=857 comm=syz-executor.4