Chao Yu
be0155202e
f2fs: fix to do sanity check on i_xattr_nid in sanity_check_inode()
...
commit 20faaf30e55522bba2b56d9c46689233205d7717 upstream.
syzbot reports a kernel bug as below:
F2FS-fs (loop0): Mounted with checkpoint version = 48b305e4
==================================================================
BUG: KASAN: slab-out-of-bounds in f2fs_test_bit fs/f2fs/f2fs.h:2933 [inline]
BUG: KASAN: slab-out-of-bounds in current_nat_addr fs/f2fs/node.h:213 [inline]
BUG: KASAN: slab-out-of-bounds in f2fs_get_node_info+0xece/0x1200 fs/f2fs/node.c:600
Read of size 1 at addr ffff88807a58c76c by task syz-executor280/5076
CPU: 1 PID: 5076 Comm: syz-executor280 Not tainted 6.9.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
print_address_description mm/kasan/report.c:377 [inline]
print_report+0x169/0x550 mm/kasan/report.c:488
kasan_report+0x143/0x180 mm/kasan/report.c:601
f2fs_test_bit fs/f2fs/f2fs.h:2933 [inline]
current_nat_addr fs/f2fs/node.h:213 [inline]
f2fs_get_node_info+0xece/0x1200 fs/f2fs/node.c:600
f2fs_xattr_fiemap fs/f2fs/data.c:1848 [inline]
f2fs_fiemap+0x55d/0x1ee0 fs/f2fs/data.c:1925
ioctl_fiemap fs/ioctl.c:220 [inline]
do_vfs_ioctl+0x1c07/0x2e50 fs/ioctl.c:838
__do_sys_ioctl fs/ioctl.c:902 [inline]
__se_sys_ioctl+0x81/0x170 fs/ioctl.c:890
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The root cause is we missed to do sanity check on i_xattr_nid during
f2fs_iget(), so that in fiemap() path, current_nat_addr() will access
nat_bitmap w/ offset from invalid i_xattr_nid, result in triggering
kasan bug report, fix it.
Reported-and-tested-by: syzbot+3694e283cf5c40df6d14@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-f2fs-devel/00000000000094036c0616e72a1d@google.com
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:47:32 +02:00
..
2024-05-17 12:02:19 +02:00
2023-08-29 20:21:42 -07:00
2023-08-29 20:21:42 -07:00
2024-06-16 13:47:30 +02:00
2023-08-28 11:39:14 -07:00
2023-08-29 20:21:42 -07:00
2023-08-29 20:21:42 -07:00
2024-05-17 12:02:39 +02:00
2024-03-01 13:35:00 +01:00
2024-04-27 17:11:29 +02:00
2023-08-28 09:31:32 -07:00
2023-07-13 10:28:05 +02:00
2023-08-28 11:04:18 -07:00
2024-01-20 11:51:37 +01:00
2023-08-28 10:17:14 -07:00
2024-06-12 11:11:38 +02:00
2024-06-12 11:11:31 +02:00
2024-03-06 14:48:41 +00:00
2023-08-29 20:21:42 -07:00
2024-06-16 13:47:31 +02:00
2023-11-28 17:19:44 +00:00
2023-08-29 17:45:22 -04:00
2024-03-26 18:19:46 -04:00
2024-06-12 11:12:10 +02:00
2024-06-16 13:47:32 +02:00
2024-04-03 15:28:20 +02:00
2023-08-29 20:21:42 -07:00
2024-01-31 16:19:01 -08:00
2024-04-27 17:11:42 +02:00
2024-06-12 11:12:52 +02:00
2023-08-29 20:21:42 -07:00
2023-08-29 20:21:42 -07:00
2023-07-24 10:30:00 +02:00
2023-08-29 20:21:42 -07:00
2024-02-23 09:25:16 +01:00
2024-03-26 18:19:16 -04:00
2024-04-13 13:07:34 +02:00
2024-01-20 11:51:43 +01:00
2024-06-12 11:11:33 +02:00
2024-03-26 18:19:46 -04:00
2024-04-13 13:07:38 +02:00
2023-08-29 17:45:22 -04:00
2023-08-29 20:21:42 -07:00
2023-09-18 12:03:46 -07:00
2024-06-12 11:12:49 +02:00
2024-04-10 16:36:01 +02:00
2024-06-12 11:11:31 +02:00
2023-08-31 12:07:34 -05:00
2023-10-19 16:19:20 +02:00
2023-08-29 20:21:42 -07:00
2024-06-12 11:12:39 +02:00
2024-03-26 18:19:46 -04:00
2023-08-29 20:21:42 -07:00
2024-06-12 11:11:30 +02:00
2024-04-13 13:07:35 +02:00
2024-06-12 11:12:24 +02:00
2024-05-02 16:32:43 +02:00
2024-04-13 13:07:31 +02:00
2023-08-29 20:21:42 -07:00
2023-08-29 20:21:42 -07:00
2024-03-26 18:19:46 -04:00
2023-07-24 10:30:04 +02:00
2024-03-26 18:19:46 -04:00
2023-08-29 20:21:42 -07:00
2024-06-12 11:11:30 +02:00
2024-05-02 16:32:41 +02:00
2024-04-27 17:11:41 +02:00
2024-04-13 13:07:34 +02:00
2024-06-12 11:12:35 +02:00
2024-04-03 15:28:20 +02:00
2024-06-12 11:12:23 +02:00
2023-08-29 20:21:42 -07:00
2024-05-17 12:02:13 +02:00
2023-08-20 10:33:43 -07:00
2024-04-03 15:28:49 +02:00
2024-02-23 09:25:13 +01:00
2024-04-03 15:28:44 +02:00
2023-08-28 10:17:14 -07:00
2023-08-11 09:04:57 +02:00
2023-09-29 17:20:45 -07:00
2023-06-28 20:35:21 -07:00
2023-07-13 10:28:04 +02:00
2023-09-25 08:55:00 -07:00
2023-06-26 09:50:21 -07:00
2024-01-10 17:16:53 +01:00
2024-02-05 20:14:26 +00:00
2023-06-28 10:28:11 -07:00
2023-08-18 10:12:11 -07:00
2023-07-11 11:41:34 +02:00
2024-06-12 11:11:30 +02:00
2024-04-03 15:28:55 +02:00
2024-03-26 18:19:17 -04:00
2024-03-26 18:19:15 -04:00
2023-08-08 19:36:51 +02:00
2023-08-28 10:17:14 -07:00
2023-10-12 18:53:36 +03:00
2023-08-21 13:46:25 -07:00
2023-11-20 11:58:52 +01:00
2023-08-14 18:48:02 +02:00
2023-12-03 07:33:03 +01:00
2023-08-29 20:21:42 -07:00
2024-01-31 16:18:54 -08:00
2023-08-29 20:21:42 -07:00
2023-08-23 14:17:43 -07:00
2023-08-19 12:12:12 +02:00
2024-01-05 15:19:40 +01:00
2023-08-31 15:32:18 -07:00
2023-08-02 09:13:09 -06:00
2024-01-31 16:18:57 -08:00
2024-02-23 09:25:15 +01:00
2023-07-13 10:28:04 +02:00
2023-12-20 17:01:51 +01:00
2024-04-10 16:35:57 +02:00
2023-07-13 10:28:04 +02:00
2023-08-15 08:32:45 +02:00
2023-08-06 15:08:35 +02:00
2024-03-26 18:19:17 -04:00
2023-08-29 14:25:26 -07:00
2023-07-13 10:28:04 +02:00
2023-12-03 07:33:03 +01:00
2023-08-31 12:47:15 +02:00
2024-05-17 12:02:36 +02:00
2023-08-22 10:57:46 +02:00