linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [jfs?] kernel BUG in clear_inode (3)
@ 2025-06-12 11:53 syzbot
  2025-06-13  3:05 ` [PATCH] jfs: truncate good inode pages when hard link is 0 Lizhi Xu
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2025-06-12 11:53 UTC (permalink / raw)
  To: jfs-discussion, linux-kernel, shaggy, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    488ef3560196 KEYS: Invert FINAL_PUT bit
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=10a1a10c580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=162faeb2d1eaefb4
dashboard link: https://syzkaller.appspot.com/bug?extid=6e516bb515d93230bc7b
compiler:       Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=149b59d4580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14373682580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/9bcad4b7e6e0/disk-488ef356.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/9ed0e62aacc9/vmlinux-488ef356.xz
kernel image: https://storage.googleapis.com/syzbot-assets/2e5e305c130c/bzImage-488ef356.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/21a324a97f5b/mount_0.gz
  fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=1346e60c580000)

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

------------[ cut here ]------------
kernel BUG at fs/inode.c:753!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 1 UID: 0 PID: 5829 Comm: syz-executor199 Not tainted 6.16.0-rc1-syzkaller-00005-g488ef3560196 #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
RIP: 0010:clear_inode+0x169/0x190 fs/inode.c:753
Code: 4c 89 f7 e8 59 20 e8 ff e9 60 ff ff ff 44 89 f1 80 e1 07 80 c1 03 38 c1 7c c0 4c 89 f7 e8 2f 21 e8 ff eb b6 e8 b8 d3 86 ff 90 <0f> 0b e8 b0 d3 86 ff 90 0f 0b e8 a8 d3 86 ff 90 0f 0b e8 a0 d3 86
RSP: 0018:ffffc900043bf870 EFLAGS: 00010093
RAX: ffffffff82397a38 RBX: ffff88807e1cb248 RCX: ffff888034aeda00
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff52000877eec R12: dffffc0000000000
R13: dffffc0000000000 R14: ffff88807e1cb470 R15: 0000000000000001
FS:  0000555556cc1380(0000) GS:ffff888125d86000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555556cca6f8 CR3: 0000000077920000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 jfs_evict_inode+0xb1/0x440 fs/jfs/inode.c:166
 evict+0x501/0x9c0 fs/inode.c:810
 __dentry_kill+0x209/0x660 fs/dcache.c:669
 shrink_kill+0xa9/0x2c0 fs/dcache.c:1114
 shrink_dentry_list+0x2e0/0x5e0 fs/dcache.c:1141
 shrink_dcache_parent+0xa1/0x2c0 fs/dcache.c:-1
 do_one_tree+0x23/0xe0 fs/dcache.c:1604
 shrink_dcache_for_umount+0xa0/0x170 fs/dcache.c:1621
 generic_shutdown_super+0x67/0x2c0 fs/super.c:621
 kill_block_super+0x44/0x90 fs/super.c:1753
 deactivate_locked_super+0xbc/0x130 fs/super.c:474
 cleanup_mnt+0x425/0x4c0 fs/namespace.c:1417
 task_work_run+0x1d1/0x260 kernel/task_work.c:227
 ptrace_notify+0x281/0x2c0 kernel/signal.c:2520
 ptrace_report_syscall include/linux/ptrace.h:415 [inline]
 ptrace_report_syscall_exit include/linux/ptrace.h:477 [inline]
 syscall_exit_work+0xc6/0x1d0 kernel/entry/common.c:173
 syscall_exit_to_user_mode_work include/linux/entry-common.h:412 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline]
 do_syscall_64+0x2ad/0x3b0 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f724b14c587
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:00007ffffbe47da8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000014e57 RCX: 00007f724b14c587
RDX: 0000000000000000 RSI: 0000000000000009 RDI: 00007ffffbe47e60
RBP: 00007ffffbe47e60 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000202 R12: 00007ffffbe48ed0
R13: 0000555556cc26c0 R14: 431bde82d7b634db R15: 00007ffffbe48ef0
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:clear_inode+0x169/0x190 fs/inode.c:753
Code: 4c 89 f7 e8 59 20 e8 ff e9 60 ff ff ff 44 89 f1 80 e1 07 80 c1 03 38 c1 7c c0 4c 89 f7 e8 2f 21 e8 ff eb b6 e8 b8 d3 86 ff 90 <0f> 0b e8 b0 d3 86 ff 90 0f 0b e8 a8 d3 86 ff 90 0f 0b e8 a0 d3 86
RSP: 0018:ffffc900043bf870 EFLAGS: 00010093
RAX: ffffffff82397a38 RBX: ffff88807e1cb248 RCX: ffff888034aeda00
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff52000877eec R12: dffffc0000000000
R13: dffffc0000000000 R14: ffff88807e1cb470 R15: 0000000000000001
FS:  0000555556cc1380(0000) GS:ffff888125d86000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555556cca6f8 CR3: 0000000077920000 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.

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

* [PATCH] jfs: truncate good inode pages when hard link is 0
  2025-06-12 11:53 [syzbot] [jfs?] kernel BUG in clear_inode (3) syzbot
@ 2025-06-13  3:05 ` Lizhi Xu
  2025-07-11 20:18   ` [Jfs-discussion] " Dave Kleikamp
  0 siblings, 1 reply; 3+ messages in thread
From: Lizhi Xu @ 2025-06-13  3:05 UTC (permalink / raw)
  To: syzbot+6e516bb515d93230bc7b
  Cc: jfs-discussion, linux-kernel, shaggy, syzkaller-bugs

The fileset value of the inode copy from the disk by the reproducer is
AGGR_RESERVED_I. When executing evict, its hard link number is 0, so its
inode pages are not truncated. This causes the bugon to be triggered when
executing clear_inode() because nrpages is greater than 0.

Reported-by: syzbot+6e516bb515d93230bc7b@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6e516bb515d93230bc7b
Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
---
 fs/jfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 60fc92dee24d..81e6b18e81e1 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -145,9 +145,9 @@ void jfs_evict_inode(struct inode *inode)
 	if (!inode->i_nlink && !is_bad_inode(inode)) {
 		dquot_initialize(inode);
 
+		truncate_inode_pages_final(&inode->i_data);
 		if (JFS_IP(inode)->fileset == FILESYSTEM_I) {
 			struct inode *ipimap = JFS_SBI(inode->i_sb)->ipimap;
-			truncate_inode_pages_final(&inode->i_data);
 
 			if (test_cflag(COMMIT_Freewmap, inode))
 				jfs_free_zero_link(inode);
-- 
2.43.0


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

* Re: [Jfs-discussion] [PATCH] jfs: truncate good inode pages when hard link is 0
  2025-06-13  3:05 ` [PATCH] jfs: truncate good inode pages when hard link is 0 Lizhi Xu
@ 2025-07-11 20:18   ` Dave Kleikamp
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Kleikamp @ 2025-07-11 20:18 UTC (permalink / raw)
  To: Lizhi Xu, syzbot+6e516bb515d93230bc7b
  Cc: shaggy, jfs-discussion, syzkaller-bugs, linux-kernel

On 6/12/25 10:05PM, Lizhi Xu via Jfs-discussion wrote:
> The fileset value of the inode copy from the disk by the reproducer is
> AGGR_RESERVED_I. When executing evict, its hard link number is 0, so its
> inode pages are not truncated. This causes the bugon to be triggered when
> executing clear_inode() because nrpages is greater than 0.

Looks good. I'll apply and test this.

Thanks,
Shaggy

> 
> Reported-by: syzbot+6e516bb515d93230bc7b@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=6e516bb515d93230bc7b
> Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
> ---
>   fs/jfs/inode.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
> index 60fc92dee24d..81e6b18e81e1 100644
> --- a/fs/jfs/inode.c
> +++ b/fs/jfs/inode.c
> @@ -145,9 +145,9 @@ void jfs_evict_inode(struct inode *inode)
>   	if (!inode->i_nlink && !is_bad_inode(inode)) {
>   		dquot_initialize(inode);
>   
> +		truncate_inode_pages_final(&inode->i_data);
>   		if (JFS_IP(inode)->fileset == FILESYSTEM_I) {
>   			struct inode *ipimap = JFS_SBI(inode->i_sb)->ipimap;
> -			truncate_inode_pages_final(&inode->i_data);
>   
>   			if (test_cflag(COMMIT_Freewmap, inode))
>   				jfs_free_zero_link(inode);


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

end of thread, other threads:[~2025-07-11 20:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 11:53 [syzbot] [jfs?] kernel BUG in clear_inode (3) syzbot
2025-06-13  3:05 ` [PATCH] jfs: truncate good inode pages when hard link is 0 Lizhi Xu
2025-07-11 20:18   ` [Jfs-discussion] " Dave Kleikamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).