kdat: fill kdat by zero-s before initializing it

Submitted by Andrey Vagin on May 15, 2018, 7:52 p.m.

Details

Message ID 20180515195257.27789-1-avagin@virtuozzo.com
State Accepted
Series "kdat: fill kdat by zero-s before initializing it"
Headers show

Commit Message

Andrey Vagin May 15, 2018, 7:52 p.m.
kerndat_try_load_cache() fills kdat from /run/criu.kdat,
so it will contain some trash, if criu.kdat isn't compatible with the
current version of criu.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
---
 criu/kerndat.c | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/kerndat.c b/criu/kerndat.c
index ba8d93808..8cb569016 100644
--- a/criu/kerndat.c
+++ b/criu/kerndat.c
@@ -973,6 +973,9 @@  int kerndat_init(void)
 	if (ret <= 0)
 		return ret;
 
+	/* kerndat_try_load_cache can leave some trash in kdat */
+	memset(&kdat, 0, sizeof(kdat));
+
 	preload_socket_modules();
 	preload_netfilter_modules();
 

Comments

Dmitry Safonov May 15, 2018, 8:14 p.m.
2018-05-15 20:52 GMT+01:00 Andrei Vagin <avagin@virtuozzo.com>:
> kerndat_try_load_cache() fills kdat from /run/criu.kdat,
> so it will contain some trash, if criu.kdat isn't compatible with the
> current version of criu.
>
> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>

LGTM,
Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>

Thanks,
             Dmitry
Cyrill Gorcunov May 15, 2018, 8:55 p.m.
On Tue, May 15, 2018 at 10:52:57PM +0300, Andrei Vagin wrote:
> kerndat_try_load_cache() fills kdat from /run/criu.kdat,
> so it will contain some trash, if criu.kdat isn't compatible with the
> current version of criu.
> 
> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>