[reiserfs?] possible deadlock in filename_create

5 views
Skip to first unread message

syzbot

unread,
Feb 13, 2023, 6:59:46 AM2/13/23
to syzkaller...@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=1682ac43480000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=388fcc0a5cbb507ca761
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/98c0bdb4abb3/disk-3f8a27f9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea228ff02669/vmlinux-3f8a27f9.xz

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

REISERFS (device loop2): checking transaction log (loop2)
REISERFS (device loop2): Using r5 hash to sort names
reiserfs: enabling write barrier flush mode
REISERFS (device loop2): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.2/25824 is trying to acquire lock:
0000000070936cda (&sbi->lock){+.+.}, at: reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27

but task is already holding lock:
00000000e00a3824 (&type->i_mutex_dir_key#8/1){+.+.}, at: inode_lock_nested include/linux/fs.h:783 [inline]
00000000e00a3824 (&type->i_mutex_dir_key#8/1){+.+.}, at: filename_create+0x15a/0x490 fs/namei.c:3638
overlayfs: failed to clone upperpath

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&type->i_mutex_dir_key#8/1){+.+.}:
inode_lock_nested include/linux/fs.h:783 [inline]
filename_create+0x15a/0x490 fs/namei.c:3638
user_path_create fs/namei.c:3696 [inline]
do_mkdirat+0xa0/0x2d0 fs/namei.c:3834
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #1 (sb_writers#14){.+.+}:
sb_start_write include/linux/fs.h:1579 [inline]
mnt_want_write_file+0x63/0x1d0 fs/namespace.c:418
reiserfs_ioctl+0x1a7/0x9a0 fs/reiserfs/ioctl.c:110
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:501 [inline]
do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
__do_sys_ioctl fs/ioctl.c:712 [inline]
__se_sys_ioctl fs/ioctl.c:710 [inline]
__x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&sbi->lock){+.+.}:
__mutex_lock_common kernel/locking/mutex.c:937 [inline]
__mutex_lock+0xd7/0x1190 kernel/locking/mutex.c:1078
reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27
reiserfs_lookup+0x171/0x490 fs/reiserfs/namei.c:363
__lookup_hash+0x117/0x180 fs/namei.c:1547
filename_create+0x186/0x490 fs/namei.c:3639
user_path_create fs/namei.c:3696 [inline]
do_mkdirat+0xa0/0x2d0 fs/namei.c:3834
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:

Chain exists of:
&sbi->lock --> sb_writers#14 --> &type->i_mutex_dir_key#8/1

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&type->i_mutex_dir_key#8/1);
lock(sb_writers#14);
lock(&type->i_mutex_dir_key#8/1);
lock(&sbi->lock);

*** DEADLOCK ***

2 locks held by syz-executor.2/25824:
#0: 0000000076099438 (sb_writers#14){.+.+}, at: sb_start_write include/linux/fs.h:1579 [inline]
#0: 0000000076099438 (sb_writers#14){.+.+}, at: mnt_want_write+0x3a/0xb0 fs/namespace.c:360
#1: 00000000e00a3824 (&type->i_mutex_dir_key#8/1){+.+.}, at: inode_lock_nested include/linux/fs.h:783 [inline]
#1: 00000000e00a3824 (&type->i_mutex_dir_key#8/1){+.+.}, at: filename_create+0x15a/0x490 fs/namei.c:3638

stack backtrace:
CPU: 1 PID: 25824 Comm: syz-executor.2 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
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
__mutex_lock_common kernel/locking/mutex.c:937 [inline]
__mutex_lock+0xd7/0x1190 kernel/locking/mutex.c:1078
reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27
reiserfs_lookup+0x171/0x490 fs/reiserfs/namei.c:363
overlayfs: failed to clone upperpath
__lookup_hash+0x117/0x180 fs/namei.c:1547
filename_create+0x186/0x490 fs/namei.c:3639
user_path_create fs/namei.c:3696 [inline]
do_mkdirat+0xa0/0x2d0 fs/namei.c:3834
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f811e0390f9
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:00007f811c5ab168 EFLAGS: 00000246 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 00007f811e158f80 RCX: 00007f811e0390f9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000180
RBP: 00007f811e094ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffcd2d0750f R14: 00007f811c5ab300 R15: 0000000000022000
overlayfs: failed to resolve './bus': -2
REISERFS (device loop2): found reiserfs format "3.5" with non-standard journal
REISERFS (device loop2): using ordered data mode
overlayfs: failed to clone upperpath
reiserfs: using flush barriers
REISERFS (device loop2): journal params: device loop2, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop2): checking transaction log (loop2)
REISERFS (device loop2): Using r5 hash to sort names
EXT4-fs warning (device sda1): ext4_resize_begin:72: There are errors in the filesystem, so online resizing is not allowed
reiserfs: enabling write barrier flush mode
REISERFS (device loop2): Created .reiserfs_priv - reserved for xattr storage.
overlayfs: upper fs needs to support d_type.
overlayfs: upper fs does not support tmpfile.
overlayfs: upper fs does not support xattr, falling back to index=off and metacopy=off.
REISERFS (device loop2): found reiserfs format "3.5" with non-standard journal
REISERFS (device loop2): using ordered data mode
reiserfs: using flush barriers
REISERFS (device loop2): journal params: device loop2, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop2): checking transaction log (loop2)
REISERFS (device loop2): Using r5 hash to sort names
reiserfs: enabling write barrier flush mode
REISERFS (device loop2): Created .reiserfs_priv - reserved for xattr storage.
overlayfs: upper fs needs to support d_type.
overlayfs: upper fs does not support tmpfile.
overlayfs: upper fs does not support xattr, falling back to index=off and metacopy=off.
audit: type=1804 audit(1676289536.748:794): pid=25962 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.5" name="/root/syzkaller-testdir2727125351/syzkaller.whUgQ1/497/memory.events" dev="sda1" ino=14131 res=1
audit: type=1800 audit(1676289536.748:795): pid=25962 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.5" name="memory.events" dev="sda1" ino=14131 res=0
audit: type=1804 audit(1676289536.998:796): pid=25948 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.3" name="bus" dev="sda1" ino=13864 res=1
audit: type=1804 audit(1676289537.148:797): pid=25992 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.5" name="/root/syzkaller-testdir2727125351/syzkaller.whUgQ1/498/memory.events" dev="sda1" ino=14428 res=1
overlayfs: unrecognized mount option "lowerdir=" or missing value
9pnet: Insufficient options for proto=fd
audit: type=1800 audit(1676289537.168:798): pid=25992 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.5" name="memory.events" dev="sda1" ino=14428 res=0
audit: type=1804 audit(1676289537.558:799): pid=26018 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.5" name="/root/syzkaller-testdir2727125351/syzkaller.whUgQ1/499/memory.events" dev="sda1" ino=14403 res=1
overlayfs: unrecognized mount option "lowerdir=" or missing value
9pnet: Insufficient options for proto=fd
audit: type=1800 audit(1676289537.588:800): pid=26018 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.5" name="memory.events" dev="sda1" ino=14403 res=0
audit: type=1804 audit(1676289538.158:801): pid=26048 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.5" name="/root/syzkaller-testdir2727125351/syzkaller.whUgQ1/500/memory.events" dev="sda1" ino=14739 res=1
overlayfs: unrecognized mount option "lowerdir=" or missing value
9pnet: Insufficient options for proto=fd
audit: type=1800 audit(1676289538.168:802): pid=26048 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.5" name="memory.events" dev="sda1" ino=14739 res=0
overlayfs: unrecognized mount option "lowerdir=" or missing value
9pnet: Insufficient options for proto=fd
EXT4-fs error (device sda1): mb_free_blocks:1452: group 2, inode 14423: block 73248:freeing already freed block (bit 7712); block bitmap corrupt.
EXT4-fs error (device sda1): ext4_mb_generate_buddy:744: group 2, block bitmap and bg descriptor inconsistent: 867 vs 868 free clusters
EXT4-fs (sda1): pa 00000000533052d3: logic 0, phys. 73248, len 32
EXT4-fs error (device sda1): ext4_mb_release_inode_pa:3864: group 2, free 16, pa_free 15
batman_adv: batadv0: Interface deactivated: batadv_slave_0
batman_adv: batadv0: Removing interface: batadv_slave_0
batman_adv: batadv0: Interface deactivated: batadv_slave_1
batman_adv: batadv0: Removing interface: batadv_slave_1
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
device veth1_macvtap left promiscuous mode
device veth0_macvtap left promiscuous mode
device veth1_vlan left promiscuous mode
device veth0_vlan left promiscuous mode
device hsr_slave_1 left promiscuous mode
device hsr_slave_0 left promiscuous mode
team0 (unregistering): Port device team_slave_1 removed
team0 (unregistering): Port device team_slave_0 removed
bond0 (unregistering): Releasing backup interface bond_slave_1
bond0 (unregistering): Releasing backup interface bond_slave_0
bond0 (unregistering): Released all slaves
IPVS: ftp: loaded support on port[0] = 21
chnl_net:caif_netlink_parms(): no params data found
bridge0: port 1(bridge_slave_0) entered blocking state
bridge0: port 1(bridge_slave_0) entered disabled state
device bridge_slave_0 entered promiscuous mode
bridge0: port 2(bridge_slave_1) entered blocking state
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_1 entered promiscuous mode
bond0: Enslaving bond_slave_0 as an active interface with an up link
bond0: Enslaving bond_slave_1 as an active interface with an up link
IPv6: ADDRCONF(NETDEV_UP): team_slave_0: link is not ready
team0: Port device team_slave_0 added
IPv6: ADDRCONF(NETDEV_UP): team_slave_1: link is not ready
team0: Port device team_slave_1 added
batman_adv: batadv0: Adding interface: batadv_slave_0
batman_adv: batadv0: The MTU of interface batadv_slave_0 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1560 would solve the problem.
batman_adv: batadv0: Not using interface batadv_slave_0 (retrying later): interface not active
batman_adv: batadv0: Adding interface: batadv_slave_1
batman_adv: batadv0: The MTU of interface batadv_slave_1 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1560 would solve the problem.
batman_adv: batadv0: Not using interface batadv_slave_1 (retrying later): interface not active
IPv6: ADDRCONF(NETDEV_UP): bridge_slave_0: link is not ready
IPv6: ADDRCONF(NETDEV_UP): bridge_slave_1: link is not ready


---
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.
Reply all
Reply to author
Forward
0 new messages