2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00
Commit Graph

3753 Commits

Author SHA1 Message Date
Pavel Emelyanov
ee9d9bdb16 show: Compact output of zeroes in long repeated fields
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-17 14:48:05 +04:00
Pavel Emelyanov
1b3da3a1a8 security: Don't allow non-root user to dump or restore any caps bits
There can be a more sophisticated security policy, but right now
generic non-root user doesn't have any bits in there, so requiring
them to be zero is a sane starting point.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-17 14:27:00 +04:00
Pavel Emelyanov
b978c6f873 util: Introduce buffer size for carrying /proc/self/fd/N path
There's ... a number of places where we want to do something
with /proc/self/fd/%d path. Each time we guess buffer size
that is enough for this. Make standard constant for this and
save some space on stack and drop args for some functions.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:59:59 +04:00
Pavel Emelyanov
baa2583a1d files-reg: Sanitize ghost files re-opening for read
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:51:35 +04:00
Pavel Emelyanov
280b9e36bf inotify: Sanitize watches adding loop
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:45:32 +04:00
Pavel Emelyanov
d092c5ae65 inotify: Optimize ify search when collecting wd for it
CRIU puts wd-s for one inotify in one row (one after another),
so when collecting next wd, we can find the ify to attach them
to faster.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:40:45 +04:00
Pavel Emelyanov
cb576d892a inotify: Sort marks by wd before collecting them
The inotify_add_watch generates wd-s one-by one. We cannot
request for one, thus we call this syscall till the required
wd is generated.

Thus, if we want to restore several wd-s for an inotify, we
have to put them in ascending order. Otherwise we may restore
watch with higher wd earlier and will thus not be able to
generate the lower wd in a reasonable time.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:35:28 +04:00
Pavel Emelyanov
dc38364963 fsnotify: Print wd being restored for inotify
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:30:04 +04:00
Pavel Emelyanov
3f802388b3 fsnotify: Add comment saying why we attach watches via /proc/self/fd/
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:15:57 +04:00
Pavel Emelyanov
7eb20e7ddb fsnotify: Move decoding handle into function
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:13:58 +04:00
Pavel Emelyanov
7bb5ba1ffe fsnotify: Don't crash on bad fsnotify mark type
This can be broken image, need to handle this error gracefully.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:10:46 +04:00
Pavel Emelyanov
ccdcb3d39b fsnotify: Simplify get_mark_path code
Handle the simplest (remap) case early. This makes code
simpler and reduces one level of indent.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:05:50 +04:00
Pavel Emelyanov
32adef6f98 build: Move pie/gen-offsets.sh into scripts/
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 11:30:41 +04:00
Pavel Emelyanov
68475dd013 build: Move protobuf-desc-gen.sh into scripts/
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 11:26:45 +04:00
Cyrill Gorcunov
8a791d03f6 fsnotify: Add debug printing of the target link
Convenient for debug.

 | (00.005999)   3857: fsnotify:           Restore inotify watch for 0x00800002:0x0000000000000002 (via /proc/self/fd/5 -> /)
 | (00.005999)   3857: fsnotify:           Restore inotify watch for 0x00800002:0x0000000000083a93 (via /home/criu/test/zdtm/live/static/inotify-removed (deleted).cr.1.ghost)

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-14 14:40:30 +04:00
Ruslan Kuprieiev
1f8768dff1 test: rpc: fix log_level in test.c and add log_level to test.py
Hi!

Added "has_log_level = true" to test.c, so "log_level = 4" would have effect.
Also added log_level to test.py, for symmetry with test.c.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-14 13:21:22 +04:00
Cyrill Gorcunov
2503fd7da5 proc: parse -- Fix length for smaps maj/min parshing
Otherwise

 | Error (proc_parse.c:227): Can't parse: 555555554000-555555577000 r-xp 00000000 b6:d2f61 133545                  /sbin/init

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-14 13:20:35 +04:00
Pavel Emelyanov
14a7aff288 rst: Read sys.last_cap only once in kerndat
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-12 00:03:25 +04:00
Cyrill Gorcunov
d393e5d137 flock: Don't assume device maj/min numbers are byte long
Igor reported the following file lock

 | (00.003139) lockinfo: 4:POSIX ADVISORY WRITE 46567 b6:5f0b1:524702 0 EOF
 | (00.003154) lockinfo: 5:POSIX ADVISORY WRITE 46559 b6:5f0b1:524661 0 EOF
 | (00.003172) lockinfo: 6:POSIX ADVISORY WRITE 46543 b6:5f0b1:524326 0 0
 | (00.003188) lockinfo: 7:POSIX ADVISORY WRITE 46543 b6:5f0b1:524367 0 EOF

where device maj number is pretty big and parsing failed.
Fix it removing field width.

Reported-by: Igor Sukhih <igor@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-11 18:37:14 +04:00
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
c9d3145843 service: Change default socket path to /var/run/
This is where such stuff is typically placed.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-11 17:56:46 +04:00
Cyrill Gorcunov
929872d4a1 pie: paresite -- Print error codes from syscalls
In case if we hit error returned from syscall, better
to print error code for easier understanding of the
protblem.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-11 17:49:50 +04:00
Pavel Emelyanov
f0a8643736 kerndat: Initialize necessary kerndats on restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-11 17:38:57 +04:00
Pavel Emelyanov
461a466722 kerndat: Don't fail it tcp_*mem sysctls are missing
This can hppen if criu is run in container.

Reported-by: Frederico Araujo <araujof@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-11 17:26:34 +04:00
Cyrill Gorcunov
537621d954 fsnotify: Use pr_perror on inotify_add_watch error path
To get more detailed error desciption. Also print watchdog
number if it exceed expected, for better error output.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 23:02:40 +04:00
Cyrill Gorcunov
7ed0609943 fsnotify: Align collect_image_info members assignments
It's a way more easier to read.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 23:02:06 +04:00
Cyrill Gorcunov
2838136364 pie: Fix typo in dump_pages
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 22:59:12 +04:00
Jamie Liu
71e1a99523 pre-dump: do not disconnect from page server before writing to it
Signed-off-by: Jamie Liu <jamieliu@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 22:56:33 +04:00
Pavel Emelyanov
00ae0d330a dump: Add comment how we dump zombies in pidns case
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 15:28:29 +04:00
Cyrill Gorcunov
9dd6887d7a net: Dump EXTLINK devices
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 15:12:54 +04:00
Cyrill Gorcunov
d0a323cb1f net: Restore EXTLINK devices
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 15:12:36 +04:00
Cyrill Gorcunov
96fdc01798 protobuf: Add EXTLINK netdevice type
This kind of netdevice will serve for external
links such as venet, macvlan/vlan and etc.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 15:12:06 +04:00
Pavel Emelyanov
20d64b4326 dump: Install target ns' proc fd as service fd
Don't carry it around in a static global variable. Would
be useful for pidns leaks (processes entered one) scan.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 15:07:01 +04:00
Pavel Emelyanov
670e26b07e Merge branch 'brfetch' 2013-10-10 11:28:12 +04:00
Pavel Emelyanov
74af0c2243 inet: Improve messaging in can_dump_inet_sk error paths
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 11:27:51 +04:00
Pavel Emelyanov
4648090f3c inet: Turn check for family in can_dump_sock into BUG_ON
We only get there after and because-of family checks. No need
to check them again.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 11:24:23 +04:00
Pavel Emelyanov
0a8a162146 unix: Increase verbosity of "can't dump this socket" check
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 11:17:42 +04:00
Cyrill Gorcunov
fa73b3e799 crtools: Use -o argument directly
There is no much point to strdup this value
obtained from command line. It sits in environment
and we don't modify it at all.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 11:11:05 +04:00
Cyrill Gorcunov
664659a0ad inet: tcp -- Find size of max memory allowed to restore TCP data
The maximal size which may be used in the kernel for sending TCP data
on restore is varies depending on how many memory installed on the
system, moreover the memory allocated for "read queue" is bigger than
used for "write queue". Thus when we checkpointed a big slab of data
we need to figure out which size is allowed for sending data on restore.

For this we read /proc/sys/net/ipv4/tcp_[wmem|rmem] on restore and calculate
the size needed, then we simply chop data to segements and send it
in a loop.

Typical output on restore is something like

 | (00.013001)  30110: TCP queue memory limits are 2097152:3145728

https://bugzilla.openvz.org/show_bug.cgi?id=2751

[xemul: moved stuff to kerndat.c]

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-04 16:18:24 +04:00
Cyrill Gorcunov
249ee5f797 crtools: Print error message with capital letter
We usually print error messages starting with capital letter.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-09 17:18:23 +04:00
Cyrill Gorcunov
6695ff7259 mount: Add missing \Newline
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-09 17:17:58 +04:00
Pavel Emelyanov
d516257151 zdtm: Write netns test in
It was written but wasn't included into standard run because
ip tool with needed functionality wasn't available "upstream".

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-04 02:54:56 +04:00
Pavel Emelyanov
eb3fc256f3 zdtm: Basic checks for iptables save and restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-04 02:54:28 +04:00
Pavel Emelyanov
28014d7eb4 net: Save and restore iptables in net namespace
By default just use the iptables-save and iptables-restore commands.
User may define CR_IPTABLES variable, in this case the "sh -c $CR_IPTABLES"
would be called.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-04 02:51:33 +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
f5cd8bfdc3 test: rpc: restore
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 20:17:08 +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
Ruslan Kuprieiev
cdba0c87bf rpc: add restore to rpc.proto
Add restore to rpc.proto.
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 20:16:29 +04:00
Andrey Vagin
4b99ec469b parasite: don't block if a parasite crashes
We need to detect parasite crashes to not hangs on socket operations.
CRIU ptraces parasite. So if it crashes, SIGCHLD is received.

If a parasite daemon crashed, we can to do nothing. The state of current
process can't be restored, because we can't to drop the signal. The
state of other processes are consistent. Probably the best choise in
this case is to exit.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-02 20:12:56 +04:00