possible deadlock in ext4_xattr_get

11 kali dilihat
Langsung ke pesan pertama yang belum dibaca

syzbot

belum dibaca,
26 Apr 2022, 23.33.2426/04/22
kepadasyzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 15a1c6b6f516 Linux 4.14.276
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1306de58f00000
kernel config: https://syzkaller.appspot.com/x/.config?x=3ec12c117082c76f
dashboard link: https://syzkaller.appspot.com/bug?extid=2e53a78f1fc31fc9b316
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=153597ff700000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13f50452f00000

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

EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
======================================================
WARNING: possible circular locking dependency detected
4.14.276-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor197/7982 is trying to acquire lock:
(&ei->xattr_sem){++++}, at: [<ffffffff81c810e7>] ext4_xattr_get+0x107/0x8b0 fs/ext4/xattr.c:647

but task is already holding lock:
(&ea_inode->i_rwsem#10/1){+.+.}, at: [<ffffffff81863712>] inode_lock include/linux/fs.h:719 [inline]
(&ea_inode->i_rwsem#10/1){+.+.}, at: [<ffffffff81863712>] chown_common+0x272/0x4b0 fs/open.c:628

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ea_inode->i_rwsem#10/1){+.+.}:
down_write+0x34/0x90 kernel/locking/rwsem.c:54
inode_lock include/linux/fs.h:719 [inline]
ext4_xattr_inode_create fs/ext4/xattr.c:1458 [inline]
ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1541 [inline]
ext4_xattr_set_entry+0x258a/0x3180 fs/ext4/xattr.c:1669
ext4_xattr_ibody_set+0x73/0x280 fs/ext4/xattr.c:2245
ext4_xattr_set_handle+0x518/0xda0 fs/ext4/xattr.c:2402
ext4_xattr_set+0x118/0x230 fs/ext4/xattr.c:2514
__vfs_setxattr+0xdc/0x130 fs/xattr.c:150
__vfs_setxattr_noperm+0xfd/0x3d0 fs/xattr.c:181
__vfs_setxattr_locked+0x14d/0x250 fs/xattr.c:239
vfs_setxattr+0xcf/0x230 fs/xattr.c:256
setxattr+0x1a9/0x300 fs/xattr.c:523
path_setxattr+0x118/0x130 fs/xattr.c:542
SYSC_setxattr fs/xattr.c:557 [inline]
SyS_setxattr+0x36/0x50 fs/xattr.c:553
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #0 (&ei->xattr_sem){++++}:
lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
down_read+0x36/0x80 kernel/locking/rwsem.c:24
ext4_xattr_get+0x107/0x8b0 fs/ext4/xattr.c:647
__vfs_getxattr+0xb9/0x100 fs/xattr.c:349
cap_inode_need_killpriv+0x3c/0x50 security/commoncap.c:307
security_inode_need_killpriv+0x66/0xa0 security/security.c:791
notify_change+0x7d7/0xd10 fs/attr.c:250
chown_common+0x40b/0x4b0 fs/open.c:631
SYSC_fchownat fs/open.c:661 [inline]
SyS_fchownat+0xf6/0x190 fs/open.c:641
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&ea_inode->i_rwsem#10/1);
lock(&ei->xattr_sem);
lock(&ea_inode->i_rwsem#10/1);
lock(&ei->xattr_sem);

*** DEADLOCK ***

2 locks held by syz-executor197/7982:
#0: (sb_writers#3){.+.+}, at: [<ffffffff818df99a>] sb_start_write include/linux/fs.h:1551 [inline]
#0: (sb_writers#3){.+.+}, at: [<ffffffff818df99a>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386
#1: (&ea_inode->i_rwsem#10/1){+.+.}, at: [<ffffffff81863712>] inode_lock include/linux/fs.h:719 [inline]
#1: (&ea_inode->i_rwsem#10/1){+.+.}, at: [<ffffffff81863712>] chown_common+0x272/0x4b0 fs/open.c:628

stack backtrace:
CPU: 1 PID: 7982 Comm: syz-executor197 Not tainted 4.14.276-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
check_prev_add kernel/locking/lockdep.c:1905 [inline]
check_prevs_add kernel/locking/lockdep.c:2022 [inline]
validate_chain kernel/locking/lockdep.c:2464 [inline]
__lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
down_read+0x36/0x80 kernel/locking/rwsem.c:24
ext4_xattr_get+0x107/0x8b0 fs/ext4/xattr.c:647
__vfs_getxattr+0xb9/0x100 fs/xattr.c:349
cap_inode_need_killpriv+0x3c/0x50 security/commoncap.c:307
security_inode_need_killpriv+0x66/0xa0 security/security.c:791
notify_change+0x7d7/0xd10 fs/attr.c:250
chown_common+0x40b/0x4b0 fs/open.c:631
SYSC_fchownat fs/open.c:661 [inline]
SyS_fchownat+0xf6/0x190 fs/open.c:641
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f5d23e20109
RSP: 002b:00007fff191c3c98 EFLAGS: 00000246 ORIG_RAX: 0000000000000104


---
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 can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

belum dibaca,
27 Apr 2022, 01.09.3027/04/22
kepadasyzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=110d0452f00000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=b2cdc53d61809157fbcb
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14849a4af00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=174ee7fcf00000

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

EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor363/8086 is trying to acquire lock:
00000000bec9b65b (&ei->xattr_sem){++++}, at: ext4_xattr_get+0x141/0x9c0 fs/ext4/xattr.c:648

but task is already holding lock:
00000000bfbe5d25 (&ea_inode->i_rwsem#10/1){+.+.}, at: inode_lock include/linux/fs.h:748 [inline]
00000000bfbe5d25 (&ea_inode->i_rwsem#10/1){+.+.}, at: chown_common+0x2d0/0x550 fs/open.c:648

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ea_inode->i_rwsem#10/1){+.+.}:
inode_lock include/linux/fs.h:748 [inline]
ext4_xattr_inode_create fs/ext4/xattr.c:1459 [inline]
ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1542 [inline]
ext4_xattr_set_entry+0x2a10/0x3750 fs/ext4/xattr.c:1670
ext4_xattr_ibody_set+0x81/0x2a0 fs/ext4/xattr.c:2246
ext4_xattr_set_handle+0x60b/0x1030 fs/ext4/xattr.c:2403
ext4_xattr_set+0x135/0x2a0 fs/ext4/xattr.c:2515
__vfs_setxattr+0x10e/0x170 fs/xattr.c:149
__vfs_setxattr_noperm+0x11a/0x420 fs/xattr.c:180
__vfs_setxattr_locked+0x176/0x250 fs/xattr.c:238
vfs_setxattr+0xe5/0x270 fs/xattr.c:255
setxattr+0x23d/0x330 fs/xattr.c:520
path_setxattr+0x170/0x190 fs/xattr.c:539
__do_sys_setxattr fs/xattr.c:554 [inline]
__se_sys_setxattr fs/xattr.c:550 [inline]
__x64_sys_setxattr+0xc0/0x160 fs/xattr.c:550
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&ei->xattr_sem){++++}:
down_read+0x36/0x80 kernel/locking/rwsem.c:24
ext4_xattr_get+0x141/0x9c0 fs/ext4/xattr.c:648
__vfs_getxattr+0xd9/0x140 fs/xattr.c:347
cap_inode_need_killpriv+0x3c/0x60 security/commoncap.c:306
security_inode_need_killpriv+0x40/0x90 security/security.c:797
notify_change+0xa15/0xfc0 fs/attr.c:271
chown_common+0x4a9/0x550 fs/open.c:651
do_fchownat+0x126/0x1e0 fs/open.c:681
__do_sys_fchownat fs/open.c:696 [inline]
__se_sys_fchownat fs/open.c:693 [inline]
__x64_sys_fchownat+0xba/0x150 fs/open.c:693
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:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&ea_inode->i_rwsem#10/1);
lock(&ei->xattr_sem);
lock(&ea_inode->i_rwsem#10/1);
lock(&ei->xattr_sem);

*** DEADLOCK ***

2 locks held by syz-executor363/8086:
#0: 000000005b443f8c (sb_writers#3){.+.+}, at: sb_start_write include/linux/fs.h:1579 [inline]
#0: 000000005b443f8c (sb_writers#3){.+.+}, at: mnt_want_write+0x3a/0xb0 fs/namespace.c:360
#1: 00000000bfbe5d25 (&ea_inode->i_rwsem#10/1){+.+.}, at: inode_lock include/linux/fs.h:748 [inline]
#1: 00000000bfbe5d25 (&ea_inode->i_rwsem#10/1){+.+.}, at: chown_common+0x2d0/0x550 fs/open.c:648

stack backtrace:
CPU: 0 PID: 8086 Comm: syz-executor363 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
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
down_read+0x36/0x80 kernel/locking/rwsem.c:24
ext4_xattr_get+0x141/0x9c0 fs/ext4/xattr.c:648
__vfs_getxattr+0xd9/0x140 fs/xattr.c:347
cap_inode_need_killpriv+0x3c/0x60 security/commoncap.c:306
security_inode_need_killpriv+0x40/0x90 security/security.c:797
notify_change+0xa15/0xfc0 fs/attr.c:271
chown_common+0x4a9/0x550 fs/open.c:651
do_fchownat+0x126/0x1e0 fs/open.c:681
__do_sys_fchownat fs/open.c:696 [inline]
__se_sys_fchownat fs/open.c:693 [inline]
__x64_sys_fchownat+0xba/0x150 fs/open.c:693
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f2ddf6f4109
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffe9617d98 EFLAGS: 00000246 ORIG_RAX: 0000000000000104
RAX: ffffffffffffffda RBX: 2f30656c69662f2e RCX: 00007f2ddf6f4109
RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000005
RBP: 00007f2ddf6b39a0 R08: 0000000000001000 R09: 0000000000000000
R10: 000000000000ee01 R11: 0000000000000246 R12: 00007f2ddf6b3a30
R13: 0000000000000000 R14: 0000000000000000 R15:
Balas ke semua
Balas ke penulis
Teruskan
0 pesan baru