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
..
2022-01-12 17:09:39 +00:00
2022-01-12 17:09:39 +00:00
2022-01-12 17:09:39 +00:00
2022-01-12 17:09:39 +00:00
2022-02-04 09:07:43 -05:00
2021-10-13 10:47:49 +02:00
2021-07-09 18:42:46 +02:00
2021-10-27 17:10:00 -07:00
2022-01-08 15:46:10 +10:00
2021-11-02 15:57:21 +01:00
2021-07-06 08:33:51 +02:00
2022-01-12 17:09:39 +00:00
2022-01-12 14:09:06 +01:00
2021-07-06 18:05:16 -04:00
2021-07-09 18:20:27 +02:00
2022-02-17 16:57:58 +01:00
2022-02-06 04:33:50 -05:00
2021-06-19 14:51:51 -07:00
2021-06-25 14:24:24 +03:00
2021-07-22 14:44:47 +02:00
2022-01-12 17:09:39 +00:00
2022-02-14 17:11:25 +00:00
2021-09-15 14:42:48 +02:00
2021-10-15 16:11:22 +02:00
2021-09-30 15:30:25 +02:00
2021-10-14 09:50:57 +02:00
2021-06-16 15:03:26 +02:00
2021-07-21 07:45:38 -10:00
2021-11-10 13:20:15 +01:00
2021-07-26 07:06:49 -10:00
2021-07-09 18:20:27 +02:00
2021-11-16 09:43:44 +01:00
2021-07-09 12:26:05 +02:00
2021-09-07 09:08:24 +01:00
2022-02-01 13:49:15 +01:00