* [syzbot] [jfs?] KASAN: slab-out-of-bounds Read in dbAllocBits
@ 2024-05-09 13:18 syzbot
2025-11-25 19:28 ` Syakaller testing for KASAN: slab-out-of-bounds Read in dbAllocBits bug Prithvi Tambewagh
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: syzbot @ 2024-05-09 13:18 UTC (permalink / raw)
To: jfs-discussion, linux-kernel, shaggy, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 7367539ad4b0 Merge tag 'cxl-fixes-6.9-rc7' of git://git.ke..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16306574980000
kernel config: https://syzkaller.appspot.com/x/.config?x=3310e643b6ef5d69
dashboard link: https://syzkaller.appspot.com/bug?extid=0be47376a6acbcba7f0d
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=159d897f180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16c3d354980000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7bc7510fe41f/non_bootable_disk-7367539a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1f814bef5f63/vmlinux-7367539a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/cd1f53098470/bzImage-7367539a.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/6f1d86e6c9f3/mount_0.gz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+0be47376a6acbcba7f0d@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: slab-out-of-bounds in dbAllocBits+0x61e/0x630 fs/jfs/jfs_dmap.c:2255
Read of size 8 at addr ffff88802639eeb8 by task syz-executor242/5196
CPU: 2 PID: 5196 Comm: syz-executor242 Not tainted 6.9.0-rc6-syzkaller-00234-g7367539ad4b0 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
print_address_description mm/kasan/report.c:377 [inline]
print_report+0xc3/0x620 mm/kasan/report.c:488
kasan_report+0xd9/0x110 mm/kasan/report.c:601
dbAllocBits+0x61e/0x630 fs/jfs/jfs_dmap.c:2255
dbAllocDmap+0x5c/0x110 fs/jfs/jfs_dmap.c:2032
dbAllocNear fs/jfs/jfs_dmap.c:1258 [inline]
dbAlloc+0x784/0xab0 fs/jfs/jfs_dmap.c:843
ea_get+0xc11/0x12c0 fs/jfs/xattr.c:514
__jfs_setxattr+0x1ed/0x1070 fs/jfs/xattr.c:718
__jfs_set_acl+0x110/0x1a0 fs/jfs/acl.c:87
jfs_set_acl+0x256/0x330 fs/jfs/acl.c:115
set_posix_acl+0x25c/0x320 fs/posix_acl.c:955
vfs_set_acl+0x53d/0x900 fs/posix_acl.c:1134
do_set_acl+0xd9/0x1b0 fs/posix_acl.c:1279
do_setxattr+0xeb/0x170 fs/xattr.c:626
setxattr+0x15d/0x180 fs/xattr.c:652
path_setxattr+0x179/0x1e0 fs/xattr.c:671
__do_sys_lsetxattr fs/xattr.c:694 [inline]
__se_sys_lsetxattr fs/xattr.c:690 [inline]
__x64_sys_lsetxattr+0xc1/0x160 fs/xattr.c:690
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f03a87c66b9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffca6e6e748 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f03a87c66b9
RDX: 0000000020000180 RSI: 0000000020000040 RDI: 0000000020000000
RBP: 00007f03a883f610 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000024 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffca6e6e918 R14: 0000000000000001 R15: 0000000000000001
</TASK>
Allocated by task 4906:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slub.c:3966 [inline]
__kmalloc_node_track_caller+0x220/0x470 mm/slub.c:3986
kmalloc_reserve+0xef/0x2c0 net/core/skbuff.c:599
__alloc_skb+0x164/0x380 net/core/skbuff.c:668
__netdev_alloc_skb+0x72/0x3f0 net/core/skbuff.c:732
__netdev_alloc_skb_ip_align include/linux/skbuff.h:3321 [inline]
e1000_alloc_rx_buffers+0x3b5/0x7b0 drivers/net/ethernet/intel/e1000e/netdev.c:668
e1000_configure+0x199a/0x4ad0 drivers/net/ethernet/intel/e1000e/netdev.c:3761
e1000e_open+0x403/0x1790 drivers/net/ethernet/intel/e1000e/netdev.c:4658
__dev_open+0x2d4/0x4e0 net/core/dev.c:1430
__dev_change_flags+0x561/0x720 net/core/dev.c:8692
dev_change_flags+0x8f/0x160 net/core/dev.c:8764
devinet_ioctl+0x127a/0x1f10 net/ipv4/devinet.c:1172
inet_ioctl+0x3aa/0x3f0 net/ipv4/af_inet.c:1001
sock_do_ioctl+0x116/0x280 net/socket.c:1222
sock_ioctl+0x22e/0x6c0 net/socket.c:1341
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:904 [inline]
__se_sys_ioctl fs/ioctl.c:890 [inline]
__x64_sys_ioctl+0x193/0x220 fs/ioctl.c:890
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff88802639e000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1720 bytes to the right of
allocated 2048-byte region [ffff88802639e000, ffff88802639e800)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x26398
head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888015042f00 ffffea000069fc00 dead000000000002
raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
head: 00fff00000000840 ffff888015042f00 ffffea000069fc00 dead000000000002
head: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
head: 00fff00000000003 ffffea000098e601 dead000000000122 00000000ffffffff
head: 0000000800000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4675, tgid -996255200 (klogd), ts 4675, free_ts 20473074610
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534
prep_new_page mm/page_alloc.c:1541 [inline]
get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317
__alloc_pages+0x22b/0x2460 mm/page_alloc.c:4575
__alloc_pages_node include/linux/gfp.h:238 [inline]
alloc_pages_node include/linux/gfp.h:261 [inline]
alloc_slab_page mm/slub.c:2175 [inline]
allocate_slab mm/slub.c:2338 [inline]
new_slab+0xcc/0x3a0 mm/slub.c:2391
___slab_alloc+0x66d/0x1790 mm/slub.c:3525
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610
__slab_alloc_node mm/slub.c:3663 [inline]
slab_alloc_node mm/slub.c:3835 [inline]
kmalloc_trace+0x2fb/0x330 mm/slub.c:3992
kmalloc include/linux/slab.h:628 [inline]
syslog_print+0xf9/0x5d0 kernel/printk/printk.c:1556
do_syslog+0x3be/0x6a0 kernel/printk/printk.c:1734
__do_sys_syslog kernel/printk/printk.c:1826 [inline]
__se_sys_syslog kernel/printk/printk.c:1824 [inline]
__x64_sys_syslog+0x74/0xb0 kernel/printk/printk.c:1824
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 4675 tgid 4675 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1141 [inline]
free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2347
free_unref_page+0x33/0x3c0 mm/page_alloc.c:2487
__put_partials+0x14c/0x170 mm/slub.c:2906
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3798 [inline]
slab_alloc_node mm/slub.c:3845 [inline]
kmem_cache_alloc_node+0x177/0x340 mm/slub.c:3888
__alloc_skb+0x2b1/0x380 net/core/skbuff.c:658
alloc_skb include/linux/skbuff.h:1313 [inline]
alloc_skb_with_frags+0xe4/0x710 net/core/skbuff.c:6515
sock_alloc_send_pskb+0x7f1/0x980 net/core/sock.c:2795
unix_dgram_sendmsg+0x4b9/0x1b10 net/unix/af_unix.c:2019
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
__sys_sendto+0x47f/0x4e0 net/socket.c:2191
__do_sys_sendto net/socket.c:2203 [inline]
__se_sys_sendto net/socket.c:2199 [inline]
__x64_sys_sendto+0xe0/0x1c0 net/socket.c:2199
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff88802639ed80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88802639ee00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88802639ee80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88802639ef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88802639ef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
---
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] 6+ messages in thread
* Re: Syakaller testing for KASAN: slab-out-of-bounds Read in dbAllocBits bug
2024-05-09 13:18 [syzbot] [jfs?] KASAN: slab-out-of-bounds Read in dbAllocBits syzbot
@ 2025-11-25 19:28 ` Prithvi Tambewagh
2025-11-25 19:49 ` [syzbot] [jfs?] KASAN: slab-out-of-bounds Read in dbAllocBits syzbot
2026-03-22 12:51 ` Forwarded: [PATCH v2] jfs: fix slab-out-of-bounds in dbAllocBits and dbFreeBits syzbot
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Prithvi Tambewagh @ 2025-11-25 19:28 UTC (permalink / raw)
To: syzbot+0be47376a6acbcba7f0d
Cc: jfs-discussion, linux-kernel, shaggy, syzkaller-bugs,
Prithvi Tambewagh
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 7367539ad4b0f8f9b396baf02110962333719a48
Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
fs/jfs/jfs_dmap.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index cb3cda1390ad..8dba15c83a49 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -2142,6 +2142,11 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
int size;
s8 *leaf;
+ if(blkno >= le64_to_cpu(bmp->db_mapsize)) {
+ jfs_error(bmp->db_ipbmap->i_sb, "Allocation request out of bounds\n");
+ return;
+ }
+
/* pick up a pointer to the leaves of the dmap tree */
leaf = dp->tree.stree + LEAFIND;
base-commit: 7367539ad4b0f8f9b396baf02110962333719a48
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [syzbot] [jfs?] KASAN: slab-out-of-bounds Read in dbAllocBits
2025-11-25 19:28 ` Syakaller testing for KASAN: slab-out-of-bounds Read in dbAllocBits bug Prithvi Tambewagh
@ 2025-11-25 19:49 ` syzbot
0 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2025-11-25 19:49 UTC (permalink / raw)
To: activprithvi, jfs-discussion, linux-kernel, shaggy,
syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+0be47376a6acbcba7f0d@syzkaller.appspotmail.com
Tested-by: syzbot+0be47376a6acbcba7f0d@syzkaller.appspotmail.com
Tested on:
commit: 7367539a Merge tag 'cxl-fixes-6.9-rc7' of git://git.ke..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=119fc57c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=c5c1288953a7c923
dashboard link: https://syzkaller.appspot.com/bug?extid=0be47376a6acbcba7f0d
compiler: gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=10a45612580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Forwarded: [PATCH v2] jfs: fix slab-out-of-bounds in dbAllocBits and dbFreeBits
2024-05-09 13:18 [syzbot] [jfs?] KASAN: slab-out-of-bounds Read in dbAllocBits syzbot
2025-11-25 19:28 ` Syakaller testing for KASAN: slab-out-of-bounds Read in dbAllocBits bug Prithvi Tambewagh
@ 2026-03-22 12:51 ` syzbot
2026-03-22 13:12 ` syzbot
2026-03-22 13:32 ` syzbot
3 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2026-03-22 12:51 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH v2] jfs: fix slab-out-of-bounds in dbAllocBits and dbFreeBits
Author: junyeonggim5@gmail.com
When the underlying loop device backend storage is dynamically changed
(e.g., via LOOP_SET_FD), JFS fails to update its internal block
allocation metadata. This causes dbAllocBits and dbFreeBits to use
stale db_agl2size, producing an out-of-range agno value that leads to
an out-of-bounds access on mp->db_agfree[agno].
Add bounds checks for agno in both dbAllocBits and dbFreeBits. If agno
is negative or exceeds MAXAG, report the error via jfs_error() and
return early to prevent the OOB access.
Reported-by: syzbot+0be47376a6acbcba7f0d@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0be47376a6acbcba7f0d
Signed-off-by: Jun Yeong Kim <junyeonggim5@gmail.com>
---
fs/jfs/jfs_dmap.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index cb3cda1390ad..c67ff5df0340 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -2142,6 +2142,12 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
int size;
s8 *leaf;
+ agno = blkno >> bmp->db_agl2size;
+ if (agno < 0 || agno >= MAXAG) {
+ jfs_error(bmp->db_ipbmap->i_sb, "%s: agno %d out of range\n", __func__, agno);
+ return;
+ }
+
/* pick up a pointer to the leaves of the dmap tree */
leaf = dp->tree.stree + LEAFIND;
@@ -2289,6 +2295,12 @@ static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
int rc = 0;
int size;
+ agno = blkno >> bmp->db_agl2size;
+ if (agno < 0 || agno >= MAXAG) {
+ jfs_error(bmp->db_ipbmap->i_sb, "%s: agno %d out of range\n", __func__, agno);
+ return -EIO;
+ }
+
/* determine the bit number and word within the dmap of the
* starting block.
*/
--
2.47.3
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Forwarded: [PATCH v2] jfs: fix slab-out-of-bounds in dbAllocBits and dbFreeBits
2024-05-09 13:18 [syzbot] [jfs?] KASAN: slab-out-of-bounds Read in dbAllocBits syzbot
2025-11-25 19:28 ` Syakaller testing for KASAN: slab-out-of-bounds Read in dbAllocBits bug Prithvi Tambewagh
2026-03-22 12:51 ` Forwarded: [PATCH v2] jfs: fix slab-out-of-bounds in dbAllocBits and dbFreeBits syzbot
@ 2026-03-22 13:12 ` syzbot
2026-03-22 13:32 ` syzbot
3 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2026-03-22 13:12 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH v2] jfs: fix slab-out-of-bounds in dbAllocBits and dbFreeBits
Author: junyeonggim5@gmail.com
When the underlying loop device backend storage is dynamically changed
(e.g., via LOOP_SET_FD), JFS fails to update its internal block
allocation metadata. This causes dbAllocBits and dbFreeBits to use
stale db_agl2size, producing an out-of-range agno value that leads to
an out-of-bounds access on mp->db_agfree[agno].
Add bounds checks for agno in both dbAllocBits and dbFreeBits. If agno
is negative or exceeds MAXAG, report the error via jfs_error() and
return early to prevent the OOB access.
Reported-by: syzbot+0be47376a6acbcba7f0d@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0be47376a6acbcba7f0d
Signed-off-by: Jun Yeong Kim <junyeonggim5@gmail.com>
---
fs/jfs/jfs_dmap.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index cb3cda1390ad..c67ff5df0340 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -2142,6 +2142,12 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
int size;
s8 *leaf;
+ agno = blkno >> bmp->db_agl2size;
+ if (agno < 0 || agno >= MAXAG) {
+ jfs_error(bmp->db_ipbmap->i_sb, "%s: agno %d out of range\n", __func__, agno);
+ return;
+ }
+
/* pick up a pointer to the leaves of the dmap tree */
leaf = dp->tree.stree + LEAFIND;
@@ -2289,6 +2295,12 @@ static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
int rc = 0;
int size;
+ agno = blkno >> bmp->db_agl2size;
+ if (agno < 0 || agno >= MAXAG) {
+ jfs_error(bmp->db_ipbmap->i_sb, "%s: agno %d out of range\n", __func__, agno);
+ return -EIO;
+ }
+
/* determine the bit number and word within the dmap of the
* starting block.
*/
--
2.47.3
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Forwarded: [PATCH v2] jfs: fix slab-out-of-bounds in dbAllocBits and dbFreeBits
2024-05-09 13:18 [syzbot] [jfs?] KASAN: slab-out-of-bounds Read in dbAllocBits syzbot
` (2 preceding siblings ...)
2026-03-22 13:12 ` syzbot
@ 2026-03-22 13:32 ` syzbot
3 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2026-03-22 13:32 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH v2] jfs: fix slab-out-of-bounds in dbAllocBits and dbFreeBits
Author: junyeonggim5@gmail.com
When the underlying loop device backend storage is dynamically changed
(e.g., via LOOP_SET_FD), JFS fails to update its internal block
allocation metadata. This causes dbAllocBits and dbFreeBits to use
stale db_agl2size, producing an out-of-range agno value that leads to
an out-of-bounds access on mp->db_agfree[agno].
Add bounds checks for agno in both dbAllocBits and dbFreeBits. If agno
is negative or exceeds MAXAG, report the error via jfs_error() and
return early to prevent the OOB access.
Reported-by: syzbot+0be47376a6acbcba7f0d@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0be47376a6acbcba7f0d
Signed-off-by: Jun Yeong Kim <junyeonggim5@gmail.com>
---
fs/jfs/jfs_dmap.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index cb3cda1390ad..c67ff5df0340 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -2142,6 +2142,12 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
int size;
s8 *leaf;
+ agno = blkno >> bmp->db_agl2size;
+ if (agno < 0 || agno >= MAXAG) {
+ jfs_error(bmp->db_ipbmap->i_sb, "%s: agno %d out of range\n", __func__, agno);
+ return;
+ }
+
/* pick up a pointer to the leaves of the dmap tree */
leaf = dp->tree.stree + LEAFIND;
@@ -2289,6 +2295,12 @@ static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
int rc = 0;
int size;
+ agno = blkno >> bmp->db_agl2size;
+ if (agno < 0 || agno >= MAXAG) {
+ jfs_error(bmp->db_ipbmap->i_sb, "%s: agno %d out of range\n", __func__, agno);
+ return -EIO;
+ }
+
/* determine the bit number and word within the dmap of the
* starting block.
*/
--
2.47.3
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 7367539ad4b0f8f9b396baf02110962333719a48
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-22 13:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-09 13:18 [syzbot] [jfs?] KASAN: slab-out-of-bounds Read in dbAllocBits syzbot
2025-11-25 19:28 ` Syakaller testing for KASAN: slab-out-of-bounds Read in dbAllocBits bug Prithvi Tambewagh
2025-11-25 19:49 ` [syzbot] [jfs?] KASAN: slab-out-of-bounds Read in dbAllocBits syzbot
2026-03-22 12:51 ` Forwarded: [PATCH v2] jfs: fix slab-out-of-bounds in dbAllocBits and dbFreeBits syzbot
2026-03-22 13:12 ` syzbot
2026-03-22 13:32 ` syzbot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.