[syzbot] [ext4?] WARNING: locking bug in ext4_xattr_inode_update_ref (2)

4 views
Skip to first unread message

syzbot

unread,
Jul 30, 2023, 11:34:58 PM7/30/23
to adilger...@dilger.ca, linux...@vger.kernel.org, linux-...@vger.kernel.org, linux-...@vger.kernel.org, ll...@lists.linux.dev, nat...@kernel.org, ndesau...@google.com, syzkall...@googlegroups.com, tr...@redhat.com, ty...@mit.edu
Hello,

syzbot found the following issue on:

HEAD commit: 0ba5d0720577 Add linux-next specific files for 20230726
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1747a881a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=f33fb77ef67a25e1
dashboard link: https://syzkaller.appspot.com/bug?extid=6699abaff302165de416
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1217c65ea80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2fa09c6312ae/disk-0ba5d072.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/7361000a4380/vmlinux-0ba5d072.xz
kernel image: https://storage.googleapis.com/syzbot-assets/48a015458a58/bzImage-0ba5d072.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/405ee39c557d/mount_0.gz

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

------------[ cut here ]------------
Looking for class "&ea_inode->i_rwsem" with key ext4_fs_type, but found a different class "&sb->s_type->i_mutex_key" with the same key
WARNING: CPU: 0 PID: 5364 at kernel/locking/lockdep.c:940 look_up_lock_class+0xad/0x120 kernel/locking/lockdep.c:940
Modules linked in:
CPU: 0 PID: 5364 Comm: syz-executor.3 Not tainted 6.5.0-rc3-next-20230726-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023
RIP: 0010:look_up_lock_class+0xad/0x120 kernel/locking/lockdep.c:940
Code: 59 49 8b 14 24 48 81 fa a0 d9 49 90 74 4c 80 3d 43 17 60 04 00 75 43 48 c7 c7 00 82 6c 8a c6 05 33 17 60 04 01 e8 03 f2 16 f7 <0f> 0b eb 2c 89 74 24 04 e8 36 ae e7 f9 8b 74 24 04 48 c7 c7 40 81
RSP: 0018:ffffc90004a4f008 EFLAGS: 00010082
RAX: 0000000000000000 RBX: ffffffff918a53c0 RCX: 0000000000000000
RDX: ffff88802a8ebb80 RSI: ffffffff814d5b56 RDI: 0000000000000001
RBP: ffffffff8cc46c78 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: ffff888066815e00
R13: ffff888066815e00 R14: 0000000000000000 R15: 0000000000000000
FS: 00007f046301d6c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020002000 CR3: 000000002a7c9000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
register_lock_class+0xbd/0x1320 kernel/locking/lockdep.c:1292
__lock_acquire+0x13c/0x5de0 kernel/locking/lockdep.c:5021
lock_acquire kernel/locking/lockdep.c:5761 [inline]
lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726
down_write+0x93/0x200 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:771 [inline]
ext4_xattr_inode_update_ref+0xa6/0x5c0 fs/ext4/xattr.c:1042
ext4_xattr_inode_inc_ref fs/ext4/xattr.c:1088 [inline]
ext4_xattr_inode_inc_ref_all fs/ext4/xattr.c:1115 [inline]
ext4_xattr_block_set+0x2305/0x30e0 fs/ext4/xattr.c:2159
ext4_xattr_set_handle+0xd6e/0x1420 fs/ext4/xattr.c:2456
ext4_xattr_set+0x149/0x370 fs/ext4/xattr.c:2558
__vfs_setxattr+0x173/0x1d0 fs/xattr.c:201
__vfs_setxattr_noperm+0x127/0x5e0 fs/xattr.c:235
__vfs_setxattr_locked+0x17e/0x250 fs/xattr.c:296
vfs_setxattr+0x146/0x350 fs/xattr.c:322
do_setxattr+0x142/0x170 fs/xattr.c:630
setxattr+0x159/0x170 fs/xattr.c:653
path_setxattr+0x1a3/0x1d0 fs/xattr.c:672
__do_sys_setxattr fs/xattr.c:688 [inline]
__se_sys_setxattr fs/xattr.c:684 [inline]
__x64_sys_setxattr+0xc4/0x160 fs/xattr.c:684
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f046c07cb29
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f046301d0c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc
RAX: ffffffffffffffda RBX: 00007f046c19c050 RCX: 00007f046c07cb29
RDX: 00000000200005c0 RSI: 0000000020000180 RDI: 00000000200000c0
RBP: 00007f046c0c847a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000002000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000006e R14: 00007f046c19c050 R15: 00007ffd0e4f6698
</TASK>


---
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.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

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.

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

Hillf Danton

unread,
Jul 31, 2023, 6:23:07 AM7/31/23
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Sun, 30 Jul 2023 20:34:57 -0700
> HEAD commit: 0ba5d0720577 Add linux-next specific files for 20230726
> git tree: linux-next
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1217c65ea80000

Add ea_i_rwsem_key lock key for ea inode.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 0ba5d0720577

--- x/fs/ext4/xattr.c
+++ y/fs/ext4/xattr.c
@@ -123,7 +123,6 @@ void ext4_xattr_inode_set_class(struct i
{
struct ext4_inode_info *ei = EXT4_I(ea_inode);

- lockdep_set_subclass(&ea_inode->i_rwsem, 1);
(void) ei; /* shut up clang warning if !CONFIG_LOCKDEP */
lockdep_set_subclass(&ei->i_data_sem, I_DATA_SEM_EA);
}
@@ -1456,6 +1455,7 @@ out:
return ret;
}

+static struct lock_class_key ea_i_rwsem_key;
/*
* Create an inode to store the value of a large EA.
*/
@@ -1505,6 +1505,7 @@ static struct inode *ext4_xattr_inode_cr
*/
dquot_free_inode(ea_inode);
dquot_drop(ea_inode);
+ lockdep_set_class(&ea_inode->i_rwsem, &ea_i_rwsem_key);
inode_lock(ea_inode);
ea_inode->i_flags |= S_NOQUOTA;
inode_unlock(ea_inode);
--

syzbot

unread,
Jul 31, 2023, 6:48:32 AM7/31/23
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+6699ab...@syzkaller.appspotmail.com

Tested on:

commit: 0ba5d072 Add linux-next specific files for 20230726
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=11a7fef6a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=f33fb77ef67a25e1
dashboard link: https://syzkaller.appspot.com/bug?extid=6699abaff302165de416
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=17d639dea80000

Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Sep 24, 2023, 11:27:28 PM9/24/23
to syzkall...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages