Vasiliy Kovalev
37bfb464dd
jfs: validate AG parameters in dbMount() to prevent crashes
Validate db_agheight, db_agwidth, and db_agstart in dbMount to catch
corrupted metadata early and avoid undefined behavior in dbAllocAG.
Limits are derived from L2LPERCTL, LPERCTL/MAXAG, and CTLTREESIZE:
- agheight: 0 to L2LPERCTL/2 (0 to 5) ensures shift
(L2LPERCTL - 2*agheight) >= 0.
- agwidth: 1 to min(LPERCTL/MAXAG, 2^(L2LPERCTL - 2*agheight))
ensures agperlev >= 1.
- Ranges: 1-8 (agheight 0-3), 1-4 (agheight 4), 1 (agheight 5).
- LPERCTL/MAXAG = 1024/128 = 8 limits leaves per AG;
2^(10 - 2*agheight) prevents division to 0.
- agstart: 0 to CTLTREESIZE-1 - agwidth*(MAXAG-1) keeps ti within
stree (size 1365).
- Ranges: 0-1237 (agwidth 1), 0-348 (agwidth 8).
UBSAN: shift-out-of-bounds in fs/jfs/jfs_dmap.c:1400:9
shift exponent -335544310 is negative
CPU: 0 UID: 0 PID: 5822 Comm: syz-executor130 Not tainted 6.14.0-rc5-syzkaller #0
Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
ubsan_epilogue lib/ubsan.c:231 [inline]
__ubsan_handle_shift_out_of_bounds+0x3c8/0x420 lib/ubsan.c:468
dbAllocAG+0x1087/0x10b0 fs/jfs/jfs_dmap.c:1400
dbDiscardAG+0x352/0xa20 fs/jfs/jfs_dmap.c:1613
jfs_ioc_trim+0x45a/0x6b0 fs/jfs/jfs_discard.c:105
jfs_ioctl+0x2cd/0x3e0 fs/jfs/ioctl.c:131
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl+0xf5/0x170 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
Cc: stable@vger.kernel.org
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reported-by: syzbot+fe8264911355151c487f@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=fe8264911355151c487f
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
2025-04-03 09:11:42 -05:00
..
2025-02-27 20:00:17 +01:00
2024-10-08 14:41:53 +02:00
2025-03-24 10:47:14 -07:00
2025-03-24 13:15:16 -07:00
2025-03-24 10:47:14 -07:00
2025-04-01 09:29:18 -07:00
2025-04-01 10:06:52 -07:00
2025-03-25 14:59:14 +01:00
2025-03-24 12:17:13 -07:00
2025-02-27 20:00:17 +01:00
2025-02-27 20:00:17 +01:00
2025-03-26 18:08:55 -07:00
2025-01-30 08:22:31 +01:00
2025-02-06 11:51:43 +01:00
2025-03-18 10:49:22 -05:00
2025-03-24 10:47:14 -07:00
2025-03-29 11:36:19 -07:00
2024-10-15 15:58:36 +02:00
2025-03-17 14:02:16 +08:00
2025-03-29 22:03:11 +09:00
2025-03-25 15:57:58 +01:00
2025-03-31 17:53:44 -07:00
2025-04-01 09:29:18 -07:00
2025-03-27 12:55:54 -07:00
2025-02-27 20:00:17 +01:00
2024-11-06 10:42:06 +01:00
2025-04-02 16:36:59 -07:00
2025-03-27 12:09:25 -07:00
2025-02-27 20:00:17 +01:00
2025-02-27 20:00:17 +01:00
2025-04-02 12:25:03 -07:00
2025-02-27 20:00:17 +01:00
2025-04-01 09:29:18 -07:00
2025-04-01 09:29:18 -07:00
2025-02-12 14:25:19 +01:00
2025-03-21 00:59:28 -04:00
2025-02-27 20:00:17 +01:00
2025-04-03 09:11:42 -05:00
2025-04-01 11:02:03 -07:00
2025-03-10 09:11:13 -04:00
2025-02-27 20:00:17 +01:00
2025-03-19 10:04:23 +01:00
2025-04-02 17:06:31 -07:00
2025-03-10 09:11:04 -04:00
2025-03-31 17:28:17 -07:00
2025-02-27 20:00:17 +01:00
2024-10-02 17:23:23 -04:00
2025-03-24 09:34:10 -07:00
2025-04-02 16:30:02 -07:00
2025-04-01 10:06:52 -07:00
2025-02-27 20:00:17 +01:00
2025-03-27 13:14:39 -07:00
2025-03-24 10:47:14 -07:00
2025-04-01 10:06:52 -07:00
2025-03-24 15:43:28 -07:00
2024-12-03 10:40:36 +01:00
2025-01-28 13:48:37 +01:00
2025-02-27 20:00:17 +01:00
2025-03-31 17:42:26 -07:00
2025-03-16 17:40:24 -07:00
2025-02-15 17:46:32 +01:00
2025-02-27 20:00:17 +01:00
2025-03-29 10:01:55 -07:00
2025-04-01 09:29:18 -07:00
2025-02-27 20:00:17 +01:00
2025-02-12 14:00:11 -08:00
2025-03-24 10:47:14 -07:00
2025-02-17 11:34:15 -08:00
2025-04-01 10:06:52 -07:00
2025-02-06 13:02:15 +01:00
2025-01-28 13:48:37 +01:00
2025-01-27 19:25:45 -05:00
2024-10-10 10:20:51 +02:00
2024-12-02 11:25:09 +01:00
2025-02-27 20:00:17 +01:00
2025-03-07 20:07:33 -08:00
2025-02-10 16:47:07 -08:00
2025-01-10 08:49:05 -08:00
2025-01-20 13:27:58 -08:00
2025-02-13 19:35:32 -08:00
2025-04-01 09:29:18 -07:00
2024-10-22 11:16:57 +02:00
2024-10-17 18:38:49 +01:00
2025-03-26 21:02:05 -07:00
2025-04-01 09:29:18 -07:00
2025-03-26 21:02:05 -07:00
2025-02-07 16:53:04 +01:00
2025-02-21 10:25:31 +01:00
2025-03-26 21:48:21 -07:00
2025-03-25 14:59:05 +01:00
2024-12-09 11:34:29 +01:00
2024-12-17 09:16:11 +01:00
2025-03-24 13:19:17 -07:00
2025-03-24 13:19:17 -07:00
2024-12-22 11:29:52 +01:00
2024-12-21 01:36:17 -05:00
2025-02-07 16:53:04 +01:00
2025-02-12 10:02:10 +01:00
2025-03-05 11:52:50 +01:00
2025-03-20 13:06:51 +01:00
2025-03-24 13:19:17 -07:00
2025-02-21 10:25:32 +01:00
2025-04-01 09:29:18 -07:00
2024-11-03 01:28:06 -05:00
2025-03-24 10:16:37 -07:00
2025-01-28 13:48:37 +01:00
2025-02-21 10:32:47 +01:00
2025-02-12 12:12:27 +01:00
2025-03-24 11:41:41 -07:00
2025-02-24 11:44:44 +01:00
2025-03-24 13:19:17 -07:00
2025-03-28 10:18:34 +01:00
2025-03-24 11:38:12 -07:00
2025-03-24 13:19:17 -07:00
2025-03-24 10:16:37 -07:00
2025-03-10 08:55:13 +01:00
2025-03-24 11:41:41 -07:00
2025-03-04 09:29:54 +01:00
2024-10-22 11:16:59 +02:00
2025-02-21 10:25:32 +01:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:07 -05:00
2025-01-13 16:24:16 +01:00
2024-10-22 11:16:57 +02:00
2025-02-21 10:25:31 +01:00
2025-03-10 08:55:05 +01:00
2025-02-07 10:27:24 +01:00
2024-11-03 01:28:06 -05:00
2025-03-24 09:13:50 -07:00
2024-11-03 01:28:06 -05:00
2025-01-28 13:48:37 +01:00
2025-03-25 10:54:15 -07:00
2025-01-28 13:48:37 +01:00
2024-11-03 01:28:06 -05:00
2024-11-06 13:00:01 -05:00