[v6.1] possible deadlock in ext4_map_blocks

5 views
Skip to first unread message

syzbot

unread,
Mar 7, 2023, 11:51:38 PM3/7/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 42616e0f09fb Linux 6.1.15
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14950dbcc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=650737f7e9682672
dashboard link: https://syzkaller.appspot.com/bug?extid=5cff006fc9de25d004e9
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f10713d1fd0f/disk-42616e0f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5a1307bb774e/vmlinux-42616e0f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/388238a30fe4/Image-42616e0f.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+5cff00...@syzkaller.appspotmail.com

loop4: detected capacity change from 0 to 512
EXT4-fs (loop4): mounted filesystem without journal. Quota mode: writeback.
======================================================
WARNING: possible circular locking dependency detected
6.1.15-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.4/6894 is trying to acquire lock:
ffff0000dd9d48c0 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x794/0x1884 fs/ext4/inode.c:644

but task is already holding lock:
ffff0000cd832208 (&s->s_dquot.dqio_sem){++++}-{3:3}, at: v2_write_dquot+0x11c/0x188 fs/quota/quota_v2.c:354

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&s->s_dquot.dqio_sem){++++}-{3:3}:
down_read+0x5c/0x78 kernel/locking/rwsem.c:1509
v2_read_dquot+0x50/0x11c fs/quota/quota_v2.c:332
dquot_acquire+0x130/0x5c4 fs/quota/dquot.c:435
ext4_acquire_dquot+0x270/0x398 fs/ext4/super.c:6740
dqget+0x844/0xc48 fs/quota/dquot.c:914
__dquot_initialize+0x344/0xb54 fs/quota/dquot.c:1492
dquot_initialize+0x24/0x34 fs/quota/dquot.c:1550
ext4_mkdir+0x15c/0xa64 fs/ext4/namei.c:2985
vfs_mkdir+0x334/0x4e4 fs/namei.c:4036
do_mkdirat+0x20c/0x610 fs/namei.c:4061
__do_sys_mkdirat fs/namei.c:4076 [inline]
__se_sys_mkdirat fs/namei.c:4074 [inline]
__arm64_sys_mkdirat+0x90/0xa8 fs/namei.c:4074
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

-> #1 (&dquot->dq_lock){+.+.}-{3:3}:
__mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
dquot_commit+0x54/0x240 fs/quota/dquot.c:479
ext4_write_dquot+0x1b0/0x284 fs/ext4/super.c:6724
ext4_mark_dquot_dirty+0xe8/0x140 fs/ext4/super.c:6772
mark_dquot_dirty fs/quota/dquot.c:346 [inline]
mark_all_dquot_dirty fs/quota/dquot.c:384 [inline]
__dquot_alloc_space+0x47c/0xd00 fs/quota/dquot.c:1722
dquot_alloc_space_nodirty include/linux/quotaops.h:300 [inline]
dquot_alloc_space include/linux/quotaops.h:313 [inline]
dquot_alloc_block include/linux/quotaops.h:337 [inline]
ext4_mb_new_blocks+0x1020/0x49c8 fs/ext4/mballoc.c:5573
ext4_ext_map_blocks+0x1740/0x688c fs/ext4/extents.c:4287
ext4_map_blocks+0x828/0x1884 fs/ext4/inode.c:651
ext4_getblk+0x198/0x6ec fs/ext4/inode.c:864
ext4_bread+0x3c/0x1b0 fs/ext4/inode.c:920
ext4_append+0x260/0x4cc fs/ext4/namei.c:83
ext4_init_new_dir+0x294/0x8e4 fs/ext4/namei.c:2956
ext4_mkdir+0x3d4/0xa64 fs/ext4/namei.c:3002
vfs_mkdir+0x334/0x4e4 fs/namei.c:4036
do_mkdirat+0x20c/0x610 fs/namei.c:4061
__do_sys_mkdirat fs/namei.c:4076 [inline]
__se_sys_mkdirat fs/namei.c:4074 [inline]
__arm64_sys_mkdirat+0x90/0xa8 fs/namei.c:4074
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

-> #0 (&ei->i_data_sem/2){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3097 [inline]
check_prevs_add kernel/locking/lockdep.c:3216 [inline]
validate_chain kernel/locking/lockdep.c:3831 [inline]
__lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5055
lock_acquire+0x2f8/0x8dc kernel/locking/lockdep.c:5668
down_write+0x5c/0x88 kernel/locking/rwsem.c:1562
ext4_map_blocks+0x794/0x1884 fs/ext4/inode.c:644
ext4_getblk+0x198/0x6ec fs/ext4/inode.c:864
ext4_bread+0x3c/0x1b0 fs/ext4/inode.c:920
ext4_quota_write+0x230/0x54c fs/ext4/super.c:7106
write_blk fs/quota/quota_tree.c:64 [inline]
find_free_dqentry fs/quota/quota_tree.c:312 [inline]
do_insert_tree+0xa64/0x1474 fs/quota/quota_tree.c:373
do_insert_tree+0x510/0x1474 fs/quota/quota_tree.c:375
do_insert_tree+0x510/0x1474 fs/quota/quota_tree.c:375
do_insert_tree+0x510/0x1474 fs/quota/quota_tree.c:375
dq_insert_tree fs/quota/quota_tree.c:401 [inline]
qtree_write_dquot+0x318/0x488 fs/quota/quota_tree.c:420
v2_write_dquot+0xf4/0x188 fs/quota/quota_v2.c:358
dquot_acquire+0x2c4/0x5c4 fs/quota/dquot.c:444
ext4_acquire_dquot+0x270/0x398 fs/ext4/super.c:6740
dqget+0x844/0xc48 fs/quota/dquot.c:914
__dquot_initialize+0x2cc/0xb54 fs/quota/dquot.c:1492
dquot_initialize+0x24/0x34 fs/quota/dquot.c:1550
ext4_create+0xb4/0x480 fs/ext4/namei.c:2802
lookup_open fs/namei.c:3413 [inline]
open_last_lookups fs/namei.c:3481 [inline]
path_openat+0xea8/0x2540 fs/namei.c:3711
do_filp_open+0x1bc/0x3cc fs/namei.c:3741
do_sys_openat2+0x128/0x3d8 fs/open.c:1310
do_sys_open fs/open.c:1326 [inline]
__do_sys_openat fs/open.c:1342 [inline]
__se_sys_openat fs/open.c:1337 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1337
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

other info that might help us debug this:

Chain exists of:
&ei->i_data_sem/2 --> &dquot->dq_lock --> &s->s_dquot.dqio_sem

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&s->s_dquot.dqio_sem);
lock(&dquot->dq_lock);
lock(&s->s_dquot.dqio_sem);
lock(&ei->i_data_sem/2);

*** DEADLOCK ***

4 locks held by syz-executor.4/6894:
#0: ffff0000cd832460 (sb_writers#3){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:393
#1: ffff0001066de850 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline]
#1: ffff0001066de850 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: open_last_lookups fs/namei.c:3478 [inline]
#1: ffff0001066de850 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: path_openat+0x5e8/0x2540 fs/namei.c:3711
#2: ffff0000e08a1068 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_acquire+0x68/0x5c4 fs/quota/dquot.c:432
#3: ffff0000cd832208 (&s->s_dquot.dqio_sem){++++}-{3:3}, at: v2_write_dquot+0x11c/0x188 fs/quota/quota_v2.c:354

stack backtrace:
CPU: 0 PID: 6894 Comm: syz-executor.4 Not tainted 6.1.15-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2055
check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2177
check_prev_add kernel/locking/lockdep.c:3097 [inline]
check_prevs_add kernel/locking/lockdep.c:3216 [inline]
validate_chain kernel/locking/lockdep.c:3831 [inline]
__lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5055
lock_acquire+0x2f8/0x8dc kernel/locking/lockdep.c:5668
down_write+0x5c/0x88 kernel/locking/rwsem.c:1562
ext4_map_blocks+0x794/0x1884 fs/ext4/inode.c:644
ext4_getblk+0x198/0x6ec fs/ext4/inode.c:864
ext4_bread+0x3c/0x1b0 fs/ext4/inode.c:920
ext4_quota_write+0x230/0x54c fs/ext4/super.c:7106
write_blk fs/quota/quota_tree.c:64 [inline]
find_free_dqentry fs/quota/quota_tree.c:312 [inline]
do_insert_tree+0xa64/0x1474 fs/quota/quota_tree.c:373
do_insert_tree+0x510/0x1474 fs/quota/quota_tree.c:375
do_insert_tree+0x510/0x1474 fs/quota/quota_tree.c:375
do_insert_tree+0x510/0x1474 fs/quota/quota_tree.c:375
dq_insert_tree fs/quota/quota_tree.c:401 [inline]
qtree_write_dquot+0x318/0x488 fs/quota/quota_tree.c:420
v2_write_dquot+0xf4/0x188 fs/quota/quota_v2.c:358
dquot_acquire+0x2c4/0x5c4 fs/quota/dquot.c:444
ext4_acquire_dquot+0x270/0x398 fs/ext4/super.c:6740
dqget+0x844/0xc48 fs/quota/dquot.c:914
__dquot_initialize+0x2cc/0xb54 fs/quota/dquot.c:1492
dquot_initialize+0x24/0x34 fs/quota/dquot.c:1550
ext4_create+0xb4/0x480 fs/ext4/namei.c:2802
lookup_open fs/namei.c:3413 [inline]
open_last_lookups fs/namei.c:3481 [inline]
path_openat+0xea8/0x2540 fs/namei.c:3711
do_filp_open+0x1bc/0x3cc fs/namei.c:3741
do_sys_openat2+0x128/0x3d8 fs/open.c:1310
do_sys_open fs/open.c:1326 [inline]
__do_sys_openat fs/open.c:1342 [inline]
__se_sys_openat fs/open.c:1337 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1337
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Mar 11, 2023, 11:28:03 AM3/11/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d214f240b0f6 Linux 5.15.100
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16d8fa5cc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=c5c5a36ceb954515
dashboard link: https://syzkaller.appspot.com/bug?extid=93c172c1c39616affd01
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/4e12037285d4/disk-d214f240.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/929d982226d5/vmlinux-d214f240.xz
kernel image: https://storage.googleapis.com/syzbot-assets/59140c032c99/bzImage-d214f240.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+93c172...@syzkaller.appspotmail.com

loop4: detected capacity change from 0 to 512
======================================================
WARNING: possible circular locking dependency detected
5.15.100-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.4/11760 is trying to acquire lock:
ffff88802a8d6628 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x3a6/0x1e30 fs/ext4/inode.c:568

but task is already holding lock:
ffff88807a33e208 (&s->s_dquot.dqio_sem){++++}-{3:3}, at: v2_write_dquot+0x9b/0x190 fs/quota/quota_v2.c:354

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&s->s_dquot.dqio_sem){++++}-{3:3}:
lock_acquire+0x1ff/0x570 kernel/locking/lockdep.c:5622
down_read+0x3b/0x50 kernel/locking/rwsem.c:1488
v2_read_dquot+0x4a/0x100 fs/quota/quota_v2.c:332
dquot_acquire+0x188/0x680 fs/quota/dquot.c:435
ext4_acquire_dquot+0x2e6/0x400 fs/ext4/super.c:6163
dqget+0x98b/0xdb0 fs/quota/dquot.c:914
__dquot_initialize+0x2d9/0xe10 fs/quota/dquot.c:1492
ext4_xattr_set+0x104/0x3d0 fs/ext4/xattr.c:2481
__vfs_setxattr+0x3e7/0x420 fs/xattr.c:182
__vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216
vfs_setxattr+0x21d/0x420 fs/xattr.c:303
do_setxattr fs/xattr.c:588 [inline]
setxattr+0x27e/0x2e0 fs/xattr.c:611
path_setxattr+0x1bc/0x2a0 fs/xattr.c:630
__do_sys_setxattr fs/xattr.c:646 [inline]
__se_sys_setxattr fs/xattr.c:642 [inline]
__x64_sys_setxattr+0xb7/0xd0 fs/xattr.c:642
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

-> #1 (&dquot->dq_lock){+.+.}-{3:3}:
lock_acquire+0x1ff/0x570 kernel/locking/lockdep.c:5622
__mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
dquot_commit+0x57/0x510 fs/quota/dquot.c:479
ext4_write_dquot+0x1e8/0x2b0 fs/ext4/super.c:6147
mark_dquot_dirty fs/quota/dquot.c:346 [inline]
mark_all_dquot_dirty fs/quota/dquot.c:384 [inline]
__dquot_alloc_space+0x53a/0xf30 fs/quota/dquot.c:1722
dquot_alloc_space_nodirty include/linux/quotaops.h:297 [inline]
dquot_alloc_space include/linux/quotaops.h:310 [inline]
dquot_alloc_block include/linux/quotaops.h:334 [inline]
ext4_mb_new_blocks+0x1372/0x5120 fs/ext4/mballoc.c:5585
ext4_ext_map_blocks+0x1b1c/0x76a0 fs/ext4/extents.c:4287
ext4_map_blocks+0xaad/0x1e30 fs/ext4/inode.c:645
_ext4_get_block+0x23b/0x660 fs/ext4/inode.c:802
ext4_block_write_begin+0x6b0/0x13a0 fs/ext4/inode.c:1087
ext4_write_begin+0x75f/0x1700
ext4_da_write_begin+0x343/0xc50 fs/ext4/inode.c:2973
generic_perform_write+0x2bf/0x5b0 mm/filemap.c:3776
ext4_buffered_write_iter+0x22e/0x380 fs/ext4/file.c:269
ext4_file_write_iter+0x87c/0x1990
call_write_iter include/linux/fs.h:2101 [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

-> #0 (&ei->i_data_sem/2){++++}-{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+0x1ff/0x570 kernel/locking/lockdep.c:5622
down_read+0x3b/0x50 kernel/locking/rwsem.c:1488
ext4_map_blocks+0x3a6/0x1e30 fs/ext4/inode.c:568
ext4_getblk+0x19f/0x710 fs/ext4/inode.c:856
ext4_bread+0x2a/0x170 fs/ext4/inode.c:909
ext4_quota_write+0x21e/0x580 fs/ext4/super.c:6529
write_blk fs/quota/quota_tree.c:64 [inline]
get_free_dqblk+0x3a9/0x800 fs/quota/quota_tree.c:125
do_insert_tree+0x2b4/0x1c20 fs/quota/quota_tree.c:335
do_insert_tree+0x6d0/0x1c20 fs/quota/quota_tree.c:366
do_insert_tree+0x6d0/0x1c20 fs/quota/quota_tree.c:366
do_insert_tree+0x6d0/0x1c20 fs/quota/quota_tree.c:366
dq_insert_tree fs/quota/quota_tree.c:392 [inline]
qtree_write_dquot+0x3b9/0x530 fs/quota/quota_tree.c:411
v2_write_dquot+0x11c/0x190 fs/quota/quota_v2.c:358
dquot_acquire+0x34d/0x680 fs/quota/dquot.c:444
ext4_acquire_dquot+0x2e6/0x400 fs/ext4/super.c:6163
dqget+0x98b/0xdb0 fs/quota/dquot.c:914
__dquot_initialize+0x45e/0xe10 fs/quota/dquot.c:1492
ext4_process_orphan+0x57/0x2d0 fs/ext4/orphan.c:329
ext4_orphan_cleanup+0xa0d/0x1290 fs/ext4/orphan.c:474
ext4_fill_super+0x9757/0x9f70 fs/ext4/super.c:4964
mount_bdev+0x26d/0x3a0 fs/super.c:1369
legacy_get_tree+0xeb/0x180 fs/fs_context.c:610
vfs_get_tree+0x88/0x270 fs/super.c:1499
do_new_mount+0x28b/0xad0 fs/namespace.c:2994
do_mount fs/namespace.c:3337 [inline]
__do_sys_mount fs/namespace.c:3545 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3522
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:
&ei->i_data_sem/2 --> &dquot->dq_lock --> &s->s_dquot.dqio_sem

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&s->s_dquot.dqio_sem);
lock(&dquot->dq_lock);
lock(&s->s_dquot.dqio_sem);
lock(&ei->i_data_sem/2);

*** DEADLOCK ***

3 locks held by syz-executor.4/11760:
#0: ffff88807a33e0e0 (&type->s_umount_key#28/1){+.+.}-{3:3}, at: alloc_super+0x210/0x940 fs/super.c:229
#1: ffff888049c48ce8 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_acquire+0x64/0x680 fs/quota/dquot.c:432
#2: ffff88807a33e208 (&s->s_dquot.dqio_sem){++++}-{3:3}, at: v2_write_dquot+0x9b/0x190 fs/quota/quota_v2.c:354

stack backtrace:
CPU: 0 PID: 11760 Comm: syz-executor.4 Not tainted 5.15.100-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
<TASK>
__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+0x1ff/0x570 kernel/locking/lockdep.c:5622
down_read+0x3b/0x50 kernel/locking/rwsem.c:1488
ext4_map_blocks+0x3a6/0x1e30 fs/ext4/inode.c:568
ext4_getblk+0x19f/0x710 fs/ext4/inode.c:856
ext4_bread+0x2a/0x170 fs/ext4/inode.c:909
ext4_quota_write+0x21e/0x580 fs/ext4/super.c:6529
write_blk fs/quota/quota_tree.c:64 [inline]
get_free_dqblk+0x3a9/0x800 fs/quota/quota_tree.c:125
do_insert_tree+0x2b4/0x1c20 fs/quota/quota_tree.c:335
do_insert_tree+0x6d0/0x1c20 fs/quota/quota_tree.c:366
do_insert_tree+0x6d0/0x1c20 fs/quota/quota_tree.c:366
do_insert_tree+0x6d0/0x1c20 fs/quota/quota_tree.c:366
dq_insert_tree fs/quota/quota_tree.c:392 [inline]
qtree_write_dquot+0x3b9/0x530 fs/quota/quota_tree.c:411
v2_write_dquot+0x11c/0x190 fs/quota/quota_v2.c:358
dquot_acquire+0x34d/0x680 fs/quota/dquot.c:444
ext4_acquire_dquot+0x2e6/0x400 fs/ext4/super.c:6163
dqget+0x98b/0xdb0 fs/quota/dquot.c:914
__dquot_initialize+0x45e/0xe10 fs/quota/dquot.c:1492
ext4_process_orphan+0x57/0x2d0 fs/ext4/orphan.c:329
ext4_orphan_cleanup+0xa0d/0x1290 fs/ext4/orphan.c:474
ext4_fill_super+0x9757/0x9f70 fs/ext4/super.c:4964
mount_bdev+0x26d/0x3a0 fs/super.c:1369
legacy_get_tree+0xeb/0x180 fs/fs_context.c:610
vfs_get_tree+0x88/0x270 fs/super.c:1499
do_new_mount+0x28b/0xad0 fs/namespace.c:2994
do_mount fs/namespace.c:3337 [inline]
__do_sys_mount fs/namespace.c:3545 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3522
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:0x7f4f8efe862a
Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 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:00007f4f8d558f88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000510 RCX: 00007f4f8efe862a
RDX: 0000000020000000 RSI: 0000000020000500 RDI: 00007f4f8d558fe0
RBP: 00007f4f8d559020 R08: 00007f4f8d559020 R09: 0000000000000802
R10: 0000000000000802 R11: 0000000000000202 R12: 0000000020000000
R13: 0000000020000500 R14: 00007f4f8d558fe0 R15: 0000000020000040
</TASK>
EXT4-fs error (device loop4): ext4_mb_generate_buddy:1148: group 0, block bitmap and bg descriptor inconsistent: 106 vs 41 free clusters
Quota error (device loop4): write_blk: dquota write failed
Quota error (device loop4): qtree_write_dquot: Error -28 occurred while creating quota
Quota error (device loop4): write_blk: dquota write failed
Quota error (device loop4): qtree_write_dquot: Error -28 occurred while creating quota
Quota error (device loop4): write_blk: dquota write failed
Quota error (device loop4): qtree_write_dquot: Error -28 occurred while creating quota
EXT4-fs (loop4): 1 orphan inode deleted
EXT4-fs (loop4): mounted filesystem without journal. Opts: ,errors=continue. Quota mode: writeback.
ext4 filesystem being mounted at /root/syzkaller-testdir3248051373/syzkaller.hyEdcR/385/file0 supports timestamps until 2038 (0x7fffffff)

syzbot

unread,
Feb 9, 2024, 8:45:31 PMFeb 9
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: f1bb70486c9c Linux 6.1.77
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16832520180000
kernel config: https://syzkaller.appspot.com/x/.config?x=f184113a4001bfd2
dashboard link: https://syzkaller.appspot.com/bug?extid=5cff006fc9de25d004e9
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15160648180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13e0f648180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/d8aab4ddaaf8/disk-f1bb7048.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/af884bbced3d/vmlinux-f1bb7048.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4516cd7b87c3/Image-f1bb7048.gz.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/17cd073447a7/mount_1.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/db75ea43da14/mount_3.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+5cff00...@syzkaller.appspotmail.com

EXT4-fs error (device loop0): ext4_ext_check_inode:520: inode #16: comm syz-executor122: pblk 0 bad header/extent: too large eh_max - magic f30a, entries 1, max 32516(4), depth 0(0)
EXT4-fs error (device loop0): ext4_orphan_get:1401: comm syz-executor122: couldn't read orphan inode 16 (err -117)
======================================================
WARNING: possible circular locking dependency detected
6.1.77-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor122/4391 is trying to acquire lock:
ffff0000e24e52c8 (&ei->i_data_sem/1){+.+.}-{3:3}, at: ext4_double_down_write_data_sem+0x3c/0x4c

but task is already holding lock:
ffff0000e24e48c0 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_double_down_write_data_sem+0x30/0x4c

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&ei->i_data_sem/2){++++}-{3:3}:
down_read+0x64/0x308 kernel/locking/rwsem.c:1520
ext4_map_blocks+0x2ac/0x1850 fs/ext4/inode.c:574
ext4_getblk+0x198/0x6ec fs/ext4/inode.c:866
ext4_bread+0x3c/0x1b0 fs/ext4/inode.c:922
ext4_quota_write+0x230/0x54c fs/ext4/super.c:7135
write_blk fs/quota/quota_tree.c:64 [inline]
get_free_dqblk+0x28c/0x598 fs/quota/quota_tree.c:130
do_insert_tree+0x1fc/0x1474 fs/quota/quota_tree.c:340
do_insert_tree+0x510/0x1474 fs/quota/quota_tree.c:375
do_insert_tree+0x510/0x1474 fs/quota/quota_tree.c:375
do_insert_tree+0x510/0x1474 fs/quota/quota_tree.c:375
dq_insert_tree fs/quota/quota_tree.c:401 [inline]
qtree_write_dquot+0x318/0x488 fs/quota/quota_tree.c:420
v2_write_dquot+0xf4/0x188 fs/quota/quota_v2.c:358
dquot_acquire+0x2c4/0x5c4 fs/quota/dquot.c:470
ext4_acquire_dquot+0x270/0x398 fs/ext4/super.c:6769
dqget+0x660/0xcb4 fs/quota/dquot.c:984
__dquot_initialize+0x344/0xb54 fs/quota/dquot.c:1562
dquot_initialize+0x24/0x34 fs/quota/dquot.c:1620
ext4_create+0xb4/0x480 fs/ext4/namei.c:2827
lookup_open fs/namei.c:3484 [inline]
open_last_lookups fs/namei.c:3552 [inline]
path_openat+0xeac/0x2548 fs/namei.c:3782
do_filp_open+0x1bc/0x3cc fs/namei.c:3812
do_sys_openat2+0x128/0x3d8 fs/open.c:1318
do_sys_open fs/open.c:1334 [inline]
__do_sys_openat fs/open.c:1350 [inline]
__se_sys_openat fs/open.c:1345 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1345
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #2 (&s->s_dquot.dqio_sem){++++}-{3:3}:
down_read+0x64/0x308 kernel/locking/rwsem.c:1520
v2_read_dquot+0x50/0x11c fs/quota/quota_v2.c:332
dquot_acquire+0x130/0x5c4 fs/quota/dquot.c:461
ext4_acquire_dquot+0x270/0x398 fs/ext4/super.c:6769
dqget+0x660/0xcb4 fs/quota/dquot.c:984
__dquot_initialize+0x344/0xb54 fs/quota/dquot.c:1562
dquot_initialize+0x24/0x34 fs/quota/dquot.c:1620
ext4_process_orphan+0x5c/0x2b8 fs/ext4/orphan.c:329
ext4_orphan_cleanup+0x974/0x1134 fs/ext4/orphan.c:474
__ext4_fill_super fs/ext4/super.c:5533 [inline]
ext4_fill_super+0x6f04/0x7570 fs/ext4/super.c:5664
get_tree_bdev+0x360/0x54c fs/super.c:1355
ext4_get_tree+0x28/0x38 fs/ext4/super.c:5694
vfs_get_tree+0x90/0x274 fs/super.c:1562
do_new_mount+0x278/0x8fc fs/namespace.c:3051
path_mount+0x590/0xe5c fs/namespace.c:3381
do_mount fs/namespace.c:3394 [inline]
__do_sys_mount fs/namespace.c:3602 [inline]
__se_sys_mount fs/namespace.c:3579 [inline]
__arm64_sys_mount+0x45c/0x594 fs/namespace.c:3579
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #1 (&dquot->dq_lock){+.+.}-{3:3}:
__mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
dquot_commit+0x54/0x240 fs/quota/dquot.c:505
ext4_write_dquot+0x1b0/0x284 fs/ext4/super.c:6753
ext4_mark_dquot_dirty+0xe8/0x140 fs/ext4/super.c:6801
mark_dquot_dirty fs/quota/dquot.c:372 [inline]
mark_all_dquot_dirty fs/quota/dquot.c:410 [inline]
__dquot_alloc_space+0x47c/0xd00 fs/quota/dquot.c:1792
dquot_alloc_space_nodirty include/linux/quotaops.h:300 [inline]
dquot_alloc_space include/linux/quotaops.h:313 [inline]
swap_inode_boot_loader fs/ext4/ioctl.c:494 [inline]
__ext4_ioctl fs/ext4/ioctl.c:1424 [inline]
ext4_ioctl+0x5c68/0x6afc fs/ext4/ioctl.c:1614
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #0 (&ei->i_data_sem/1){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049
lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662
down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689
ext4_double_down_write_data_sem+0x3c/0x4c
swap_inode_boot_loader fs/ext4/ioctl.c:426 [inline]
__ext4_ioctl fs/ext4/ioctl.c:1424 [inline]
ext4_ioctl+0x4e78/0x6afc fs/ext4/ioctl.c:1614
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

other info that might help us debug this:

Chain exists of:
&ei->i_data_sem/1 --> &s->s_dquot.dqio_sem --> &ei->i_data_sem/2

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&ei->i_data_sem/2);
lock(&s->s_dquot.dqio_sem);
lock(&ei->i_data_sem/2);
lock(&ei->i_data_sem/1);

*** DEADLOCK ***

5 locks held by syz-executor122/4391:
#0: ffff0000d31da460 (sb_writers#3){.+.+}-{0:0}, at: mnt_want_write_file+0x64/0x1e8 fs/namespace.c:437
#1: ffff0000e24e4a38 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline]
#1: ffff0000e24e4a38 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: lock_two_nondirectories+0xd4/0x120 fs/inode.c:1165
#2: ffff0000e24e5440 (&sb->s_type->i_mutex_key#9/4){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline]
#2: ffff0000e24e5440 (&sb->s_type->i_mutex_key#9/4){+.+.}-{3:3}, at: lock_two_nondirectories+0xc4/0x120 fs/inode.c:1167
#3: ffff0000e24e55e0 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:801 [inline]
#3: ffff0000e24e55e0 (mapping.invalidate_lock){++++}-{3:3}, at: swap_inode_boot_loader fs/ext4/ioctl.c:402 [inline]
#3: ffff0000e24e55e0 (mapping.invalidate_lock){++++}-{3:3}, at: __ext4_ioctl fs/ext4/ioctl.c:1424 [inline]
#3: ffff0000e24e55e0 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_ioctl+0x4950/0x6afc fs/ext4/ioctl.c:1614
#4: ffff0000e24e48c0 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_double_down_write_data_sem+0x30/0x4c

stack backtrace:
CPU: 0 PID: 4391 Comm: syz-executor122 Not tainted 6.1.77-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2048
check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2170
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049
lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662
down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689
ext4_double_down_write_data_sem+0x3c/0x4c
swap_inode_boot_loader fs/ext4/ioctl.c:426 [inline]
__ext4_ioctl fs/ext4/ioctl.c:1424 [inline]
ext4_ioctl+0x4e78/0x6afc fs/ext4/ioctl.c:1614
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

syzbot

unread,
Apr 16, 2024, 7:13:24 PM (7 days ago) Apr 16
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: fa3df276cd36 Linux 5.15.155
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=171c53af180000
kernel config: https://syzkaller.appspot.com/x/.config?x=f12ea3f162537c9c
dashboard link: https://syzkaller.appspot.com/bug?extid=93c172c1c39616affd01
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13f827cd180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11b19b63180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/feaf3fb3f68f/disk-fa3df276.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/537c519f1dd0/vmlinux-fa3df276.xz
kernel image: https://storage.googleapis.com/syzbot-assets/5396ec75d1be/bzImage-fa3df276.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/a13652d0bd51/mount_0.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/a4964dc977df/mount_1.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+93c172...@syzkaller.appspotmail.com

EXT4-fs error (device loop0): ext4_ext_check_inode:501: inode #16: comm syz-executor324: pblk 0 bad header/extent: invalid extent entries - magic f30a, entries 1, max 4(4), depth 19200(19200)
EXT4-fs error (device loop0): ext4_orphan_get:1402: comm syz-executor324: couldn't read orphan inode 16 (err -117)
ext4 filesystem being mounted at /root/syzkaller.JNz7ds/87/file1 supports timestamps until 2038 (0x7fffffff)
======================================================
WARNING: possible circular locking dependency detected
5.15.155-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor324/3692 is trying to acquire lock:
ffff888071fd3e48 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x3a6/0x1e00 fs/ext4/inode.c:568

but task is already holding lock:
ffff8880744ca208 (&s->s_dquot.dqio_sem){++++}-{3:3}, at: v2_write_dquot+0x9b/0x190 fs/quota/quota_v2.c:354

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&s->s_dquot.dqio_sem){++++}-{3:3}:
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498
v2_read_dquot+0x4a/0x100 fs/quota/quota_v2.c:332
dquot_acquire+0x188/0x680 fs/quota/dquot.c:463
ext4_acquire_dquot+0x2eb/0x4a0 fs/ext4/super.c:6192
dqget+0x74e/0xe30 fs/quota/dquot.c:986
__dquot_initialize+0x45e/0xea0 fs/quota/dquot.c:1516
ext4_process_orphan+0x57/0x2d0 fs/ext4/orphan.c:329
ext4_orphan_cleanup+0x9d9/0x1240 fs/ext4/orphan.c:474
ext4_fill_super+0x98de/0xa110 fs/ext4/super.c:4974
mount_bdev+0x2c9/0x3f0 fs/super.c:1387
legacy_get_tree+0xeb/0x180 fs/fs_context.c:611
vfs_get_tree+0x88/0x270 fs/super.c:1517
do_new_mount+0x2ba/0xb40 fs/namespace.c:3005
do_mount fs/namespace.c:3348 [inline]
__do_sys_mount fs/namespace.c:3556 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3533
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #1 (&dquot->dq_lock){+.+.}-{3:3}:
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
__mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
dquot_commit+0x57/0x510 fs/quota/dquot.c:507
ext4_write_dquot+0x1fd/0x360 fs/ext4/super.c:6172
mark_dquot_dirty fs/quota/dquot.c:372 [inline]
mark_all_dquot_dirty+0x1e0/0x400 fs/quota/dquot.c:412
__dquot_free_space+0x932/0xe40 fs/quota/dquot.c:1941
dquot_free_space_nodirty include/linux/quotaops.h:376 [inline]
dquot_free_space include/linux/quotaops.h:381 [inline]
dquot_free_block include/linux/quotaops.h:392 [inline]
ext4_mb_clear_bb fs/ext4/mballoc.c:6157 [inline]
ext4_free_blocks+0x1f6e/0x2ea0 fs/ext4/mballoc.c:6287
ext4_remove_blocks fs/ext4/extents.c:2519 [inline]
ext4_ext_rm_leaf fs/ext4/extents.c:2685 [inline]
ext4_ext_remove_space+0x24da/0x4db0 fs/ext4/extents.c:2933
ext4_ext_truncate+0x191/0x250 fs/ext4/extents.c:4448
ext4_truncate+0x9fd/0x1130 fs/ext4/inode.c:4238
ext4_evict_inode+0xba1/0x1100 fs/ext4/inode.c:289
evict+0x2a4/0x620 fs/inode.c:587
ext4_orphan_cleanup+0x9d9/0x1240 fs/ext4/orphan.c:474
ext4_fill_super+0x98de/0xa110 fs/ext4/super.c:4974
mount_bdev+0x2c9/0x3f0 fs/super.c:1387
legacy_get_tree+0xeb/0x180 fs/fs_context.c:611
vfs_get_tree+0x88/0x270 fs/super.c:1517
do_new_mount+0x2ba/0xb40 fs/namespace.c:3005
do_mount fs/namespace.c:3348 [inline]
__do_sys_mount fs/namespace.c:3556 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3533
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #0 (&ei->i_data_sem/2){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498
ext4_map_blocks+0x3a6/0x1e00 fs/ext4/inode.c:568
ext4_getblk+0x19f/0x710 fs/ext4/inode.c:846
ext4_bread+0x2a/0x170 fs/ext4/inode.c:899
ext4_quota_write+0x21e/0x580 fs/ext4/super.c:6566
write_blk fs/quota/quota_tree.c:64 [inline]
get_free_dqblk+0x3a9/0x800 fs/quota/quota_tree.c:125
do_insert_tree+0x2b4/0x1c20 fs/quota/quota_tree.c:335
do_insert_tree+0x6d0/0x1c20 fs/quota/quota_tree.c:366
dq_insert_tree fs/quota/quota_tree.c:392 [inline]
qtree_write_dquot+0x3b9/0x530 fs/quota/quota_tree.c:411
v2_write_dquot+0x11c/0x190 fs/quota/quota_v2.c:358
dquot_acquire+0x34d/0x680 fs/quota/dquot.c:472
ext4_acquire_dquot+0x2eb/0x4a0 fs/ext4/super.c:6192
dqget+0x74e/0xe30 fs/quota/dquot.c:986
dquot_transfer+0x1d1/0x4e0 fs/quota/dquot.c:2145
ext4_setattr+0x91a/0x1990 fs/ext4/inode.c:5405
notify_change+0xc6d/0xf50 fs/attr.c:505
chown_common+0x592/0x890 fs/open.c:680
vfs_fchown fs/open.c:748 [inline]
ksys_fchown+0xde/0x150 fs/open.c:759
__do_sys_fchown fs/open.c:767 [inline]
__se_sys_fchown fs/open.c:765 [inline]
__x64_sys_fchown+0x76/0x80 fs/open.c:765
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

Chain exists of:
&ei->i_data_sem/2 --> &dquot->dq_lock --> &s->s_dquot.dqio_sem

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&s->s_dquot.dqio_sem);
lock(&dquot->dq_lock);
lock(&s->s_dquot.dqio_sem);
lock(&ei->i_data_sem/2);

*** DEADLOCK ***

5 locks held by syz-executor324/3692:
#0: ffff8880744ca460 (sb_writers#5){.+.+}-{0:0}, at: mnt_want_write_file+0x5a/0x1f0 fs/namespace.c:421
#1: ffff888071fd5da8 (&type->i_mutex_dir_key#4){++++}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
#1: ffff888071fd5da8 (&type->i_mutex_dir_key#4){++++}-{3:3}, at: chown_common+0x499/0x890 fs/open.c:674
#2: ffff888071fd5a80 (&ei->xattr_sem){.+.+}-{3:3}, at: ext4_setattr+0x90d/0x1990 fs/ext4/inode.c:5404
#3: ffff888071e653e8 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_acquire+0x64/0x680 fs/quota/dquot.c:460
#4: ffff8880744ca208 (&s->s_dquot.dqio_sem){++++}-{3:3}, at: v2_write_dquot+0x9b/0x190 fs/quota/quota_v2.c:354

stack backtrace:
CPU: 0 PID: 3692 Comm: syz-executor324 Not tainted 5.15.155-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 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+0x1649/0x5930 kernel/locking/lockdep.c:3788
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498
ext4_map_blocks+0x3a6/0x1e00 fs/ext4/inode.c:568
ext4_getblk+0x19f/0x710 fs/ext4/inode.c:846
ext4_bread+0x2a/0x170 fs/ext4/inode.c:899
ext4_quota_write+0x21e/0x580 fs/ext4/super.c:6566
write_blk fs/quota/quota_tree.c:64 [inline]
get_free_dqblk+0x3a9/0x800 fs/quota/quota_tree.c:125
do_insert_tree+0x2b4/0x1c20 fs/quota/quota_tree.c:335
do_insert_tree+0x6d0/0x1c20 fs/quota/quota_tree.c:366
dq_insert_tree fs/quota/quota_tree.c:392 [inline]
qtree_write_dquot+0x3b9/0x530 fs/quota/quota_tree.c:411
v2_write_dquot+0x11c/0x190 fs/quota/quota_v2.c:358
dquot_acquire+0x34d/0x680 fs/quota/dquot.c:472
ext4_acquire_dquot+0x2eb/0x4a0 fs/ext4/super.c:6192
dqget+0x74e/0xe30 fs/quota/dquot.c:986
dquot_transfer+0x1d1/0x4e0 fs/quota/dquot.c:2145
ext4_setattr+0x91a/0x1990 fs/ext4/inode.c:5405
notify_change+0xc6d/0xf50 fs/attr.c:505
chown_common+0x592/0x890 fs/open.c:680
vfs_fchown fs/open.c:748 [inline]
ksys_fchown+0xde/0x150 fs/open.c:759
__do_sys_fchown fs/open.c:767 [inline]
__se_sys_fchown fs/open.c:765 [inline]
__x64_sys_fchown+0x76/0x80 fs/open.c:765
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f88844954a9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 21 18 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:00007ffd4d1c82c8 EFLAGS: 00000246 ORIG_RAX: 000000000000005d
RAX: ffffffffffffffda RBX: 00007ffd4d1c8320 RCX: 00007f88844954a9
RDX: 0000000000000000 RSI: 0000000020737365 RDI: 0000000000000004
RBP: 0000000000000000 R08: 00007ffd4d1c8300 R09: 00007ffd4d1c8300
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffd4d1c8320
R13: 0000000000000057 R14: 431bde82d7b634db R15: 00007ffd4d1c82ec
</TASK>
Reply all
Reply to author
Forward
0 new messages