====================================================== WARNING: possible circular locking dependency detected 5.11.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.2/15712 is trying to acquire lock: ffffffff8c08bc60 (fs_reclaim){+.+.}-{0:0}, at: fs_reclaim_acquire+0xf7/0x150 mm/page_alloc.c:4348 but task is already holding lock: ffff88801b126ec8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_lock_xattr fs/ext4/xattr.h:142 [inline] ffff88801b126ec8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_xattr_set_handle+0x15c/0x13e0 fs/ext4/xattr.c:2308 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&ei->xattr_sem){++++}-{3:3}: down_read+0x9a/0x440 kernel/locking/rwsem.c:1353 ext4_setattr+0x570/0x1fd0 fs/ext4/inode.c:5371 notify_change+0xb60/0x10a0 fs/attr.c:336 chown_common+0x4a9/0x550 fs/open.c:674 vfs_fchown fs/open.c:741 [inline] vfs_fchown fs/open.c:733 [inline] ksys_fchown+0x111/0x170 fs/open.c:752 __do_sys_fchown fs/open.c:760 [inline] __se_sys_fchown fs/open.c:758 [inline] __x64_sys_fchown+0x6f/0xb0 fs/open.c:758 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #1 (jbd2_handle){++++}-{0:0}: start_this_handle+0xfb9/0x1380 fs/jbd2/transaction.c:446 jbd2__journal_start+0x399/0x930 fs/jbd2/transaction.c:503 __ext4_journal_start_sb+0x227/0x4a0 fs/ext4/ext4_jbd2.c:105 __ext4_journal_start fs/ext4/ext4_jbd2.h:320 [inline] ext4_dirty_inode+0x9d/0x110 fs/ext4/inode.c:5941 __mark_inode_dirty+0x6e3/0x10f0 fs/fs-writeback.c:2274 mark_inode_dirty_sync include/linux/fs.h:2194 [inline] iput.part.0+0x57/0x810 fs/inode.c:1676 iput+0x58/0x70 fs/inode.c:1669 dentry_unlink_inode+0x2b1/0x3d0 fs/dcache.c:374 __dentry_kill+0x3c0/0x640 fs/dcache.c:580 shrink_dentry_list+0x144/0x480 fs/dcache.c:1174 prune_dcache_sb+0xe7/0x140 fs/dcache.c:1255 super_cache_scan+0x336/0x590 fs/super.c:105 do_shrink_slab+0x3e4/0x9f0 mm/vmscan.c:511 shrink_slab+0x16f/0x5d0 mm/vmscan.c:672 shrink_node_memcgs mm/vmscan.c:2665 [inline] shrink_node+0x8d1/0x1de0 mm/vmscan.c:2780 shrink_zones mm/vmscan.c:2983 [inline] do_try_to_free_pages+0x388/0x14b0 mm/vmscan.c:3038 try_to_free_pages+0x29f/0x720 mm/vmscan.c:3277 __perform_reclaim mm/page_alloc.c:4379 [inline] __alloc_pages_direct_reclaim mm/page_alloc.c:4400 [inline] __alloc_pages_slowpath.constprop.0+0x893/0x2260 mm/page_alloc.c:4804 __alloc_pages_nodemask+0x5f5/0x730 mm/page_alloc.c:5014 __alloc_pages include/linux/gfp.h:511 [inline] __alloc_pages_node include/linux/gfp.h:524 [inline] khugepaged_alloc_page+0xa0/0x170 mm/khugepaged.c:872 collapse_huge_page mm/khugepaged.c:1075 [inline] khugepaged_scan_pmd mm/khugepaged.c:1365 [inline] khugepaged_scan_mm_slot mm/khugepaged.c:2134 [inline] khugepaged_do_scan mm/khugepaged.c:2217 [inline] khugepaged+0x3265/0x5510 mm/khugepaged.c:2262 kthread+0x3b1/0x4a0 kernel/kthread.c:292 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 -> #0 (fs_reclaim){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:2936 [inline] check_prevs_add kernel/locking/lockdep.c:3059 [inline] validate_chain kernel/locking/lockdep.c:3674 [inline] __lock_acquire+0x2b14/0x54c0 kernel/locking/lockdep.c:4900 lock_acquire kernel/locking/lockdep.c:5510 [inline] lock_acquire+0x1ab/0x730 kernel/locking/lockdep.c:5475 __fs_reclaim_acquire mm/page_alloc.c:4326 [inline] fs_reclaim_acquire+0x117/0x150 mm/page_alloc.c:4340 prepare_alloc_pages mm/page_alloc.c:4938 [inline] __alloc_pages_nodemask+0x169/0x730 mm/page_alloc.c:4985 __alloc_pages include/linux/gfp.h:511 [inline] __alloc_pages_node include/linux/gfp.h:524 [inline] alloc_pages_node include/linux/gfp.h:538 [inline] kmalloc_large_node+0x60/0x110 mm/slub.c:4039 __kmalloc_node+0x330/0x430 mm/slub.c:4055 kmalloc_node include/linux/slab.h:577 [inline] kvmalloc_node+0xb4/0xf0 mm/util.c:587 kvmalloc include/linux/mm.h:785 [inline] ext4_xattr_inode_cache_find fs/ext4/xattr.c:1465 [inline] ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1508 [inline] ext4_xattr_set_entry+0x1ce6/0x3740 fs/ext4/xattr.c:1649 ext4_xattr_ibody_set+0x78/0x2b0 fs/ext4/xattr.c:2224 ext4_xattr_set_handle+0x8f4/0x13e0 fs/ext4/xattr.c:2380 ext4_xattr_set+0x13a/0x340 fs/ext4/xattr.c:2493 __vfs_setxattr+0x10e/0x170 fs/xattr.c:177 __vfs_setxattr_noperm+0x11a/0x4c0 fs/xattr.c:208 __vfs_setxattr_locked+0x1bf/0x250 fs/xattr.c:266 vfs_setxattr+0x135/0x320 fs/xattr.c:291 setxattr+0x1ff/0x290 fs/xattr.c:553 path_setxattr+0x170/0x190 fs/xattr.c:572 __do_sys_setxattr fs/xattr.c:587 [inline] __se_sys_setxattr fs/xattr.c:583 [inline] __ia32_sys_setxattr+0xbc/0x150 fs/xattr.c:583 do_syscall_32_irqs_on arch/x86/entry/common.c:77 [inline] __do_fast_syscall_32+0x56/0x80 arch/x86/entry/common.c:139 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:164 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c other info that might help us debug this: Chain exists of: fs_reclaim --> jbd2_handle --> &ei->xattr_sem Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ei->xattr_sem); lock(jbd2_handle); lock(&ei->xattr_sem); lock(fs_reclaim); *** DEADLOCK *** 3 locks held by syz-executor.2/15712: #0: ffff88804a85e460 (sb_writers#5){.+.+}-{0:0}, at: path_setxattr+0xb5/0x190 fs/xattr.c:570 #1: ffff88801b127288 (&type->i_mutex_dir_key#4){++++}-{3:3}, at: inode_lock include/linux/fs.h:773 [inline] #1: ffff88801b127288 (&type->i_mutex_dir_key#4){++++}-{3:3}, at: vfs_setxattr+0x117/0x320 fs/xattr.c:290 #2: ffff88801b126ec8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_lock_xattr fs/ext4/xattr.h:142 [inline] #2: ffff88801b126ec8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_xattr_set_handle+0x15c/0x13e0 fs/ext4/xattr.c:2308 stack backtrace: CPU: 3 PID: 15712 Comm: syz-executor.2 Not tainted 5.11.0-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0xfa/0x151 lib/dump_stack.c:120 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2127 check_prev_add kernel/locking/lockdep.c:2936 [inline] check_prevs_add kernel/locking/lockdep.c:3059 [inline] validate_chain kernel/locking/lockdep.c:3674 [inline] __lock_acquire+0x2b14/0x54c0 kernel/locking/lockdep.c:4900 lock_acquire kernel/locking/lockdep.c:5510 [inline] lock_acquire+0x1ab/0x730 kernel/locking/lockdep.c:5475 __fs_reclaim_acquire mm/page_alloc.c:4326 [inline] fs_reclaim_acquire+0x117/0x150 mm/page_alloc.c:4340 prepare_alloc_pages mm/page_alloc.c:4938 [inline] __alloc_pages_nodemask+0x169/0x730 mm/page_alloc.c:4985 __alloc_pages include/linux/gfp.h:511 [inline] __alloc_pages_node include/linux/gfp.h:524 [inline] alloc_pages_node include/linux/gfp.h:538 [inline] kmalloc_large_node+0x60/0x110 mm/slub.c:4039 __kmalloc_node+0x330/0x430 mm/slub.c:4055 kmalloc_node include/linux/slab.h:577 [inline] kvmalloc_node+0xb4/0xf0 mm/util.c:587 kvmalloc include/linux/mm.h:785 [inline] ext4_xattr_inode_cache_find fs/ext4/xattr.c:1465 [inline] ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1508 [inline] ext4_xattr_set_entry+0x1ce6/0x3740 fs/ext4/xattr.c:1649 ext4_xattr_ibody_set+0x78/0x2b0 fs/ext4/xattr.c:2224 ext4_xattr_set_handle+0x8f4/0x13e0 fs/ext4/xattr.c:2380 ext4_xattr_set+0x13a/0x340 fs/ext4/xattr.c:2493 __vfs_setxattr+0x10e/0x170 fs/xattr.c:177 __vfs_setxattr_noperm+0x11a/0x4c0 fs/xattr.c:208 __vfs_setxattr_locked+0x1bf/0x250 fs/xattr.c:266 vfs_setxattr+0x135/0x320 fs/xattr.c:291 setxattr+0x1ff/0x290 fs/xattr.c:553 path_setxattr+0x170/0x190 fs/xattr.c:572 __do_sys_setxattr fs/xattr.c:587 [inline] __se_sys_setxattr fs/xattr.c:583 [inline] __ia32_sys_setxattr+0xbc/0x150 fs/xattr.c:583 do_syscall_32_irqs_on arch/x86/entry/common.c:77 [inline] __do_fast_syscall_32+0x56/0x80 arch/x86/entry/common.c:139 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:164 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c RIP: 0023:0xf7ffb549 Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f55d45fc EFLAGS: 00000296 ORIG_RAX: 00000000000000e2 RAX: ffffffffffffffda RBX: 0000000020000080 RCX: 00000000200000c0 RDX: 0000000020000380 RSI: 000000000000c001 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000