2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 12:57:57 +00:00

11 Commits

Author SHA1 Message Date
Cyrill Gorcunov
e1d43c4f8e lib: criu -- Test for nil on malloc/strdup calls
Otherwise nil dereference is possible.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-01 11:23:21 +04:00
Deyan Doychev
69a6bf4439 criu: Add exec-cmd option (v3)
The --exec-cmd option specifies a command that will be execvp()-ed on successful
restore. This way the command specified here will become the parent process of
the restored process tree.

Waiting for the restored processes to finish is responsibility of this command.

All service FDs are closed before we call execvp(). Standad output and error of
the command are redirected to the log file when we are restoring through the RPC
service.

This option will be used when restoring LinuX Containers and it seems helpful
for perf or other use cases when restored processes must be supervised by a
parent.

Two directions were researched in order to integrate CRIU and LXC:

1. We tell to CRIU, that after restoring container is should execve()
   lxc properly explaining to it that there's a new container hanging
   around.

2. We make LXC set himself as child subreaper, then fork() criu and ask
   it to detach (-d) from restore container afterwards. Being a subreaper,
   it should get the container's init into his child list after it.

The main reason for choosing the first option is that the second one can't work
with the RPC service. If we call restore via the service then criu service will
be the top-most task in the hierarchy and will not be able to reparent the
restore trees to any other task in the system. Calling execve from service
worker sub-task (and daemonizing it) should solve this.

Signed-off-by: Deyan Doychev <deyandoichev@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-25 01:20:02 +04:00
Deyan Doychev
714c27fc11 libcriu: Add criu_set_root to the interface.
This function implements the --root command line option in libcriu.

Signed-off-by: Deyan Doychev <deyandoichev@gmail.com>
Reviewed-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-21 08:34:37 +04:00
Cyrill Gorcunov
f0b5bedfa5 libcriu: Add criu_set_cpu_cap helper
To setup cpu capability mask.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 20:34:42 +04:00
Ruslan Kuprieiev
579e55fa0d libcriu: add work_dir support
As we've added work_dir_fd to RPC, lets add support for it to libcriu.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-04 18:27:20 +04:00
Andrey Vagin
a5bb33417b service: don't leak a zero file descriptor
CID 1141017 (#1-2 of 2): Resource leak (RESOURCE_LEAK)
14. leaked_handle: Handle variable fd going out of scope leaks the handle.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-23 13:59:41 +04:00
Andrey Vagin
ad0249f649 lib: don't copy more than the buffer size
CID 1141012 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
2. fixed_size_dest: You might overrun the 108 byte fixed-size string
"addr.sun_path" by copying "service_address" without checking the
length.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-23 13:53:53 +04:00
Ruslan Kuprieiev
e80ee17368 lib: return -EBADE instead of -1
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 21:08:58 +04:00
Ruslan Kuprieiev
906a75ca03 lib: add check/dump/restore
These functions are to be used to check criu, dump process and restore process.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:26:11 +04:00
Cyrill Gorcunov
5006ed5f7c version: Define version as a macro
Defining it as static char is a bad idea especially
if it get included and never used -- we will get
"unused" variable error.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-14 15:00:17 +04:00
Ruslan Kupreev Руслан
27f9b0335d v2 criu: Initial skeleton for criu library
Add target lib to Makefile for criu library.
Created directory lib and add there Makefile and criu.c - skelettons for criu library.

Signed-off-by: Ruslan Kupreev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-18 21:47:11 +04:00