Randall Huang
980628e34f
f2fs: fix to avoid accessing xattr across the boundary
[ Upstream commit 2777e65437 ]
When we traverse xattr entries via __find_xattr(),
if the raw filesystem content is faked or any hardware failure occurs,
out-of-bound error can be detected by KASAN.
Fix the issue by introducing boundary check.
[ 38.402878] c7 1827 BUG: KASAN: slab-out-of-bounds in f2fs_getxattr+0x518/0x68c
[ 38.402891] c7 1827 Read of size 4 at addr ffffffc0b6fb35dc by task
[ 38.402935] c7 1827 Call trace:
[ 38.402952] c7 1827 [<ffffff900809003c>] dump_backtrace+0x0/0x6bc
[ 38.402966] c7 1827 [<ffffff9008090030>] show_stack+0x20/0x2c
[ 38.402981] c7 1827 [<ffffff900871ab10>] dump_stack+0xfc/0x140
[ 38.402995] c7 1827 [<ffffff9008325c40>] print_address_description+0x80/0x2d8
[ 38.403009] c7 1827 [<ffffff900832629c>] kasan_report_error+0x198/0x1fc
[ 38.403022] c7 1827 [<ffffff9008326104>] kasan_report_error+0x0/0x1fc
[ 38.403037] c7 1827 [<ffffff9008325000>] __asan_load4+0x1b0/0x1b8
[ 38.403051] c7 1827 [<ffffff90085fcc44>] f2fs_getxattr+0x518/0x68c
[ 38.403066] c7 1827 [<ffffff90085fc508>] f2fs_xattr_generic_get+0xb0/0xd0
[ 38.403080] c7 1827 [<ffffff9008395708>] __vfs_getxattr+0x1f4/0x1fc
[ 38.403096] c7 1827 [<ffffff9008621bd0>] inode_doinit_with_dentry+0x360/0x938
[ 38.403109] c7 1827 [<ffffff900862d6cc>] selinux_d_instantiate+0x2c/0x38
[ 38.403123] c7 1827 [<ffffff900861b018>] security_d_instantiate+0x68/0x98
[ 38.403136] c7 1827 [<ffffff9008377db8>] d_splice_alias+0x58/0x348
[ 38.403149] c7 1827 [<ffffff900858d16c>] f2fs_lookup+0x608/0x774
[ 38.403163] c7 1827 [<ffffff900835eacc>] lookup_slow+0x1e0/0x2cc
[ 38.403177] c7 1827 [<ffffff9008367fe0>] walk_component+0x160/0x520
[ 38.403190] c7 1827 [<ffffff9008369ef4>] path_lookupat+0x110/0x2b4
[ 38.403203] c7 1827 [<ffffff900835dd38>] filename_lookup+0x1d8/0x3a8
[ 38.403216] c7 1827 [<ffffff900835eeb0>] user_path_at_empty+0x54/0x68
[ 38.403229] c7 1827 [<ffffff9008395f44>] SyS_getxattr+0xb4/0x18c
[ 38.403241] c7 1827 [<ffffff9008084200>] el0_svc_naked+0x34/0x38
Signed-off-by: Randall Huang <huangrandall@google.com>
[Jaegeuk Kim: Fix wrong ending boundary]
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-06-19 08:00:06 +02:00
..
2019-03-17 09:10:56 -07:00
2018-08-22 10:52:51 -07:00
2019-05-31 06:43:13 -07:00
2019-03-07 18:32:01 -08:00
2019-01-04 13:13:47 -08:00
2019-06-09 09:16:10 +02:00
2018-11-30 16:00:58 +00:00
2019-05-25 18:16:36 +02:00
2019-06-09 09:16:16 +02:00
2019-06-15 11:52:57 +02:00
2018-10-30 12:46:25 -07:00
2019-05-31 06:43:32 -07:00
2019-04-01 00:31:02 -04:00
2019-01-24 13:38:30 -05:00
2019-02-03 11:17:31 -08:00
2019-01-25 18:41:52 +08:00
2018-07-22 14:13:44 +02:00
2018-11-23 09:08:17 -05:00
2019-03-07 09:01:33 -08:00
2019-05-31 06:43:08 -07:00
2019-06-19 08:00:06 +02:00
2019-06-15 11:52:50 +02:00
2018-11-30 15:57:31 +00:00
2019-06-15 11:53:00 +02:00
2019-05-31 06:43:14 -07:00
2018-11-30 14:56:14 -08:00
2019-01-04 13:13:47 -08:00
2018-08-17 16:20:28 -07:00
2019-03-12 09:58:03 -07:00
2019-05-22 07:39:50 +02:00
2018-09-29 22:47:48 -04:00
2019-05-22 07:39:56 +02:00
2019-04-01 00:31:02 -04:00
2018-09-20 09:28:49 -05:00
2019-05-16 19:35:34 +02:00
2019-06-09 09:16:16 +02:00
2019-06-11 12:19:16 +02:00
2019-06-15 11:53:00 +02:00
2019-02-06 13:12:15 -05:00
2019-05-25 18:16:35 +02:00
2018-12-28 12:11:47 -08:00
2019-06-19 08:00:02 +02:00
2018-11-18 13:35:19 -08:00
2019-03-12 13:27:20 -07:00
2019-06-15 11:53:06 +02:00
2019-05-25 18:16:22 +02:00
2019-06-11 12:19:16 +02:00
2018-12-18 18:29:15 +01:00
2018-10-31 08:54:14 -07:00
2018-08-02 09:34:02 -07:00
2019-03-16 10:31:02 -07:00
2018-11-10 08:02:40 -05:00
2018-07-31 11:32:44 -04:00
2019-04-01 00:31:02 -04:00
2019-03-18 16:30:02 +01:00
2019-05-02 02:24:50 -04:00
2019-03-26 08:37:55 -07:00
2019-04-04 20:13:59 -04:00
2019-03-05 10:00:35 -08:00
2019-03-07 18:32:01 -08:00
2019-02-18 16:49:36 -08:00
2019-05-01 08:38:47 -06:00
2019-02-28 13:59:41 -07:00
2019-05-31 06:43:42 -07:00
2018-08-27 14:48:48 +02:00
2018-10-29 14:29:58 -07:00
2018-10-03 16:47:43 +02:00
2019-06-15 11:52:52 +02:00
2019-05-25 18:16:24 +02:00
2019-02-15 08:40:11 -07:00
2019-02-01 15:46:24 -08:00
2019-03-07 18:32:01 -08:00
2019-03-07 18:32:01 -08:00
2018-10-03 16:47:43 +02:00
2019-02-28 08:24:23 -07:00
2019-03-08 14:48:40 -08:00
2019-02-28 03:29:26 -05:00
2019-02-28 03:29:37 -05:00
2019-03-29 10:01:38 -07:00
2019-01-21 17:48:13 +01:00
2019-05-22 07:39:55 +02:00
2019-04-28 21:46:57 -04:00
2019-05-31 06:43:13 -07:00
2019-06-19 08:00:02 +02:00
2019-01-03 18:57:57 -08:00
2019-03-18 10:44:48 -06:00
2019-03-12 14:08:19 -07:00
2018-08-02 08:06:55 +09:00
2019-03-25 08:36:24 -04:00
2019-03-12 14:08:19 -07:00
2019-01-30 17:44:07 -05:00
2019-02-15 08:40:11 -07:00
2019-03-12 14:08:19 -07:00
2019-03-12 14:08:19 -07:00
2019-05-25 18:16:24 +02:00
2019-04-06 07:01:55 -10:00
2019-04-14 15:09:40 -07:00
2019-01-30 17:14:50 -05:00
2019-01-30 17:14:50 -05:00
2019-04-06 07:01:55 -10:00
2019-01-03 18:57:57 -08:00
2019-02-07 00:13:27 +01:00
2018-08-17 16:20:28 -07:00
2018-10-03 16:47:43 +02:00
2019-04-26 11:09:55 -07:00
2019-02-01 01:55:45 -05:00
2019-02-07 16:38:35 +01:00
2019-04-28 21:34:21 -04:00
2019-02-07 00:13:27 +01:00
2019-04-19 09:46:05 -07:00
2019-02-07 00:13:27 +01:00
2018-09-18 07:30:48 -04:00