public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [jfs?] kernel BUG in clear_inode (2)
@ 2024-10-28 16:33 syzbot
  2024-11-07  5:47 ` [syzbot] Re: kernel BUG in clear_inode() syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2024-10-28 16:33 UTC (permalink / raw)
  To: jfs-discussion, linux-kernel, shaggy, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    4e46774408d9 Merge tag 'for-6.12-rc4-tag' of git://git.ker..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=17d0b0e7980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=41330fd2db03893d
dashboard link: https://syzkaller.appspot.com/bug?extid=ac2116e48989e84a2893
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=17a9ae40580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1030b0e7980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/d5a3632f9dde/disk-4e467744.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c6d73f937198/vmlinux-4e467744.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b8cdecc78206/bzImage-4e467744.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/07de6ffca997/mount_0.gz

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

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=10b0b287980000
final oops:     https://syzkaller.appspot.com/x/report.txt?x=12b0b287980000
console output: https://syzkaller.appspot.com/x/log.txt?x=14b0b287980000

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

------------[ cut here ]------------
kernel BUG at fs/inode.c:668!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 0 UID: 0 PID: 113 Comm: jfsCommit Not tainted 6.12.0-rc4-syzkaller-00085-g4e46774408d9 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
RIP: 0010:clear_inode+0x168/0x190 fs/inode.c:668
Code: 4c 89 f7 e8 ba fe e5 ff e9 61 ff ff ff 44 89 f1 80 e1 07 80 c1 03 38 c1 7c c1 4c 89 f7 e8 90 ff e5 ff eb b7 e8 09 5d 7f ff 90 <0f> 0b e8 01 5d 7f ff 90 0f 0b e8 f9 5c 7f ff 90 0f 0b e8 f1 5c 7f
RSP: 0018:ffffc90002cffae8 EFLAGS: 00010093
RAX: ffffffff82157a87 RBX: 0000000000000001 RCX: ffff88801eb2bc00
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: ffffc90002cffc90 R08: ffffffff82157977 R09: fffff5200059ff38
R10: dffffc0000000000 R11: fffff5200059ff38 R12: dffffc0000000000
R13: ffff888071503c00 R14: ffff888071503da8 R15: ffff888071503b80
FS:  0000000000000000(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f4b23f95ed8 CR3: 000000000e734000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 jfs_evict_inode+0xb5/0x440 fs/jfs/inode.c:166
 evict+0x4e8/0x9b0 fs/inode.c:725
 txUpdateMap+0x931/0xb10 fs/jfs/jfs_txnmgr.c:2367
 txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline]
 jfs_lazycommit+0x49a/0xb80 fs/jfs/jfs_txnmgr.c:2733
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:clear_inode+0x168/0x190 fs/inode.c:668
Code: 4c 89 f7 e8 ba fe e5 ff e9 61 ff ff ff 44 89 f1 80 e1 07 80 c1 03 38 c1 7c c1 4c 89 f7 e8 90 ff e5 ff eb b7 e8 09 5d 7f ff 90 <0f> 0b e8 01 5d 7f ff 90 0f 0b e8 f9 5c 7f ff 90 0f 0b e8 f1 5c 7f
RSP: 0018:ffffc90002cffae8 EFLAGS: 00010093
RAX: ffffffff82157a87 RBX: 0000000000000001 RCX: ffff88801eb2bc00
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: ffffc90002cffc90 R08: ffffffff82157977 R09: fffff5200059ff38
R10: dffffc0000000000 R11: fffff5200059ff38 R12: dffffc0000000000
R13: ffff888071503c00 R14: ffff888071503da8 R15: ffff888071503b80
FS:  0000000000000000(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f4b23f95ed8 CR3: 000000000e734000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
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 syzkaller@googlegroups.com.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [syzbot] Re: kernel BUG in clear_inode()
  2024-10-28 16:33 [syzbot] [jfs?] kernel BUG in clear_inode (2) syzbot
@ 2024-11-07  5:47 ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2024-11-07  5:47 UTC (permalink / raw)
  To: linux-kernel, syzkaller-bugs

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: Re: kernel BUG in clear_inode()
Author: dmantipov@yandex.ru

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

diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index a360b24ed320..debfc1389cb3 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -3029,14 +3029,23 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno,
  *
  * RETURN VALUES:
  *	0	- success
- *	-ENOMEM	- insufficient memory
+ *	-EINVAL	- unexpected inode type
  */
 static int copy_from_dinode(struct dinode * dip, struct inode *ip)
 {
 	struct jfs_inode_info *jfs_ip = JFS_IP(ip);
 	struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
+	int fileset = le32_to_cpu(dip->di_fileset);
+
+	switch (fileset) {
+	case AGGR_RESERVED_I: case AGGREGATE_I: case BMAP_I:
+	case LOG_I: case BADBLOCK_I: case FILESYSTEM_I:
+		break;
+	default:
+		return -EINVAL;
+	}
 
-	jfs_ip->fileset = le32_to_cpu(dip->di_fileset);
+	jfs_ip->fileset = fileset;
 	jfs_ip->mode2 = le32_to_cpu(dip->di_mode);
 	jfs_set_inode_flags(ip);
 
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index d68a4e6ac345..845abc598334 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -1467,8 +1467,14 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, unsig
 		ip = ERR_PTR(rc);
 	} else {
 		ip = jfs_iget(dip->i_sb, inum);
-		if (IS_ERR(ip))
-			jfs_err("jfs_lookup: iget failed on inum %d", (uint)inum);
+		if (IS_ERR(ip)) {
+			long err = PTR_ERR(ip);
+
+			jfs_err("%s: iget failed on inum %d with error"
+				" %ld, consider running 'jfs_fsck -f /dev/%s'",
+				__func__, (uint)inum, err, dip->i_sb->s_id);
+			return ERR_PTR(err);
+		}
 	}
 
 	return d_splice_alias(ip, dentry);
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [syzbot] [jfs?] kernel BUG in clear_inode (2)
       [not found] <20241107054740.p8xGy%dmantipov@yandex.ru>
@ 2024-11-07  6:12 ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2024-11-07  6:12 UTC (permalink / raw)
  To: dmantipov, linux-kernel, syzkaller-bugs

Hello,

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

Reported-by: syzbot+ac2116e48989e84a2893@syzkaller.appspotmail.com
Tested-by: syzbot+ac2116e48989e84a2893@syzkaller.appspotmail.com

Tested on:

commit:         ff7afaec Merge tag 'nfs-for-6.12-3' of git://git.linux..
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=106f2e30580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=2a6113a06ffd9630
dashboard link: https://syzkaller.appspot.com/bug?extid=ac2116e48989e84a2893
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=15f0df40580000

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-07  6:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-28 16:33 [syzbot] [jfs?] kernel BUG in clear_inode (2) syzbot
2024-11-07  5:47 ` [syzbot] Re: kernel BUG in clear_inode() syzbot
     [not found] <20241107054740.p8xGy%dmantipov@yandex.ru>
2024-11-07  6:12 ` [syzbot] [jfs?] kernel BUG in clear_inode (2) syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox