Chao Yu
c559a8d840
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:28:49 +02:00
..
2024-05-17 11:43:53 +02:00
2023-02-06 07:52:36 +01:00
2024-06-16 13:28:48 +02:00
2023-09-23 11:00:02 +02:00
2021-01-06 14:48:39 +01:00
2024-05-25 16:17:18 +02:00
2024-03-06 14:36:10 +00:00
2024-02-23 08:25:03 +01:00
2024-05-25 16:17:17 +02:00
2023-03-11 16:43:56 +01:00
2023-01-18 11:41:09 +01:00
2021-09-12 08:56:38 +02:00
2023-09-23 10:59:40 +02:00
2022-02-01 17:24:34 +01:00
2023-09-23 10:59:55 +02:00
2024-06-16 13:28:32 +02:00
2020-12-02 08:49:53 +01:00
2023-09-23 10:59:36 +02:00
2023-09-23 11:00:04 +02:00
2024-06-16 13:28:40 +02:00
2024-06-16 13:28:49 +02:00
2024-04-13 12:51:23 +02:00
2021-09-22 12:26:25 +02:00
2024-04-13 12:51:25 +02:00
2024-05-17 11:43:50 +02:00
2023-03-11 16:43:59 +01:00
2023-06-09 10:29:01 +02:00
2021-04-14 08:24:14 +02:00
2024-03-06 14:36:10 +00:00
2024-03-01 13:13:35 +01:00
2024-04-13 12:51:38 +02:00
2024-01-25 14:34:20 -08:00
2024-06-16 13:28:33 +02:00
2024-02-23 08:24:55 +01:00
2024-02-23 08:25:03 +01:00
2023-09-23 10:59:48 +02:00
2022-04-15 14:18:35 +02:00
2024-05-17 11:43:48 +02:00
2020-12-30 11:51:22 +01:00
2023-11-28 16:50:21 +00:00
2024-06-16 13:28:49 +02:00
2023-09-23 10:59:38 +02:00
2023-07-27 08:37:26 +02:00
2022-11-25 17:42:22 +01:00
2024-02-23 08:24:49 +01:00
2023-06-09 10:29:01 +02:00
2024-06-16 13:28:32 +02:00
2023-01-18 11:41:39 +01:00
2023-12-08 08:44:27 +01:00
2023-09-23 10:59:55 +02:00
2024-02-23 08:24:55 +01:00
2021-09-30 10:09:26 +02:00
2024-03-26 18:22:20 -04:00
2020-10-29 09:57:53 +01:00
2023-09-23 10:59:40 +02:00
2020-08-26 10:40:51 +02:00
2023-02-22 12:50:39 +01:00
2024-05-02 16:18:32 +02:00
2024-04-13 12:51:38 +02:00
2023-09-23 11:00:06 +02:00
2024-04-13 12:51:23 +02:00
2023-09-23 10:59:56 +02:00
2020-08-21 13:05:37 +02:00
2023-09-23 10:59:55 +02:00
2023-06-28 10:18:42 +02:00
2024-04-13 12:51:29 +02:00
2023-09-23 11:00:06 +02:00
2023-01-18 11:41:46 +01:00
2023-10-10 21:46:42 +02:00
2021-10-06 15:42:35 +02:00
2023-01-18 11:41:46 +01:00
2023-01-18 11:41:33 +01:00
2024-01-08 11:29:48 +01:00
2022-11-25 17:42:22 +01:00
2023-01-18 11:41:25 +01:00
2024-02-23 08:25:15 +01:00
2020-12-11 13:23:30 +01:00
2020-10-29 09:57:45 +01:00
2022-06-14 18:11:41 +02:00
2024-02-23 08:25:00 +01:00
2021-04-14 08:24:11 +02:00
2023-09-23 10:59:40 +02:00
2023-06-28 10:18:35 +02:00
2024-04-13 12:51:31 +02:00
2021-09-15 09:47:28 +02:00
2024-03-26 18:22:13 -04:00
2022-05-25 09:14:34 +02:00
2023-03-17 08:32:47 +01:00
2020-04-17 10:50:21 +02:00
2023-07-27 08:37:25 +02:00
2023-05-17 11:35:58 +02:00
2024-02-23 08:24:49 +01:00
2023-07-27 08:37:26 +02:00
2024-06-16 13:28:48 +02:00
2023-01-18 11:40:55 +01:00
2023-09-23 11:00:02 +02:00
2023-01-18 11:41:59 +01:00
2024-02-23 08:24:49 +01:00
2021-08-26 08:36:22 -04:00
2024-04-13 12:51:35 +02:00
2021-08-12 13:21:02 +02:00
2023-01-18 11:41:44 +01:00
2021-03-17 17:03:33 +01:00
2021-04-21 12:56:16 +02:00
2024-03-26 18:22:13 -04:00
2021-07-20 16:10:54 +02:00
2022-09-05 10:27:47 +02:00
2022-10-17 17:24:32 +02:00
2022-04-27 13:50:48 +02:00
2023-05-30 12:44:07 +01:00
2023-08-11 11:53:59 +02:00
2023-12-08 08:44:27 +01:00
2022-10-26 13:22:21 +02:00
2023-01-18 11:40:53 +01:00