Nikita Zhandarovich
cde76b3af2
do_sys_name_to_handle(): use kzalloc() to fix kernel-infoleak
...
[ Upstream commit 3948abaa4e2be938ccdfc289385a27342fb13d43 ]
syzbot identified a kernel information leak vulnerability in
do_sys_name_to_handle() and issued the following report [1].
[1]
"BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
BUG: KMSAN: kernel-infoleak in _copy_to_user+0xbc/0x100 lib/usercopy.c:40
instrument_copy_to_user include/linux/instrumented.h:114 [inline]
_copy_to_user+0xbc/0x100 lib/usercopy.c:40
copy_to_user include/linux/uaccess.h:191 [inline]
do_sys_name_to_handle fs/fhandle.c:73 [inline]
__do_sys_name_to_handle_at fs/fhandle.c:112 [inline]
__se_sys_name_to_handle_at+0x949/0xb10 fs/fhandle.c:94
__x64_sys_name_to_handle_at+0xe4/0x140 fs/fhandle.c:94
...
Uninit was created at:
slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768
slab_alloc_node mm/slub.c:3478 [inline]
__kmem_cache_alloc_node+0x5c9/0x970 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1006 [inline]
__kmalloc+0x121/0x3c0 mm/slab_common.c:1020
kmalloc include/linux/slab.h:604 [inline]
do_sys_name_to_handle fs/fhandle.c:39 [inline]
__do_sys_name_to_handle_at fs/fhandle.c:112 [inline]
__se_sys_name_to_handle_at+0x441/0xb10 fs/fhandle.c:94
__x64_sys_name_to_handle_at+0xe4/0x140 fs/fhandle.c:94
...
Bytes 18-19 of 20 are uninitialized
Memory access of size 20 starts at ffff888128a46380
Data copied to user address 0000000020000240"
Per Chuck Lever's suggestion, use kzalloc() instead of kmalloc() to
solve the problem.
Fixes: 990d6c2d7aee ("vfs: Add name to file handle conversion support")
Suggested-by: Chuck Lever III <chuck.lever@oracle.com>
Reported-and-tested-by: <syzbot+09b349b3066c2e0b1e96@syzkaller.appspotmail.com>
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Link: https://lore.kernel.org/r/20240119153906.4367-1-n.zhandarovich@fintech.ru
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:21:47 -04:00
..
2022-06-22 14:13:12 +02:00
2023-02-01 08:23:11 +01:00
2024-03-06 14:37:49 +00:00
2023-09-23 11:01:04 +02:00
2021-01-06 14:56:52 +01:00
2024-03-06 14:37:49 +00:00
2024-03-06 14:37:50 +00:00
2024-02-23 08:42:29 +01:00
2024-03-01 13:16:46 +01:00
2023-03-11 16:39:51 +01:00
2023-09-21 09:45:15 +02:00
2022-11-10 18:14:25 +01:00
2024-01-25 14:37:36 -08:00
2022-02-01 17:25:39 +01:00
2023-09-19 12:20:22 +02:00
2024-02-23 08:42:05 +01:00
2024-01-25 14:37:40 -08:00
2024-03-01 13:16:48 +01:00
2023-11-28 16:54:52 +00:00
2023-09-23 11:01:07 +02:00
2024-03-15 10:48:21 -04:00
2024-02-23 08:42:11 +01:00
2022-06-09 10:20:58 +02:00
2021-09-18 13:40:15 +02:00
2023-12-20 15:44:30 +01:00
2024-01-25 14:37:42 -08:00
2023-03-11 16:39:55 +01:00
2023-05-30 12:57:47 +01:00
2021-04-14 08:42:06 +02:00
2024-03-15 10:48:22 -04:00
2022-07-07 17:52:19 +02:00
2021-11-12 14:58:33 +01:00
2024-03-01 13:16:47 +01:00
2023-07-27 08:44:13 +02:00
2024-02-23 08:42:04 +01:00
2024-02-23 08:42:14 +01:00
2023-09-19 12:20:15 +02:00
2022-04-13 21:01:01 +02:00
2024-01-25 14:37:43 -08:00
2020-12-30 11:53:45 +01:00
2023-12-08 08:46:10 +01:00
2024-02-23 08:42:32 +01:00
2023-09-19 12:20:04 +02:00
2023-07-27 08:44:15 +02:00
2022-11-25 17:45:57 +01:00
2023-09-19 12:20:09 +02:00
2023-01-14 10:16:20 +01:00
2023-11-28 16:54:57 +00:00
2023-11-28 16:54:56 +00:00
2024-02-23 08:42:04 +01:00
2021-09-30 10:11:08 +02:00
2023-11-28 16:54:58 +00:00
2023-07-27 08:44:13 +02:00
2023-09-19 12:20:06 +02:00
2023-02-22 12:55:56 +01:00
2023-08-11 11:57:53 +02:00
2023-09-23 11:01:10 +02:00
2024-02-23 08:41:54 +01:00
2023-09-19 12:20:23 +02:00
2021-10-17 10:43:33 +02:00
2023-09-19 12:20:22 +02:00
2023-06-14 11:09:59 +02:00
2024-03-01 13:16:43 +01:00
2024-03-01 13:16:51 +01:00
2023-09-23 11:01:09 +02:00
2023-10-10 21:53:35 +02:00
2022-11-03 23:57:49 +09:00
2022-06-09 10:20:47 +02:00
2023-01-14 10:16:13 +01:00
2024-01-15 18:48:03 +01:00
2022-11-25 17:45:56 +01:00
2023-01-14 10:15:59 +01:00
2023-01-04 11:39:22 +01:00
2022-06-09 10:21:16 +02:00
2024-02-23 08:42:10 +01:00
2021-04-14 08:41:58 +02:00
2023-09-19 12:20:06 +02:00
2023-06-21 15:45:37 +02:00
2024-02-23 08:41:58 +01:00
2022-10-30 09:41:18 +01:00
2024-03-26 18:21:47 -04:00
2022-05-18 10:23:48 +02:00
2023-08-11 11:57:53 +02:00
2023-07-27 08:44:13 +02:00
2023-05-17 11:48:10 +02:00
2023-12-08 08:46:15 +01:00
2023-07-27 08:44:13 +02:00
2024-02-23 08:41:53 +01:00
2021-02-17 11:02:21 +01:00
2021-10-27 09:56:51 +02:00
2023-01-14 10:15:19 +01:00
2023-09-23 11:01:04 +02:00
2023-01-04 11:39:23 +01:00
2023-01-14 10:16:50 +01:00
2024-02-23 08:41:54 +01:00
2024-01-25 14:37:42 -08:00
2023-08-11 11:57:53 +02:00
2024-02-23 08:42:00 +01:00
2023-01-14 10:16:27 +01:00
2021-03-17 17:06:13 +01:00
2020-12-30 11:54:02 +01:00
2022-12-19 12:27:30 +01:00
2021-04-21 13:00:54 +02:00
2022-07-21 21:20:01 +02:00
2022-01-29 10:26:11 +01:00
2021-07-20 16:05:59 +02:00
2022-09-05 10:28:58 +02:00
2022-10-17 17:26:07 +02:00
2022-04-27 13:53:54 +02:00
2023-05-30 12:57:55 +01:00
2023-08-11 11:57:54 +02:00
2022-08-31 17:15:14 +02:00
2022-10-26 13:25:17 +02:00
2023-01-14 10:15:16 +01:00