Test if it's still reproducible
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-6.1.y
fs/jfs/jfs_dinode.h +1 -1
@@ -96,7 +96,7 @@ struct dinode {#define di_gengen u._file._u1._imap._gengenunion { -xtpage_t _xtroot; +xtroot_t _xtroot;struct {u8 unused[16 ];/* 16: */ dxd_t _dxd;/* 16: */
fs/jfs/jfs_imap.c +3 -3
@@ -673,7 +673,7 @@ int diWrite(tid_t tid, struct inode *ip)* This is the special xtree inside the directory for storing * the directory table */ -xtpage_t *p, *xp; +xtroot_t *p, *xp;xad_t *xad; jfs_ip->xtlid =0 ;
@@ -687,7 +687,7 @@ int diWrite(tid_t tid, struct inode *ip)* copy xtree root from inode to dinode: */ p = &jfs_ip->i_xtroot; - xp = (xtpage_t *) &dp->di_dirtable; + xp = (xtroot_t *) &dp->di_dirtable; lv = ilinelock->lv;for (n =0 ; n < ilinelock->index; n++, lv++) { memcpy(&xp->xad[lv->offset], &p->xad[lv->offset],
@@ -716,7 +716,7 @@ int diWrite(tid_t tid, struct inode *ip)* regular file: 16 byte (XAD slot) granularity */ if (type & tlckXTREE) { -xtpage_t *p, *xp; +xtroot_t *p, *xp;xad_t *xad;/*
fs/jfs/jfs_incore.h +1 -1
@@ -66,7 +66,7 @@ struct jfs_inode_info {lid_t xtlid;/* lid of xtree lock on directory */ union {struct { -xtpage_t _xtroot;/* 288: xtree root */ +xtroot_t _xtroot;/* 288: xtree root */ struct inomap *_imap;/* 4: inode map header */ } file;struct {
fs/jfs/jfs_txnmgr.c +2 -2
@@ -783,7 +783,7 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp,if (mp->xflag &COMMIT_PAGE ) p = (xtpage_t *) mp->data;else - p = &jfs_ip->i_xtroot; + p = (xtpage_t *) &jfs_ip->i_xtroot; xtlck->lwm.offset =le16_to_cpu (p->header.nextindex); }
@@ -1676,7 +1676,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,if (tlck->type & tlckBTROOT) { lrd->log.redopage.type |=cpu_to_le16 (LOG_BTROOT ); - p = &JFS_IP (ip)->i_xtroot; + p = (xtpage_t *) &JFS_IP (ip)->i_xtroot;if (S_ISDIR (ip->i_mode)) lrd->log.redopage.type |=cpu_to_le16 (LOG_DIR_XTREE );
fs/jfs/jfs_xtree.c +2 -2
@@ -1213,7 +1213,7 @@ xtSplitRoot(tid_t tid,struct xtlock *xtlck;int rc; - sp = &JFS_IP (ip)->i_xtroot; + sp = (xtpage_t *) &JFS_IP (ip)->i_xtroot;INCREMENT (xtStat.split);
@@ -2098,7 +2098,7 @@ int xtAppend(tid_t tid, /* transaction id */*/ void xtInitRoot (tid_t tid,struct inode *ip) { -xtpage_t *p; +xtroot_t *p;/* * acquire a transaction lock on the root
fs/jfs/jfs_xtree.h +23 -14
@@ -65,24 +65,33 @@ struct xadlist {#define XTPAGEMAXSLOT 256#define XTENTRYSTART 2 -/* -* xtree page: -*/ -typedef union { -struct xtheader { -__le64 next;/* 8: */ -__le64 prev;/* 8: */ +struct xtheader { +__le64 next;/* 8: */ +__le64 prev;/* 8: */ -u8 flag;/* 1: */ -u8 rsrvd1;/* 1: */ -__le16 nextindex;/* 2: next index = number of entries */ -__le16 maxentry;/* 2: max number of entries */ -__le16 rsrvd2;/* 2: */ +u8 flag;/* 1: */ +u8 rsrvd1;/* 1: */ +__le16 nextindex;/* 2: next index = number of entries */ +__le16 maxentry;/* 2: max number of entries */ +__le16 rsrvd2;/* 2: */ -pxd_t self;/* 8: self */ - } header;/* (32) */ +pxd_t self;/* 8: self */ +}; +/* +* xtree root (in inode): +*/ +typedef union { +struct xtheader header;xad_t xad[XTROOTMAXSLOT ];/* 16 * maxentry: xad array */ +}xtroot_t ; + +/* +* xtree page: +*/ +typedef union { +struct xtheader header; +xad_t xad[XTPAGEMAXSLOT ];/* 16 * maxentry: xad array */ }xtpage_t ;/*
syzbot
syzbotRe: [v6.1] UBSAN: array-index-out-of-bounds in xtInsert
syzbot has tested the proposed patch but the reproducer is still triggering an issue: kernel BUG in jfs_evict_inode
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
kernel BUG in jfs_evict_inode
------------[ cut here ]------------ kernel BUG at fs/jfs/inode.c:169! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 4893 Comm: syz-executor Not tainted 6.1.135-syzkaller-dirty #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 RIP: 0010:jfs_evict_inode+0x42d/0x430 fs/jfs/inode.c:169 Code: ea fe e9 e0 fd ff ff 44 89 f1 80 e1 07 80 c1 03 38 c1 0f 8c 17 fe ff ff 4c 89 f7 e8 cd 86 ea fe e9 0a fe ff ff e8 a3 18 99 fe <0f> 0b 90 41 57 41 56 41 54 53 48 89 fb 49 bc 00 00 00 00 00 fc ff RSP: 0018:ffffc90003297ac0 EFLAGS: 00010293 RAX: ffffffff82e7aafd RBX: ffff888069b5bbb0 RCX: ffff88807c185940 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff888069b5bbb0 RBP: 0000000000000001 R08: dffffc0000000000 R09: fffffbfff2116e6c R10: fffffbfff2116e6c R11: 1ffffffff2116e6b R12: dffffc0000000000 R13: dffffc0000000000 R14: ffff888069b5b838 R15: ffff888069b5bd80 FS: 000055557828c500(0000) GS:ffff8880b8f00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fe798659440 CR3: 0000000029455000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> evict+0x485/0x870 fs/inode.c:705 dispose_list fs/inode.c:738 [inline] evict_inodes+0x604/0x690 fs/inode.c:792 generic_shutdown_super+0x93/0x340 fs/super.c:480 kill_block_super+0x7c/0xe0 fs/super.c:1470 deactivate_locked_super+0x93/0xf0 fs/super.c:332 cleanup_mnt+0x463/0x4f0 fs/namespace.c:1186 task_work_run+0x1ca/0x250 kernel/task_work.c:203 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:177 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f3f5d18e497 Code: a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 a8 ff ff ff f7 d8 64 89 02 b8 RSP: 002b:00007ffcbdc0ca48 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 00007f3f5d20e08c RCX: 00007f3f5d18e497 RDX: 0000000000000000 RSI: 0000000000000009 RDI: 00007ffcbdc0cb00 RBP: 00007ffcbdc0cb00 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffcbdc0db90 R13: 00007f3f5d20e08c R14: 000000000002057a R15: 00007ffcbdc0dbd0 </TASK> Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:jfs_evict_inode+0x42d/0x430 fs/jfs/inode.c:169 Code: ea fe e9 e0 fd ff ff 44 89 f1 80 e1 07 80 c1 03 38 c1 0f 8c 17 fe ff ff 4c 89 f7 e8 cd 86 ea fe e9 0a fe ff ff e8 a3 18 99 fe <0f> 0b 90 41 57 41 56 41 54 53 48 89 fb 49 bc 00 00 00 00 00 fc ff RSP: 0018:ffffc90003297ac0 EFLAGS: 00010293 RAX: ffffffff82e7aafd RBX: ffff888069b5bbb0 RCX: ffff88807c185940 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff888069b5bbb0 RBP: 0000000000000001 R08: dffffc0000000000 R09: fffffbfff2116e6c R10: fffffbfff2116e6c R11: 1ffffffff2116e6b R12: dffffc0000000000 R13: dffffc0000000000 R14: ffff888069b5b838 R15: ffff888069b5bd80 FS: 000055557828c500(0000) GS:ffff8880b8f00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f6ce8dcd5e8 CR3: 0000000029455000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Tested on:
commit: 535ec20c Linux 6.1.135 git tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-6.1.y console output: https://syzkaller.appspot.com/x/log.txt?x=17c5e270580000 kernel config: https://syzkaller.appspot.com/x/.config?x=f8907c20e9d898d8 dashboard link: https://syzkaller.appspot.com/bug?extid=6b1d79dad6cc6b3eef41 compiler: Debian clang version 20.1.2 (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97), Debian LLD 20.1.2 patch: https://syzkaller.appspot.com/x/patch.diff?x=1231a368580000