possible deadlock in ovl_copy_up_start

10 views
Skip to first unread message

syzbot

unread,
Oct 5, 2020, 11:46:18 AM10/5/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: cbfa1702 Linux 4.14.198
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10b65b4d900000
kernel config: https://syzkaller.appspot.com/x/.config?x=3990958d85b55e59
dashboard link: https://syzkaller.appspot.com/bug?extid=3d744721048586e271ff
compiler: gcc (GCC) 10.1.0-syz 20200507

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

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

Bluetooth: hci5 command 0x0409 tx timeout
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
======================================================
WARNING: possible circular locking dependency detected
4.14.198-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/24665 is trying to acquire lock:
(&oi->lock){+.+.}, at: [<ffffffff8225aa90>] ovl_copy_up_start+0x40/0xe0 fs/overlayfs/util.c:318

but task is already holding lock:
(sb_writers#8){.+.+}, at: [<ffffffff81944b4a>] sb_start_write include/linux/fs.h:1549 [inline]
(sb_writers#8){.+.+}, at: [<ffffffff81944b4a>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (sb_writers#8){.+.+}:
percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline]
percpu_down_read include/linux/percpu-rwsem.h:59 [inline]
__sb_start_write+0x19a/0x2e0 fs/super.c:1363
sb_start_write include/linux/fs.h:1549 [inline]
mnt_want_write+0x3a/0xb0 fs/namespace.c:386
ovl_create_object+0x75/0x1d0 fs/overlayfs/dir.c:538
lookup_open+0x77a/0x1750 fs/namei.c:3241
do_last fs/namei.c:3334 [inline]
path_openat+0xe08/0x2970 fs/namei.c:3569
do_filp_open+0x179/0x3c0 fs/namei.c:3603
do_sys_open+0x296/0x410 fs/open.c:1081
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #1 (&ovl_i_mutex_dir_key[depth]){++++}:
down_read+0x36/0x80 kernel/locking/rwsem.c:24
inode_lock_shared include/linux/fs.h:729 [inline]
lookup_slow+0x129/0x400 fs/namei.c:1674
lookup_one_len_unlocked+0x3a0/0x410 fs/namei.c:2595
ovl_lower_positive+0x184/0x345 fs/overlayfs/namei.c:783
ovl_rename+0x47c/0xe90 fs/overlayfs/dir.c:968
vfs_rename+0x560/0x1820 fs/namei.c:4496
SYSC_renameat2 fs/namei.c:4644 [inline]
SyS_renameat2+0x95b/0xad0 fs/namei.c:4533
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #0 (&oi->lock){+.+.}:
lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
__mutex_lock_common kernel/locking/mutex.c:756 [inline]
__mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
ovl_copy_up_start+0x40/0xe0 fs/overlayfs/util.c:318
ovl_copy_up_one+0x219/0x8d0 fs/overlayfs/copy_up.c:630
ovl_copy_up_flags+0xd5/0x120 fs/overlayfs/copy_up.c:685
ovl_xattr_set+0x189/0x270 fs/overlayfs/inode.c:225
ovl_posix_acl_xattr_set+0x2b7/0x830 fs/overlayfs/super.c:762
__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_lsetxattr fs/xattr.c:564 [inline]
SyS_lsetxattr+0x33/0x40 fs/xattr.c:560
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:

Chain exists of:
&oi->lock --> &ovl_i_mutex_dir_key[depth] --> sb_writers#8

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(sb_writers#8);
lock(&ovl_i_mutex_dir_key[depth]);
lock(sb_writers#8);
lock(&oi->lock);

*** DEADLOCK ***

3 locks held by syz-executor.0/24665:
#0: (sb_writers#22){.+.+}, at: [<ffffffff81944b4a>] sb_start_write include/linux/fs.h:1549 [inline]
#0: (sb_writers#22){.+.+}, at: [<ffffffff81944b4a>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386
#1: (&ovl_i_mutex_key[depth]#2){+.+.}, at: [<ffffffff81957dc1>] inode_lock include/linux/fs.h:719 [inline]
#1: (&ovl_i_mutex_key[depth]#2){+.+.}, at: [<ffffffff81957dc1>] vfs_setxattr+0xb1/0x230 fs/xattr.c:255
#2: (sb_writers#8){.+.+}, at: [<ffffffff81944b4a>] sb_start_write include/linux/fs.h:1549 [inline]
#2: (sb_writers#8){.+.+}, at: [<ffffffff81944b4a>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386

stack backtrace:
CPU: 1 PID: 24665 Comm: syz-executor.0 Not tainted 4.14.198-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/0x283 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
__mutex_lock_common kernel/locking/mutex.c:756 [inline]
__mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
ovl_copy_up_start+0x40/0xe0 fs/overlayfs/util.c:318
ovl_copy_up_one+0x219/0x8d0 fs/overlayfs/copy_up.c:630
ovl_copy_up_flags+0xd5/0x120 fs/overlayfs/copy_up.c:685
ovl_xattr_set+0x189/0x270 fs/overlayfs/inode.c:225
ovl_posix_acl_xattr_set+0x2b7/0x830 fs/overlayfs/super.c:762
__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_lsetxattr fs/xattr.c:564 [inline]
SyS_lsetxattr+0x33/0x40 fs/xattr.c:560
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x45de29
RSP: 002b:00007fef4ba4dc78 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd
RAX: ffffffffffffffda RBX: 0000000000020c40 RCX: 000000000045de29
RDX: 0000000020000440 RSI: 0000000020000040 RDI: 0000000020000100
RBP: 000000000118c018 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000004 R11: 0000000000000246 R12: 000000000118bfd4
R13: 00007ffcfef9231f R14: 00007fef4ba4e9c0 R15: 000000000118bfd4
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'.
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
Bluetooth: hci5 command 0x041b tx timeout
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
Bluetooth: hci5 command 0x040f tx timeout
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
nla_parse: 52 callbacks suppressed
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 20 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'.
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=1
netlink: 20 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'.
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=9
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=9
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop2): __ext4_new_inode:930: comm syz-executor.2: reserved inode found cleared - inode=9
EXT4-fs (loop2): VFS: Can't find ext4 filesystem
Bluetooth: hci5 command 0x0419 tx timeout
EXT4-fs (loop2): VFS: Can't find ext4 filesystem
print_req_error: I/O error, dev loop2, sector 0
Buffer I/O error on dev loop2, logical block 0, async page read
print_req_error: I/O error, dev loop2, sector 4
Buffer I/O error on dev loop2, logical block 2, async page read
print_req_error: I/O error, dev loop2, sector 6
Buffer I/O error on dev loop2, logical block 3, async page read
EXT4-fs (loop2): VFS: Can't find ext4 filesystem
EXT4-fs (loop2): ext4_check_descriptors: Block bitmap for group 0 overlaps superblock
EXT4-fs (loop2): group descriptors corrupted!
EXT4-fs (loop2): ext4_check_descriptors: Block bitmap for group 0 overlaps superblock
EXT4-fs (loop2): group descriptors corrupted!
EXT4-fs (loop2): ext4_check_descriptors: Block bitmap for group 0 overlaps superblock
EXT4-fs (loop2): group descriptors corrupted!
EXT4-fs (loop2): ext4_check_descriptors: Block bitmap for group 0 overlaps superblock
EXT4-fs (loop2): group descriptors corrupted!
EXT4-fs (loop2): ext4_check_descriptors: Block bitmap for group 0 overlaps superblock
EXT4-fs (loop2): group descriptors corrupted!
nla_parse: 40 callbacks suppressed
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
EXT4-fs (loop2): ext4_check_descriptors: Block bitmap for group 0 overlaps superblock
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'.
EXT4-fs (loop2): group descriptors corrupted!
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.


---
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,
Aug 29, 2021, 5:58:15 AM8/29/21
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages