Ye Bin
298b5c5217
ext4: fix null-ptr-deref in '__ext4_journal_ensure_credits'
...
We got issue as follows when run syzkaller test:
[ 1901.130043] EXT4-fs error (device vda): ext4_remount:5624: comm syz-executor.5: Abort forced by user
[ 1901.130901] Aborting journal on device vda-8.
[ 1901.131437] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.16: Detected aborted journal
[ 1901.131566] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.11: Detected aborted journal
[ 1901.132586] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.18: Detected aborted journal
[ 1901.132751] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.9: Detected aborted journal
[ 1901.136149] EXT4-fs error (device vda) in ext4_reserve_inode_write:6035: Journal has aborted
[ 1901.136837] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-fuzzer: Detected aborted journal
[ 1901.136915] ==================================================================
[ 1901.138175] BUG: KASAN: null-ptr-deref in __ext4_journal_ensure_credits+0x74/0x140 [ext4]
[ 1901.138343] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.13: Detected aborted journal
[ 1901.138398] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.1: Detected aborted journal
[ 1901.138808] Read of size 8 at addr 0000000000000000 by task syz-executor.17/968
[ 1901.138817]
[ 1901.138852] EXT4-fs error (device vda): ext4_journal_check_start:61: comm syz-executor.30: Detected aborted journal
[ 1901.144779] CPU: 1 PID: 968 Comm: syz-executor.17 Not tainted 4.19.90-vhulk2111.1.0.h893.eulerosv2r10.aarch64+ #1
[ 1901.146479] Hardware name: linux,dummy-virt (DT)
[ 1901.147317] Call trace:
[ 1901.147552] dump_backtrace+0x0/0x2d8
[ 1901.147898] show_stack+0x28/0x38
[ 1901.148215] dump_stack+0xec/0x15c
[ 1901.148746] kasan_report+0x108/0x338
[ 1901.149207] __asan_load8+0x58/0xb0
[ 1901.149753] __ext4_journal_ensure_credits+0x74/0x140 [ext4]
[ 1901.150579] ext4_xattr_delete_inode+0xe4/0x700 [ext4]
[ 1901.151316] ext4_evict_inode+0x524/0xba8 [ext4]
[ 1901.151985] evict+0x1a4/0x378
[ 1901.152353] iput+0x310/0x428
[ 1901.152733] do_unlinkat+0x260/0x428
[ 1901.153056] __arm64_sys_unlinkat+0x6c/0xc0
[ 1901.153455] el0_svc_common+0xc8/0x320
[ 1901.153799] el0_svc_handler+0xf8/0x160
[ 1901.154265] el0_svc+0x10/0x218
[ 1901.154682] ==================================================================
This issue may happens like this:
Process1 Process2
ext4_evict_inode
ext4_journal_start
ext4_truncate
ext4_ind_truncate
ext4_free_branches
ext4_ind_truncate_ensure_credits
ext4_journal_ensure_credits_fn
ext4_journal_restart
handle->h_transaction = NULL;
mount -o remount,abort /mnt
-> trigger JBD abort
start_this_handle -> will return failed
ext4_xattr_delete_inode
ext4_journal_ensure_credits
ext4_journal_ensure_credits_fn
__ext4_journal_ensure_credits
jbd2_handle_buffer_credits
journal = handle->h_transaction->t_journal; ->null-ptr-deref
Now, indirect truncate process didn't handle error. To solve this issue
maybe simply add check handle is abort in '__ext4_journal_ensure_credits'
is enough, and i also think this is necessary.
Cc: stable@kernel.org
Signed-off-by: Ye Bin <yebin10@huawei.com>
Link: https://lore.kernel.org/r/20211224100341.3299128-1-yebin10@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2022-01-10 13:25:55 -05:00
..
2021-11-10 21:16:56 +00:00
2021-06-29 10:53:48 -07:00
2021-10-18 14:43:22 -06:00
2021-11-10 21:17:09 +00:00
2021-10-20 21:09:02 -04:00
2021-08-19 09:02:55 +09:00
2021-06-29 10:53:48 -07:00
2021-11-26 11:24:32 -08:00
2021-11-01 10:17:11 -07:00
2021-11-13 11:31:07 -08:00
2021-12-03 12:38:25 -06:00
2021-11-09 10:02:51 -08:00
2021-08-25 07:58:49 +02:00
2021-10-18 14:43:22 -06:00
2021-10-25 19:11:50 -07:00
2021-09-21 09:09:06 +02:00
2021-09-01 11:29:14 -05:00
2021-06-29 10:53:48 -07:00
2021-04-12 15:04:29 +02:00
2021-11-23 14:58:16 +08:00
2021-11-01 07:49:21 +09:00
2021-09-22 13:05:23 +02:00
2022-01-10 13:25:55 -05:00
2021-11-13 15:32:30 -08:00
2021-11-01 10:25:27 -07:00
2021-10-04 22:13:12 +01:00
2021-11-25 14:05:18 +01:00
2021-12-02 12:41:10 +01:00
2021-11-09 10:11:53 -08:00
2021-11-09 10:11:53 -08:00
2021-08-26 22:28:02 +02:00
2021-10-18 12:28:53 -07:00
2021-11-09 10:02:48 -08:00
2021-11-24 10:15:47 -08:00
2021-10-19 12:51:02 +02:00
2021-12-23 18:13:25 -05:00
2021-08-18 22:08:24 +02:00
2021-11-03 09:23:25 -07:00
2021-10-18 09:43:37 +02:00
2021-11-25 00:09:26 -06:00
2021-11-10 16:45:54 -08:00
2021-06-29 10:53:48 -07:00
2021-11-29 10:10:26 -08:00
2021-11-27 10:33:55 -08:00
2021-10-04 22:02:17 +01:00
2021-11-17 08:38:00 -08:00
2021-11-09 10:11:53 -08:00
2021-10-27 12:53:45 +02:00
2021-11-27 14:34:41 -08:00
2021-11-02 12:25:03 -07:00
2021-11-10 16:15:54 -08:00
2021-06-29 10:53:48 -07:00
2021-11-09 10:34:06 -08:00
2021-11-09 10:51:12 -08:00
2021-11-20 10:35:55 -08:00
2021-11-21 09:44:19 -08:00
2021-09-21 08:36:48 -07:00
2021-11-06 16:40:48 -07:00
2021-11-09 10:11:53 -08:00
2021-11-06 16:40:48 -07:00
2021-11-05 09:55:36 -05:00
2021-11-08 16:55:21 -08:00
2021-10-05 16:35:05 +02:00
2021-11-09 10:02:52 -08:00
2021-10-08 18:08:43 -04:00
2021-09-20 19:32:33 -07:00
2021-11-09 12:53:58 +01:00
2021-08-19 09:02:55 +09:00
2021-05-02 00:43:35 +09:00
2021-09-27 11:26:21 -07:00
2021-09-22 10:56:34 -07:00
2021-12-01 17:27:48 -08:00
2021-11-02 12:25:03 -07:00
2021-11-01 17:29:10 -07:00
2021-09-19 22:35:37 -04:00
2021-11-17 09:26:09 +01:00
2021-08-18 22:08:24 +02:00
2021-09-05 10:15:05 -07:00
2021-10-08 12:06:02 -05:00
2021-11-09 10:11:53 -08:00
2021-06-29 10:53:50 -07:00
2021-10-18 14:43:22 -06:00
2021-10-08 12:06:02 -05:00
2021-11-06 13:30:32 -07:00
2021-08-31 11:13:35 -07:00
2021-04-15 22:36:45 -04:00
2021-10-25 10:36:24 -06:00
2021-09-03 09:58:10 -07:00
2021-09-06 07:20:56 -04:00
2021-09-09 13:25:49 -07:00
2021-11-10 16:15:54 -08:00
2021-09-03 10:08:28 -07:00
2021-12-03 10:06:58 -08:00
2021-08-23 01:25:40 -04:00
2021-09-03 09:58:12 -07:00
2021-12-09 14:09:36 -05:00
2021-11-01 17:29:10 -07:00
2021-11-17 10:36:35 -05:00
2021-11-09 10:11:53 -08:00
2021-11-27 06:41:38 -07:00
2021-12-03 06:27:32 -07:00
2021-10-19 05:49:54 -06:00
2021-08-31 11:06:32 -07:00
2021-09-12 10:10:21 -07:00
2021-07-25 22:33:03 -07:00
2021-10-18 20:22:03 -10:00
2021-11-03 15:43:08 +01:00
2021-10-19 14:11:39 -04:00
2021-09-12 10:10:21 -07:00
2021-11-01 09:06:53 -07:00
2021-09-03 10:08:28 -07:00
2021-11-06 14:08:17 -07:00
2021-09-07 11:03:45 -07:00
2021-11-06 13:30:32 -07:00
2021-10-26 12:20:50 -04:00
2021-04-17 11:39:49 -07:00
2021-08-23 06:15:36 -04:00
2021-09-07 11:26:23 -07:00
2021-11-09 10:02:52 -08:00
2021-07-23 13:16:43 -05:00
2021-08-17 11:47:43 +02:00
2021-11-06 13:30:34 -07:00
2021-10-22 08:36:55 -06:00
2021-08-10 17:57:22 +02:00
2021-10-18 20:22:02 -10:00