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