2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

29 Commits

Author SHA1 Message Date
Pavel Emelyanov
ebb4a1bf60 service: Go to daemon with detached terminal and cwd
Logs are put into dedicated logfd, cwd is not used as well.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-11 17:59:21 +04:00
Pavel Emelyanov
80b1da7fb6 service: Add comment why we do detached restore on RPC request
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 23:20:33 +04:00
Ruslan Kuprieiev
ba196e6358 service: treat restore request properly
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 20:16:51 +04:00
Ruslan Kuprieiev
dbced2f013 log: one default log filename
Lets use one default log filename. User can set if in request, if needed.
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 20:16:38 +04:00
Pavel Emelyanov
b4c8c5ae32 security: Also save gid of user requesting for C/R
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-28 15:51:09 +04:00
Ruslan Kuprieiev
398705d4cb rpc: rename criu_dump_req to criu_opts
Lets rename CriuDumpReq to CriuOpts, for the sake of readability and to
avoid coping code for restore mechanism, as CriuDumpReq and
CriuRestoreResp would have almost the same fields. Also, it would be
easier to introduce other types of requests.

Signed-off-by: Ruslan Kuprieiev <kurpuser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 16:04:11 +04:00
Ruslan Kuprieiev
4d80f502e8 v2 rpc: add log_file field to opts, add defaults toi log.h and use them where needed
[xemul: Simplified !log_file case and renumbered .proto fields]

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 16:01:44 +04:00
Pavel Emelyanov
4b9b7953dd service: Make default (not set) service ino == -1
Zero is bad for checks, as peer-less sockets have such.
BUG introduced in cfe72ab7 :(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-28 09:44:29 +04:00
Pavel Emelyanov
2fe5884df3 service: Remove empty cr_service_client
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-28 06:18:44 +04:00
Pavel Emelyanov
91389f8782 security: Introduce (rather basic) security restrictions for C/R
Right now we have an ability to launch the C/R service from root
and execure dump requests from unpriviledged users. Not to be bad
guys, we deny dumping tasks belonging to user, that cannot be
"watched" (traced, read /proc, etc.) by the dumper.

In the future we will use this "engine" when launched with suid
bit, and (probably) will have more sophisticated policy.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-28 06:16:17 +04:00
Pavel Emelyanov
cfe72ab77a service: Put service sk inode into separate variable
I'm about to get rid of service state struct.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-28 06:06:53 +04:00
Pavel Emelyanov
14559435f5 service: Sanitize service-child code-flow
* Close fd only once at the end
* Close listener socket

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-28 05:59:33 +04:00
Pavel Emelyanov
0acc2624d4 service: Remove sk fd from service state struct
This fd is an internal thing of the service. Remove it from
externally available structure.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-28 05:54:50 +04:00
Pavel Emelyanov
0521367f22 service: Remove actually unused pid variable from service state
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-28 05:52:18 +04:00
Pavel Emelyanov
9bc82f4910 rpc: Send EMPTY message with success == fail in case of unsupported request
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-28 05:49:31 +04:00
Ruslan Kuprieiev
3f9478d68c service: check errors of xmalloc
Original-patch-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-24 11:18:51 +04:00
Ruslan Kuprieiev
bc5828c111 service: don't leak a client socket if fork failed
Original-patch-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-24 11:17:33 +04:00
Andrey Vagin
c861f61e0c service: exit if accept() returned an error
I don't know a reason, when accept() fails once and then goes back to
normal work.

Cc: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-24 11:12:55 +04:00
Andrey Vagin
3477223068 service: set one exit point (v2)
v2: remove exit()

Cc: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-24 11:11:56 +04:00
Pavel Emelyanov
bd90e9887c service: move worker's code in a separate function
Original-patch-by: Andrey Vagin <avagin@openvz.org>
Original-patch-by: Ruslan Kuprieiev <kupruser@gmail.com>

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-23 14:37:56 +04:00
Ruslan Kuprieiev
c90b58d855 service: change a few "puts" with "pr_perror"
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-23 14:31:29 +04:00
Pavel Emelyanov
44faa25d9d rpc: Mark that dump-resp restore is in the message
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-17 00:50:03 +04:00
Ruslan Kuprieiev
4eb2872b27 v2 crtools: write pidfile, when service/page server is run as daemon and "--pidfile" is set
When service/page server becomes daemon, we may need to know it's pid.

Signed-off-by: Ruslan Kuprieiev<kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-16 15:45:01 +04:00
Pavel Emelyanov
c6b79bd35f service: Don't forget to send dump-failed message
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-16 15:41:37 +04:00
Pavel Emelyanov
5f47e0a67f service: Simplify dump-responce sending
We need 2 parameters only to form it properly.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-16 15:40:04 +04:00
Pavel Emelyanov
e866b7c043 rpc: Split rpc req-s from rpc-resps
Now we don't have generic criu_msg thing -- instead, we have
explicit request (with per-type args) and explicit responce
(yet again -- with per-type args).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-16 15:36:12 +04:00
Ruslan Kuprieiev
98b5541492 v2 rpc: change some "required" fields to "optional"
The most of fields are to be changed to "optional", because they are
optional in fact.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-16 15:21:13 +04:00
Ruslan Kuprieiev
8fddfd2ff4 crtools: Add cr_service meat
The need in service is described at http://criu.org/Self_dump

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-13 15:53:06 +04:00
Ruslan Kuprieiev
eb79300dfd crtools: initial skeleton for cr_service
The criu service is a daemon, that opens a unix socket and listens for
incoming requests. The requests will be declared in protobuf/rpc.proto
and for now will only contain the 'dump' request.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-13 15:50:39 +04:00