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