Vitaly Chikunov
e64e27d5cb
9pfs: Fix segfault in do_readdir_many caused by struct dirent overread
`struct dirent' returned from readdir(3) could be shorter (or longer)
than `sizeof(struct dirent)', thus memcpy of sizeof length will overread
into unallocated page causing SIGSEGV. Example stack trace:
#0 0x00005555559ebeed v9fs_co_readdir_many (/usr/bin/qemu-system-x86_64 + 0x497eed)
#1 0x00005555559ec2e9 v9fs_readdir (/usr/bin/qemu-system-x86_64 + 0x4982e9)
#2 0x0000555555eb7983 coroutine_trampoline (/usr/bin/qemu-system-x86_64 + 0x963983)
#3 0x00007ffff73e0be0 n/a (n/a + 0x0)
While fixing this, provide a helper for any future `struct dirent' cloning.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/841
Cc: qemu-stable@nongnu.org
Co-authored-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Tested-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Acked-by: Greg Kurz <groug@kaod.org>
Tested-by: Vitaly Chikunov <vt@altlinux.org>
Message-Id: <20220216181821.3481527-1-vt@altlinux.org>
[C.S. - Fix typo in source comment. ]
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
2022-02-17 16:57:58 +01:00
..
2021-05-10 15:41:50 -04:00
2021-06-02 06:51:09 +02:00
2021-07-21 07:45:38 -10:00
2020-11-15 17:04:40 +01:00
2016-07-12 16:20:46 +02:00
2019-07-15 15:39:02 +02:00
2021-07-26 06:56:41 -10:00
2021-05-10 17:21:54 +01:00
2020-11-15 17:04:40 +01:00
2021-01-07 05:09:41 -10:00
2021-06-25 14:24:24 +03:00
2021-06-16 15:03:26 +02:00
2021-06-04 13:50:01 +02:00
2020-06-23 15:46:05 +01:00
2022-02-14 17:11:25 +00:00
2020-03-16 23:02:21 +01:00
2019-06-12 13:20:20 +02:00
2021-01-24 20:10:54 +01:00
2019-06-11 20:22:09 +02:00
2021-12-21 10:50:22 +04:00
2020-12-10 12:15:18 -05:00
2021-12-21 10:50:22 +04:00
2019-05-13 08:58:55 +02:00
2012-12-19 08:32:39 +01:00
2021-02-01 10:50:55 +00:00
2021-02-08 14:43:55 +01:00
2021-02-07 20:38:34 +00:00
2016-06-07 18:19:23 +03:00
2020-11-15 17:04:40 +01:00
2017-10-16 20:57:13 +03:00
2019-05-22 12:38:54 -04:00
2020-03-18 14:03:46 -04:00
2020-10-15 16:06:27 +02:00
2021-11-09 10:32:52 +11:00
2021-03-09 21:47:45 +01:00
2022-01-08 15:46:10 +10:00
2021-02-03 08:00:33 -06:00
2021-11-02 15:57:21 +01:00
2019-05-13 08:58:55 +02:00
2021-10-07 10:42:40 +02:00
2021-06-16 15:03:26 +02:00
2018-03-12 11:10:20 +00:00
2020-09-23 16:07:44 +01:00
2021-07-05 11:40:32 +01:00
2019-09-11 08:46:17 +02:00
2021-06-15 20:27:38 +02:00
2021-11-08 12:27:23 +04:00
2019-09-24 12:18:47 +01:00
2020-12-10 17:16:44 +01:00
2019-01-11 15:46:55 +01:00
2021-12-21 10:50:22 +04:00
2022-02-17 16:57:58 +01:00
2016-07-12 16:20:46 +02:00
2021-07-14 14:33:53 +01:00
2021-11-04 10:32:01 +00:00
2019-05-13 08:58:55 +02:00
2018-02-05 18:09:45 +01:00
2021-06-25 14:24:24 +03:00
2019-06-12 13:20:20 +02:00
2021-05-26 14:49:46 +02:00
2022-02-09 12:08:42 +00:00
2019-04-18 22:18:59 +02:00
2018-09-26 08:55:54 -07:00
2019-04-18 22:18:59 +02:00
2020-09-23 16:07:44 +01:00
2019-08-16 13:31:52 +02:00
2021-06-25 14:22:21 +03:00
2020-09-23 16:07:44 +01:00
2021-11-10 13:20:15 +01:00
2018-01-16 14:54:50 +01:00
2021-06-21 05:49:01 +02:00
2020-09-23 16:07:44 +01:00
2021-06-18 10:59:53 -05:00
2021-07-21 07:45:38 -10:00
2019-05-13 08:58:55 +02:00
2019-05-13 08:58:55 +02:00
2021-06-16 15:03:26 +02:00
2021-06-16 15:03:26 +02:00
2021-06-16 15:03:26 +02:00
2017-09-06 10:12:02 +02:00
2019-06-12 13:20:20 +02:00
2016-02-23 12:43:05 +00:00
2021-04-12 12:27:14 +10:00
2021-11-16 09:43:44 +01:00
2020-06-16 14:49:05 +01:00
2021-02-18 08:19:08 +00:00
2018-08-24 20:26:37 +02:00
2019-02-01 13:46:45 +01:00
2016-09-15 15:32:22 +03:00
2021-02-08 11:19:51 +00:00
2020-05-14 15:03:08 +01:00
2021-09-07 09:08:24 +01:00
2022-02-01 13:49:15 +01:00
2018-10-02 19:09:12 +02:00
2017-01-24 23:26:52 +03:00
2021-01-19 14:38:51 +00:00
2021-04-01 15:27:44 +04:00