====================================================== WARNING: possible circular locking dependency detected 4.19.211-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/9098 is trying to acquire lock: 00000000429548d7 (&mm->mmap_sem){++++}, at: __might_fault+0xef/0x1d0 mm/memory.c:4771 but task is already holding lock: 0000000029dace8d (&cpuctx_mutex){+.+.}, at: perf_event_ctx_lock_nested+0x237/0x430 kernel/events/core.c:1283 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #5 (&cpuctx_mutex){+.+.}: perf_event_init_cpu+0xc4/0x170 kernel/events/core.c:11828 perf_event_init+0x309/0x34e kernel/events/core.c:11875 start_kernel+0x5b1/0x911 init/main.c:644 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 -> #4 (pmus_lock){+.+.}: perf_event_init_cpu+0x2c/0x170 kernel/events/core.c:11822 cpuhp_invoke_callback+0x201/0x1b80 kernel/cpu.c:170 cpuhp_up_callbacks kernel/cpu.c:584 [inline] _cpu_up+0x25c/0x540 kernel/cpu.c:1192 do_cpu_up+0xdd/0x1b0 kernel/cpu.c:1228 smp_init+0x1ed/0x202 kernel/smp.c:578 kernel_init_freeable+0x62b/0xab7 init/main.c:1138 kernel_init+0xd/0x1ba init/main.c:1062 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 -> #3 (cpu_hotplug_lock.rw_sem){++++}: get_online_cpus include/linux/cpu.h:137 [inline] apply_wqattrs_lock kernel/workqueue.c:3839 [inline] apply_workqueue_attrs kernel/workqueue.c:3898 [inline] alloc_and_link_pwqs kernel/workqueue.c:4022 [inline] __alloc_workqueue_key+0x9ab/0xed0 kernel/workqueue.c:4128 __btrfs_alloc_workqueue+0x40c/0x6c0 fs/btrfs/async-thread.c:146 btrfs_alloc_workqueue+0x7b/0x490 fs/btrfs/async-thread.c:175 scrub_workers_get+0xca/0x2d0 fs/btrfs/scrub.c:3752 btrfs_scrub_dev+0x4ea/0xfd0 fs/btrfs/scrub.c:3876 btrfs_ioctl_scrub fs/btrfs/ioctl.c:4731 [inline] btrfs_ioctl+0x121f/0x76d0 fs/btrfs/ioctl.c:5995 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #2 (&fs_info->scrub_lock){+.+.}: btrfs_scrub_pause+0x93/0x390 fs/btrfs/scrub.c:3952 btrfs_commit_transaction+0x63c/0x2480 fs/btrfs/transaction.c:2098 btrfs_clear_free_space_tree+0x69d/0xa50 fs/btrfs/free-space-tree.c:1255 open_ctree.cold+0x30/0xc3d fs/btrfs/disk-io.c:3203 btrfs_fill_super fs/btrfs/super.c:1209 [inline] btrfs_mount_root+0x12e5/0x1830 fs/btrfs/super.c:1613 mount_fs+0xa3/0x310 fs/super.c:1261 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961 vfs_kern_mount+0x3c/0x60 fs/namespace.c:951 btrfs_mount+0x23a/0xaa0 fs/btrfs/super.c:1681 mount_fs+0xa3/0x310 fs/super.c:1261 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961 vfs_kern_mount fs/namespace.c:951 [inline] do_new_mount fs/namespace.c:2492 [inline] do_mount+0x115c/0x2f50 fs/namespace.c:2822 ksys_mount+0xcf/0x130 fs/namespace.c:3038 __do_sys_mount fs/namespace.c:3052 [inline] __se_sys_mount fs/namespace.c:3049 [inline] __x64_sys_mount+0xba/0x150 fs/namespace.c:3049 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #1 (sb_internal#3){.+.+}: sb_start_intwrite include/linux/fs.h:1626 [inline] start_transaction+0xa37/0xf90 fs/btrfs/transaction.c:528 btrfs_dirty_inode+0xe3/0x210 fs/btrfs/inode.c:6165 btrfs_update_time+0x33b/0x3d0 fs/btrfs/inode.c:6207 update_time fs/inode.c:1675 [inline] touch_atime+0x23c/0x2a0 fs/inode.c:1746 file_accessed include/linux/fs.h:2123 [inline] btrfs_file_mmap+0x11b/0x160 fs/btrfs/file.c:2274 call_mmap include/linux/fs.h:1826 [inline] mmap_region+0xc94/0x16b0 mm/mmap.c:1757 do_mmap+0x8e8/0x1080 mm/mmap.c:1530 do_mmap_pgoff include/linux/mm.h:2329 [inline] vm_mmap_pgoff+0x197/0x200 mm/util.c:357 ksys_mmap_pgoff+0x298/0x5a0 mm/mmap.c:1580 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #0 (&mm->mmap_sem){++++}: __might_fault mm/memory.c:4772 [inline] __might_fault+0x152/0x1d0 mm/memory.c:4757 perf_copy_attr+0xab/0x7a0 kernel/events/core.c:10275 _perf_ioctl+0x6aa/0x2300 kernel/events/core.c:5150 perf_ioctl+0x55/0x80 kernel/events/core.c:5177 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Chain exists of: &mm->mmap_sem --> pmus_lock --> &cpuctx_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&cpuctx_mutex); lock(pmus_lock); lock(&cpuctx_mutex); lock(&mm->mmap_sem); *** DEADLOCK *** 1 lock held by syz-executor.1/9098: #0: 0000000029dace8d (&cpuctx_mutex){+.+.}, at: perf_event_ctx_lock_nested+0x237/0x430 kernel/events/core.c:1283 stack backtrace: CPU: 0 PID: 9098 Comm: syz-executor.1 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222 check_prev_add kernel/locking/lockdep.c:1866 [inline] check_prevs_add kernel/locking/lockdep.c:1979 [inline] validate_chain kernel/locking/lockdep.c:2420 [inline] __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908 __might_fault mm/memory.c:4772 [inline] __might_fault+0x152/0x1d0 mm/memory.c:4757 perf_copy_attr+0xab/0x7a0 kernel/events/core.c:10275 _perf_ioctl+0x6aa/0x2300 kernel/events/core.c:5150 perf_ioctl+0x55/0x80 kernel/events/core.c:5177 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f39a50b60c9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f39a3628168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f39a51d5f80 RCX: 00007f39a50b60c9 RDX: 00000000200000c0 RSI: 000000004008240b RDI: 0000000000000003 RBP: 00007f39a5111ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe704d09af R14: 00007f39a3628300 R15: 0000000000022000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 9208 Comm: syz-executor.3 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold+0xa/0xf lib/fault-inject.c:149 __should_failslab+0x115/0x180 mm/failslab.c:32 should_failslab+0x5/0x10 mm/slab_common.c:1590 slab_pre_alloc_hook mm/slab.h:424 [inline] slab_alloc mm/slab.c:3383 [inline] kmem_cache_alloc+0x277/0x370 mm/slab.c:3557 getname_flags+0xce/0x590 fs/namei.c:140 do_sys_open+0x26c/0x520 fs/open.c:1079 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7ff8d0fa70c9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff8cf519168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ff8d10c6f80 RCX: 00007ff8d0fa70c9 RDX: 0000000000000000 RSI: 0000000020002040 RDI: ffffffffffffff9c RBP: 00007ff8cf5191d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fff882486df R14: 00007ff8cf519300 R15: 0000000000022000 IPVS: stopping backup sync thread 12863 ... device geneve2 entered promiscuous mode FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 9267 Comm: syz-executor.3 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold+0xa/0xf lib/fault-inject.c:149 __should_failslab+0x115/0x180 mm/failslab.c:32 should_failslab+0x5/0x10 mm/slab_common.c:1590 slab_pre_alloc_hook mm/slab.h:424 [inline] slab_alloc mm/slab.c:3383 [inline] kmem_cache_alloc+0x277/0x370 mm/slab.c:3557 kmem_cache_zalloc include/linux/slab.h:699 [inline] __alloc_file+0x21/0x340 fs/file_table.c:100 alloc_empty_file+0x6d/0x170 fs/file_table.c:150 path_openat+0xe9/0x2df0 fs/namei.c:3526 do_filp_open+0x18c/0x3f0 fs/namei.c:3567 do_sys_open+0x3b3/0x520 fs/open.c:1085 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7ff8d0fa70c9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff8cf519168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ff8d10c6f80 RCX: 00007ff8d0fa70c9 RDX: 0000000000000000 RSI: 0000000020002040 RDI: ffffffffffffff9c RBP: 00007ff8cf5191d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fff882486df R14: 00007ff8cf519300 R15: 0000000000022000 nla_parse: 16 callbacks suppressed netlink: 28 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 28 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 28 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 28 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 28 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 28 bytes leftover after parsing attributes in process `syz-executor.5'. FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 9298 Comm: syz-executor.3 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold+0xa/0xf lib/fault-inject.c:149 __should_failslab+0x115/0x180 mm/failslab.c:32 should_failslab+0x5/0x10 mm/slab_common.c:1590 slab_pre_alloc_hook mm/slab.h:424 [inline] slab_alloc mm/slab.c:3383 [inline] kmem_cache_alloc+0x277/0x370 mm/slab.c:3557 kmem_cache_zalloc include/linux/slab.h:699 [inline] __alloc_file+0x21/0x340 fs/file_table.c:100 alloc_empty_file+0x6d/0x170 fs/file_table.c:150 path_openat+0xe9/0x2df0 fs/namei.c:3526 do_filp_open+0x18c/0x3f0 fs/namei.c:3567 do_sys_open+0x3b3/0x520 fs/open.c:1085 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7ff8d0fa70c9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff8cf519168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ff8d10c6f80 RCX: 00007ff8d0fa70c9 RDX: 0000000000000000 RSI: 0000000020002040 RDI: ffffffffffffff9c RBP: 00007ff8cf5191d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fff882486df R14: 00007ff8cf519300 R15: 0000000000022000 netlink: 28 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 28 bytes leftover after parsing attributes in process `syz-executor.5'. FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 netlink: 72 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 72 bytes leftover after parsing attributes in process `syz-executor.2'. CPU: 1 PID: 9386 Comm: syz-executor.3 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold+0xa/0xf lib/fault-inject.c:149 __should_failslab+0x115/0x180 mm/failslab.c:32 should_failslab+0x5/0x10 mm/slab_common.c:1590 slab_pre_alloc_hook mm/slab.h:424 [inline] slab_alloc mm/slab.c:3383 [inline] kmem_cache_alloc_trace+0x284/0x380 mm/slab.c:3623 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] aa_alloc_file_ctx security/apparmor/include/file.h:60 [inline] apparmor_file_alloc_security+0x394/0xad0 security/apparmor/lsm.c:438 security_file_alloc+0x40/0x90 security/security.c:880 __alloc_file+0xd8/0x340 fs/file_table.c:105 alloc_empty_file+0x6d/0x170 fs/file_table.c:150 path_openat+0xe9/0x2df0 fs/namei.c:3526 do_filp_open+0x18c/0x3f0 fs/namei.c:3567 do_sys_open+0x3b3/0x520 fs/open.c:1085 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7ff8d0fa70c9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff8cf519168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ff8d10c6f80 RCX: 00007ff8d0fa70c9 RDX: 0000000000000000 RSI: 0000000020002040 RDI: ffffffffffffff9c RBP: 00007ff8cf5191d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fff882486df R14: 00007ff8cf519300 R15: 0000000000022000 nla_parse: 50 callbacks suppressed netlink: 88 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 88 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 88 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 88 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 88 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 72 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 88 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 72 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 72 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 88 bytes leftover after parsing attributes in process `syz-executor.0'.