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

9635 Commits

Author SHA1 Message Date
Andrei Vagin
9715eb2de5 zdtm: fix a lint warning about undefined 'raw_input'
test/zdtm.py:1238:3: F821 undefined name 'raw_input'

v2: ask to press enter, not just any key
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-14 20:29:20 +03:00
Adrian Reber
39b6fec0a9 test/zdtm.py: add option to specify external criu for test suite
I am regularly running zdtm.py after updating the CRIU rpm to test if
the new rpm still works. Until know I usually did:

-criu_bin = "../criu/criu"
-crit_bin = "../crit/crit"
+criu_bin = "/usr/sbin/criu"
+crit_bin = "/usr/bin/crit"

This commit adds two arguments to zdtm.py:

  --criu-bin CRIU_BIN   Path to criu binary
  --crit-bin CRIT_BIN   Path to crit binary

It still defaults to the old values from above, but can now easily be
changed to the CRIU binary provided by the packaging system.

This change was more complicated than expected which is probably related
to the fact that zdtm restarts itself in namespaces.

v2:
 - rebase
v3:
 - fix errors reported by 'make lint'

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-14 20:26:25 +03:00
Dmitry Safonov
344f75c7a2 tun/kerndat: Keep going with CONFIG_TUN=n
check_tun_netns_cr() should return 0 on CONFIG_TUN=n kernels.
That is, when we fail to open tun device.

Fixes: #496

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-14 20:24:49 +03:00
Andrei Vagin
2a027fe9d3 crit: typo fix
test/dump/zdtm/static/msgque/43/1/ipcns-msg-12.img decode fails: object of type 'NoneType' has no len()

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-14 20:22:54 +03:00
Adrian Reber
5260fdc925 zdtm: fix atomic_{sub, add}_return assembler for aarch64
Running the test suite on aarch64 showed two tests failing (static/fd
and transition/maps0007). Debugging showed that the
atomic_{sub,add}_return() functions did not return the value but the
lower 32bit of the address of that value.

Simply dereferencing the input solves the two mentioned test cases.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-14 20:22:34 +03:00
Dmitry Safonov
d967ecf7c5 zdtm/lib: Check EWOULDBLOCK in errno instead of -EWOULDBLOCK
Syscalls do return negative value in case of an error.
But errno contains the error code itself.

Add uint32_t to sys_futex() definition.
sizeof(unsigned int) might be not 4 bytes.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-14 20:22:34 +03:00
Pawel Stradomski
433bffb411 Allow criu page-server to work over ipv6.
Signed-off-by: Pawel Stradomski <pstradomski@google.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-12 01:47:17 +03:00
Andrei Vagin
9fd4436063 zdtm: open notify file descriptors in a binary mode
Send pre-dump notify to 36
  Traceback (most recent call last):
    File "zdtm.py", line 2161, in <module>
      do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
    File "zdtm.py", line 1549, in do_run_test
      cr(cr_api, t, opts)
    File "zdtm.py", line 1264, in cr
      test.pre_dump_notify()
    File "zdtm.py", line 490, in pre_dump_notify
      fdin.write(struct.pack("i", 0))
  TypeError: write() argument 1 must be unicode, not str

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-10 02:07:44 +03:00
Radostin Stoyanov
8a5c46b163 test: Don't leak file descriptor
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 10:00:34 +03:00
Andrei Vagin
1a1e3d7f56 test: run a full set of tests in docker containers
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
de66a47cd6 test/netns-nf: add one more path for libxt_standard.so
On Alpine Linux, libxt_standard.so is installed in /usr/lib/xtables/

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
af4dbcd1ee zdtm: fix collecting libraries on Alpine Linux
Here is an example of ldd output:

/musl # ldd /usr/lib/libxtables.so.12
	ldd (0x7fae8e06c000)
	libc.musl-x86_64.so.1 => ldd (0x7fae8e06c000)

We need to skip the "ldd (0x7fae8e06c000)" line.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
04a843c2f2 test: don't save content of /sys/kernel/debug/tracing/trace
We don't tune tracers, so we don't expect to get anything.
In docker containers, debugfs isn't mounted and this command failed.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
c4b398fd0a build/docker: install packages to run tests
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
69b07b1676 alpine: sigaltstack returns EINVAL if SS_ONSTACK is set
Actually this flag is ignored by kernel.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
8019e4962d criu: musl scanf and printf don't support the L modifer for intergers
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
1920475941 alpine: call write instead of fprintf
fprintf in Alpine Linux calls writev, which is prohibited in the
SECCOMP_MODE_STRICT mode.

===================== Run zdtm/static/seccomp_strict in h ======================
Start test
Test is SUID
./seccomp_strict --pidfile=seccomp_strict.pid --outfile=seccomp_strict.out
make: *** [Makefile:385: seccomp_strict.pid] Error 1
 Test zdtm/static/seccomp_strict FAIL at start: [Errno 2] No such file or directory: 'zdtm/static/seccomp_strict.pid'
Test output: ================================
22:45:24.661:    38: ERR: seccomp_strict.c:97: read (errno = 2 (No such file or directory))
22:45:24.662:    37: ERR: test.c:315: Test exited unexpectedly with code 1

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
dec375f87e travis: run the crit-recode test
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
e2bb525d62 test: make crit-recode.py python2/python3 compatible
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
81c37c2fc6 lib: a few fixes to be compatible with python3
All these issues was found by running test/crit-recode.py

https://github.com/checkpoint-restore/criu/issues/495

v2: drop FD_CLOEXEC for swrk descriptors
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
cd79f7b6e5 test: import pycriu by its right name
Otherwise one library will be imported twice by two different names: py
and pycriu, because pycriu is used in the library.

https://github.com/checkpoint-restore/criu/issues/495
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
1509147abe travis: set python3 as default for fedora containers
We need a few jobs to check a compatibility with python3

v2: fix inhfd and rpc tests
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Andrei Vagin
212e4c771a test: make zdtm.py python2/python3 compatible
Cc: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-08 09:54:22 +03:00
Cyrill Gorcunov
e7de24cdb5 dump: Don't loose dump_namespaces error
In case if dump_namespaces failed we may have
ret shadowed and erroneously report checkpoint
success.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-06 22:13:31 +03:00
Cyrill Gorcunov
7d8a6df24d seccomp: Use own seccomp_metadata_t type
On fedora rawhide seccomp_metadata for some
reason is not defined (while in kernel it introduced
together with PTRACE_SECCOMP_GET_METADATA). So
lets do a trick for a while -- define own alias.
Once system headers get settled down we might find
more suitable solution. Because it's a part of kernel
API we're on the safe side.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-26 04:05:29 +03:00
Cyrill Gorcunov
0cb091a882 seccomp: Don't exit from __export_restore_thread
After CR_STATE_RESTORE_SIGCHLD stage triggered we are
not allowed to exit, just yield the BUG instead.

Reported-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-25 00:28:20 +03:00
Adrian Reber
579872a530 travis: fix python2 package installation
For python2/python3 compatibility install additional (python2-future)
and different (python2-ipaddress) packages during test.

Also switch Fedora tests to explicitly install versioned python packages
(python2-* instead of python-*).

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-25 00:23:00 +03:00
Adrian Reber
a91da7d449 Adapt zdtm for python3 compatibility
As python3 imports are working a bit differently the structure of the
imported files needs to change. Instead of having symlinks to criu.py
and rpc_pb2.py which does not match the import structure just create
symlink to ../lib/py (like crit) to make zdtm usable again with the
python3 compatibility.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-25 00:23:00 +03:00
Adrian Reber
a390094bd0 crit: enable python2 or python3 based crit
With this last commit of the crit with python3 series it is possible to
either use python2 or python3 with CRIU.

Now the basic build system functionality (make and make install) are
python2/python3 aware. zdtm.py and criu-coredump are still python2, but
as they are not part of 'make install' those parts have not yet been
ported from python2 to python3.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-25 00:23:00 +03:00
Adrian Reber
222ad25bed Makefiles: auto-detect python version - prefer python2
This prepares CRIT for python2/python3 compatibility by auto-detecting
the installed python version. python2 is detected first and then the
variable PYTHON is set.

By setting the variable PYTHON to python2/python3 the user can override
the auto-detection.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-25 00:23:00 +03:00
Adrian Reber
af353d0f69 crit: make crit python2/python3 compatible
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-25 00:23:00 +03:00
Andrei Vagin
049b1444b3 remote: a few minor fixes to make travis happy 2018-05-23 03:13:25 +03:00
Rodrigo Bruno
d4a21d98e0 remote: Fixing identation. 2018-05-23 03:13:25 +03:00
Rodrigo Bruno
cc4cc0750c remote: Minor improvements on img-remote.c 2018-05-23 03:13:25 +03:00
Rodrigo Bruno
cb5f93675a remote: Unblocking implementation of img cache and proxy seems to be working. 2018-05-23 03:13:25 +03:00
Rodrigo Bruno
945875fcea remote: Unix socket for local connections is async. 2018-05-23 03:13:25 +03:00
Rodrigo Bruno
7c81eeb9ba remote: Preparing image receive and send for asynchronous sockets. 2018-05-23 03:13:25 +03:00
Dmitry Safonov
82a891b73a Documentation/make: Call check before install
Let's warn about binary needed for `install` target.
Before:
[root@localhost criu]# make install
  GEN      crit.1
make[1]: *** [Makefile:49: crit.1] Error 127
make: *** [Makefile.install:32: install-man] Error 2

After:
[root@localhost criu]# make install
/bin/sh: line 1: xmlto: command not found
make[1]: *** [Makefile:32: check] Error 1
make: *** [Makefile.install:32: install-man] Error 2

Fixes: #481
Reported-by: treaki@gmail.com
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-18 01:23:17 +03:00
Dmitry Safonov
0af80816de zdtm/make: Include Makefile.inc after defining $(DEP)
Otherwise, tests dependencies are not considered for build.
Add an error in Makefile.inc so this won't happen again.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Reported-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-18 01:23:17 +03:00
Dmitry Safonov
c4848ffeed Revert "test/make: Include .d files"
This reverts commit dcafa78b96084216e32b757be62b7fa8aebbdd87.

I've found that we already include deps in Makefile.inc,
was to fast on the first attempt and overlooked this.
(the include just doesn't work like it should yet..)

The origin patch may be just dropped before preparing master's merge.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-18 01:23:17 +03:00
Cyrill Gorcunov
267899bfb6 unix: Improve init_unix_sk_info
This helper must init every member of a structure,
not some part of it. Beautify code as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-16 21:53:34 +03:00
Cyrill Gorcunov
04e28419e5 unix: Unify printings on peer open
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-16 21:53:34 +03:00
Cyrill Gorcunov
015e1aca3f unix: Print reverted dir info if only directory provided
Otherwise there is an imbalance in logs with number of
"Reverted working dir" message

 | (00.018604)     36: unix: Connected 0x11ceff -> 0x11cf00 (0x11cf00) flags 0
 | (00.018644)     36: unix: Reverted working dir
 | (00.018652)     36: unix: Connected 0x11cefd -> 0x11cefe (0x11cefe) flags 0
 | (00.018665)     36: unix: Reverted working dir
 | (00.018688)     36: unix: Reverted working dir

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-16 21:53:34 +03:00
Cyrill Gorcunov
e114ede3ad unix: Don's spam with warning if nothing to unlink
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-16 21:53:34 +03:00
Cyrill Gorcunov
d8e2b48d10 unix: Drop empty line at eof
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-16 21:53:34 +03:00
Cyrill Gorcunov
6824331903 unix: Use generic xptr_pull in dump_one_unix_fd
To unify style of pointers fetching from memory slab.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-16 21:53:34 +03:00
Cyrill Gorcunov
1a07226146 unix: Adjust unix_desc_ops members
For readability sake.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-16 21:53:34 +03:00
Cyrill Gorcunov
451cad336b unix: Adjust unix_sk_cinfo members
For readability sake.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-16 21:53:34 +03:00
Cyrill Gorcunov
018673694b unix: Adjust unix_sk_info members
For readability sake. And use standart uint8_t types.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-16 21:53:34 +03:00
Cyrill Gorcunov
a7f6f2513d unix: Use uint32_t instead of u32
So the rest of code will match.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-16 21:53:34 +03:00