2024-05-28 15:21:38

by syzbot

[permalink] [raw]
Subject: [syzbot] [ext4?] WARNING in ext4_xattr_inode_lookup_create

Hello,

syzbot found the following issue on:

HEAD commit: 8f6a15f095a6 Merge tag 'cocci-for-6.10' of git://git.kerne..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=120d27a4980000
kernel config: https://syzkaller.appspot.com/x/.config?x=6be91306a8917025
dashboard link: https://syzkaller.appspot.com/bug?extid=fe42a669c87e4a980051
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=138da210980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1053d8fc980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/02867060d65d/disk-8f6a15f0.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/4bb75fbf6fb1/vmlinux-8f6a15f0.xz
kernel image: https://storage.googleapis.com/syzbot-assets/fd38cadddf33/bzImage-8f6a15f0.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/e24b09069472/mount_0.gz

Bisection is inconclusive: the issue happens on the oldest tested release.

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=178e5ca4980000
final oops: https://syzkaller.appspot.com/x/report.txt?x=144e5ca4980000
console output: https://syzkaller.appspot.com/x/log.txt?x=104e5ca4980000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

EXT4-fs warning (device loop0): ext4_xattr_inode_create:1471: refuse to create EA inode when umounting
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5082 at fs/ext4/xattr.c:1472 ext4_xattr_inode_create fs/ext4/xattr.c:1472 [inline]
WARNING: CPU: 0 PID: 5082 at fs/ext4/xattr.c:1472 ext4_xattr_inode_lookup_create+0xc38/0x1ea0 fs/ext4/xattr.c:1590
Modules linked in:
CPU: 0 PID: 5082 Comm: syz-executor226 Not tainted 6.9.0-syzkaller-10323-g8f6a15f095a6 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
RIP: 0010:ext4_xattr_inode_create fs/ext4/xattr.c:1472 [inline]
RIP: 0010:ext4_xattr_inode_lookup_create+0xc38/0x1ea0 fs/ext4/xattr.c:1590
Code: 18 e9 b4 03 00 00 4d 89 e5 e8 24 5d 2c ff 4c 89 ff 48 c7 c6 28 a4 b8 8d ba bf 05 00 00 48 c7 c1 40 a1 df 8b e8 39 15 fc ff 90 <0f> 0b 90 49 c7 c4 ea ff ff ff 4c 8b 74 24 68 4c 8b 7c 24 18 e9 96
RSP: 0018:ffffc900034a7120 EFLAGS: 00010246
RAX: 347f6253c1206700 RBX: 0000000000000000 RCX: 347f6253c1206700
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: ffffc900034a72f0 R08: ffffffff8176a12c R09: 1ffff92000694d9c
R10: dffffc0000000000 R11: fffff52000694d9d R12: dffffc0000000000
R13: dffffc0000000000 R14: ffffc900034a7230 R15: ffff888023e3c000
FS: 0000555564020380(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005555640296f8 CR3: 0000000078050000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
ext4_xattr_block_set+0x277/0x3880 fs/ext4/xattr.c:1910
ext4_xattr_move_to_block fs/ext4/xattr.c:2663 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2738 [inline]
ext4_expand_extra_isize_ea+0x12d7/0x1cf0 fs/ext4/xattr.c:2830
__ext4_expand_extra_isize+0x2fb/0x3e0 fs/ext4/inode.c:5782
ext4_try_to_expand_extra_isize fs/ext4/inode.c:5825 [inline]
__ext4_mark_inode_dirty+0x524/0x880 fs/ext4/inode.c:5903
ext4_dirty_inode+0xce/0x110 fs/ext4/inode.c:5935
__mark_inode_dirty+0x325/0xe20 fs/fs-writeback.c:2486
mark_inode_dirty_sync include/linux/fs.h:2421 [inline]
iput+0x1fe/0x930 fs/inode.c:1764
__dentry_kill+0x20d/0x630 fs/dcache.c:603
shrink_kill+0xa9/0x2c0 fs/dcache.c:1048
shrink_dentry_list+0x2c0/0x5b0 fs/dcache.c:1075
shrink_dcache_parent+0xcb/0x3b0
do_one_tree+0x23/0xe0 fs/dcache.c:1538
shrink_dcache_for_umount+0x7d/0x130 fs/dcache.c:1555
generic_shutdown_super+0x6a/0x2d0 fs/super.c:620
kill_block_super+0x44/0x90 fs/super.c:1676
ext4_kill_sb+0x68/0xa0 fs/ext4/super.c:7319
deactivate_locked_super+0xc4/0x130 fs/super.c:473
cleanup_mnt+0x426/0x4c0 fs/namespace.c:1267
task_work_run+0x24f/0x310 kernel/task_work.c:180
ptrace_notify+0x2d2/0x380 kernel/signal.c:2404
ptrace_report_syscall include/linux/ptrace.h:415 [inline]
ptrace_report_syscall_exit include/linux/ptrace.h:477 [inline]
syscall_exit_work+0xc6/0x190 kernel/entry/common.c:173
syscall_exit_to_user_mode_prepare kernel/entry/common.c:200 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:205 [inline]
syscall_exit_to_user_mode+0x273/0x370 kernel/entry/common.c:218
do_syscall_64+0x102/0x240 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f15671fa587
Code: 07 00 48 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffeafe5a078 EFLAGS: 00000206 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f15671fa587
RDX: 0000000000000000 RSI: 0000000000000009 RDI: 00007ffeafe5a130
RBP: 00007ffeafe5a130 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000206 R12: 00007ffeafe5b1a0
R13: 00005555640216c0 R14: 431bde82d7b634db R15: 00007ffeafe5b1c0
</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 [email protected].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the report is already addressed, 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 overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

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

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


2024-05-29 00:19:28

by Edward Adam Davis

[permalink] [raw]
Subject: Re: [syzbot] [ext4?] WARNING in ext4_xattr_inode_lookup_create

please test wr in ext4_xattr_inode_lookup_create

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8f6a15f095a6

diff --git a/fs/dcache.c b/fs/dcache.c
index 407095188f83..e2f1a3f92ce9 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1551,8 +1551,8 @@ void shrink_dcache_for_umount(struct super_block *sb)
WARN(down_read_trylock(&sb->s_umount), "s_umount should've been locked");

dentry = sb->s_root;
- sb->s_root = NULL;
do_one_tree(dentry);
+ sb->s_root = NULL;

while (!hlist_bl_empty(&sb->s_roots)) {
dentry = dget(hlist_bl_entry(hlist_bl_first(&sb->s_roots), struct dentry, d_hash));


2024-05-29 00:53:47

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [ext4?] WARNING in ext4_xattr_inode_lookup_create

Hello,

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

Reported-and-tested-by: [email protected]

Tested on:

commit: 8f6a15f0 Merge tag 'cocci-for-6.10' of git://git.kerne..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=16382592980000
kernel config: https://syzkaller.appspot.com/x/.config?x=6be91306a8917025
dashboard link: https://syzkaller.appspot.com/bug?extid=fe42a669c87e4a980051
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=10aa5864980000

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

2024-05-29 01:29:00

by Edward Adam Davis

[permalink] [raw]
Subject: [PATCH] fs/dcache: fix warning in ext4_xattr_inode_lookup_create

ext4_xattr_inode_lookup_create() will use s_root, so set it to NULL
after do_one_tree().

Reported-and-tested-by: [email protected]
Signed-off-by: Edward Adam Davis <[email protected]>
---
fs/dcache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 407095188f83..e2f1a3f92ce9 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1551,8 +1551,8 @@ void shrink_dcache_for_umount(struct super_block *sb)
WARN(down_read_trylock(&sb->s_umount), "s_umount should've been locked");

dentry = sb->s_root;
- sb->s_root = NULL;
do_one_tree(dentry);
+ sb->s_root = NULL;

while (!hlist_bl_empty(&sb->s_roots)) {
dentry = dget(hlist_bl_entry(hlist_bl_first(&sb->s_roots), struct dentry, d_hash));
--
2.43.0


2024-05-29 02:02:33

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] fs/dcache: fix warning in ext4_xattr_inode_lookup_create

On Wed, May 29, 2024 at 02:56:52AM +0100, Al Viro wrote:
> On Wed, May 29, 2024 at 09:15:02AM +0800, Edward Adam Davis wrote:
> > ext4_xattr_inode_lookup_create() will use s_root, so set it to NULL
> > after do_one_tree().
>
> Why, in the name of everything unholy, would eviction of dentries need
> to set any kind of xattrs?

IOW, that might make the testcase STFU, but something odd is happening
there and I would really like to understand the details before we go
that way.