====================================================== WARNING: possible circular locking dependency detected 5.15.110-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/3965 is trying to acquire lock: ffff888141b88c58 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline] ffff888141b88c58 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}, at: hugetlbfs_file_mmap+0x2bc/0x580 fs/hugetlbfs/inode.c:175 but task is already holding lock: ffff888023d30f28 (&mm->mmap_lock#2){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:87 [inline] ffff888023d30f28 (&mm->mmap_lock#2){++++}-{3:3}, at: vm_mmap_pgoff+0x175/0x2d0 mm/util.c:549 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&mm->mmap_lock#2){++++}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622 down_write+0x97/0x170 kernel/locking/rwsem.c:1541 mmap_write_lock include/linux/mmap_lock.h:71 [inline] mpol_rebind_mm+0x34/0x2b0 mm/mempolicy.c:381 cpuset_attach+0x393/0x540 kernel/cgroup/cpuset.c:2289 cgroup_migrate_execute+0x7fb/0x10e0 kernel/cgroup/cgroup.c:2559 cgroup_attach_task+0x58a/0x840 kernel/cgroup/cgroup.c:2854 __cgroup1_procs_write+0x2ec/0x460 kernel/cgroup/cgroup-v1.c:528 cgroup_file_write+0x2ac/0x670 kernel/cgroup/cgroup.c:3932 kernfs_fop_write_iter+0x3a2/0x4f0 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2103 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xacf/0xe50 fs/read_write.c:594 ksys_write+0x1a2/0x2c0 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb -> #2 (&cpuset_rwsem){++++}-{0:0}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622 percpu_down_read include/linux/percpu-rwsem.h:51 [inline] cpuset_read_lock+0x40/0x150 kernel/cgroup/cpuset.c:356 __sched_setscheduler+0x626/0x1df0 kernel/sched/core.c:7409 _sched_setscheduler kernel/sched/core.c:7586 [inline] sched_setscheduler_nocheck+0x187/0x2d0 kernel/sched/core.c:7633 __kthread_create_on_node+0x31b/0x3f0 kernel/kthread.c:413 kthread_create_on_node+0xda/0x120 kernel/kthread.c:453 cryptomgr_schedule_test crypto/algboss.c:219 [inline] cryptomgr_notify+0x125/0xc70 crypto/algboss.c:240 notifier_call_chain kernel/notifier.c:83 [inline] blocking_notifier_call_chain+0x104/0x1b0 kernel/notifier.c:318 crypto_probing_notify+0x21/0x70 crypto/api.c:251 crypto_wait_for_test+0x3e/0xd0 crypto/algapi.c:396 crypto_register_alg+0x25b/0x330 crypto/algapi.c:429 do_one_initcall+0x22b/0x7a0 init/main.c:1306 do_initcall_level+0x157/0x207 init/main.c:1379 do_initcalls+0x49/0x86 init/main.c:1395 kernel_init_freeable+0x43c/0x5c5 init/main.c:1619 kernel_init+0x19/0x290 init/main.c:1510 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 -> #1 ((crypto_chain).rwsem){++++}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622 down_read+0x3b/0x50 kernel/locking/rwsem.c:1488 blocking_notifier_call_chain+0x5e/0x1b0 kernel/notifier.c:317 crypto_probing_notify crypto/api.c:251 [inline] crypto_alg_mod_lookup+0x4e6/0x710 crypto/api.c:281 crypto_has_alg+0x22/0x110 crypto/api.c:581 validate_hash_algo security/integrity/ima/ima_appraise.c:623 [inline] ima_inode_setxattr+0x836/0xa10 security/integrity/ima/ima_appraise.c:655 security_inode_setxattr+0x1b0/0x230 security/security.c:1370 __vfs_setxattr_locked+0xa6/0x240 fs/xattr.c:268 vfs_setxattr+0x21d/0x420 fs/xattr.c:303 do_setxattr fs/xattr.c:588 [inline] setxattr+0x27e/0x2e0 fs/xattr.c:611 __do_sys_fsetxattr fs/xattr.c:667 [inline] __se_sys_fsetxattr+0x194/0x210 fs/xattr.c:656 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb -> #0 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622 down_write+0x97/0x170 kernel/locking/rwsem.c:1541 inode_lock include/linux/fs.h:787 [inline] hugetlbfs_file_mmap+0x2bc/0x580 fs/hugetlbfs/inode.c:175 call_mmap include/linux/fs.h:2108 [inline] mmap_region+0x10e7/0x1670 mm/mmap.c:1791 do_mmap+0x78d/0xe00 mm/mmap.c:1575 vm_mmap_pgoff+0x1ca/0x2d0 mm/util.c:551 ksys_mmap_pgoff+0x5c5/0x780 mm/mmap.c:1624 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#21 --> &cpuset_rwsem --> &mm->mmap_lock#2 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_lock#2); lock(&cpuset_rwsem); lock(&mm->mmap_lock#2); lock(&sb->s_type->i_mutex_key#21); *** DEADLOCK *** 1 lock held by syz-executor.0/3965: #0: ffff888023d30f28 (&mm->mmap_lock#2){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:87 [inline] #0: ffff888023d30f28 (&mm->mmap_lock#2){++++}-{3:3}, at: vm_mmap_pgoff+0x175/0x2d0 mm/util.c:549 stack backtrace: CPU: 0 PID: 3965 Comm: syz-executor.0 Not tainted 5.15.110-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622 down_write+0x97/0x170 kernel/locking/rwsem.c:1541 inode_lock include/linux/fs.h:787 [inline] hugetlbfs_file_mmap+0x2bc/0x580 fs/hugetlbfs/inode.c:175 call_mmap include/linux/fs.h:2108 [inline] mmap_region+0x10e7/0x1670 mm/mmap.c:1791 do_mmap+0x78d/0xe00 mm/mmap.c:1575 vm_mmap_pgoff+0x1ca/0x2d0 mm/util.c:551 ksys_mmap_pgoff+0x5c5/0x780 mm/mmap.c:1624 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7f4a8431b0f9 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:00007f4a8366c168 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007f4a8443b050 RCX: 00007f4a8431b0f9 RDX: 0000000000000000 RSI: 0000000000ff5000 RDI: 0000000020000000 RBP: 00007f4a84376b39 R08: ffffffffffffffff R09: 0000000000000000 R10: 000200000005c832 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc81d662ef R14: 00007f4a8366c300 R15: 0000000000022000