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

2223 Commits

Author SHA1 Message Date
Taemin Ha
cfaacfb582 zdtm/thread_different_uid_gid: remove the redundant check
line 131 checks if (ret >= 0). line 133 could be replaced by a simple else statement

Signed-off-by: Taemin Ha <taeminha@cs.utexas.edu>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2023-10-22 13:29:25 -07:00
Taemin Ha
36a84751ed zdtm/cow00: fix typo
The condition meant to check fd2 instead of fd1, which is checked in
line 24.

Signed-off-by: Taemin Ha <taeminha@cs.utexas.edu>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2023-10-22 13:29:25 -07:00
Andrei Vagin
81a30c3206 zdtm/memfd04: check execveat on memfd that has memory mappings
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2023-10-22 13:29:25 -07:00
Andrei Vagin
00f8a56b6e zdtm: check userns once
All test logs are flooded with the "userns is supported" messages...

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
ba48ceb575 zdtm: socket_udp_shutdown: Make the test fail instead of timing out.
When -- after restore -- sockets can't communicate, the test times out
while waiting on recvfrom(). Since the communication is local, send()
works instantaneously - so mark sockets with SOCK_NONBLOCK and report
failure if the message is not received immediately.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
f6e820bedb zdtm: Treat ESRCH from kill() as success.
This fixes a failure to clean up after a failed test, where CRIU didn't start properly.

```
===================== Run zdtm/transition/socket-tcp in h ======================
Start test
./socket-tcp --pidfile=socket-tcp.pid --outfile=socket-tcp.out
Traceback (most recent call last):
  File ".../zdtm_py.py", line 1906, in do_run_test
    cr(cr_api, t, opts)
  File ".../zdtm_py.py", line 1584, in cr
    cr_api.dump("dump")
  File ".../zdtm_py.py", line 1386, in dump
    self.__dump_process = self.__criu_act(action,
  File ".../zdtm_py.py", line 1224, in __criu_act
    raise test_fail_exc("CRIU %s" % action)
test_fail_exc: CRIU dump

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<embedded module '_launcher'>", line 182, in run_filename_from_loader_as_main
  File "<embedded module '_launcher'>", line 34, in _run_code_in_main
  File ".../zdtm_py.py", line 2790, in <module>
    fork_zdtm()
  File ".../zdtm_py.py", line 2782, in fork_zdtm
    do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
  File ".../zdtm_py.py", line 1922, in do_run_test
    t.kill()
  File ".../zdtm_py.py", line 509, in kill
    os.kill(int(self.__pid), sig)
ProcessLookupError: [Errno 3] No such process
```

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
c29c5a1df0 zdtm: cgroup04: Improve skip check's robustness.
cgroup04 test needs full control over mem and devices cgroup hierarchies.
Make the test's .checkskip script better at detecting if the cgroups are
available for use.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
131e464a05 zdtm: cgroup04: Improve error messages.
Make the errno values reported by cgroup04 always correct and showing
relevant parameters.
Constify constant strings, while at it.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
785d97a619 zdtm: If ignoring kernel taint, also ignore taint changes.
At least in Google's VM environment, the kernel taints are unrelated to CRIU
runs.  Don't fail tests if taints change, if kernel taints are ignored.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Radostin Stoyanov
7a2910f897 py/cli: add --version option
This patch implements the '--version' for the crit tool.

$ crit --version
3.17

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-10-22 13:29:25 -07:00
Michal Clapinski
8caf460b9c zdtm: test MEMBARRIER_CMD_GLOBAL_EXPEDITED migration
Check membarrier registration both ways:
1. By issuing membarrier commands and checking if they succeed.
2. By issuing MEMBARRIER_CMD_GET_REGISTRATIONS.

The first way is needed for older kernels. The second way is needed to test
MEMBARRIER_CMD_GLOBAL_EXPEDITED.

Signed-off-by: Michal Clapinski <mclapinski@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
b7a8bb0889 zdtm: test execveat(memfd)
Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Radostin Stoyanov
1800018bc1 test/other: add test for action-script
This commit is introducing a test for the action-script functionality
of CRIU to verify that pre-dump, post-dump, pre-restore, pre-resume,
post-restore, post-resume hooks are executed during dump/restore.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-10-22 13:29:25 -07:00
Michał Mirosław
2547ac8ac1 zdtm: membarrier: test migration of membarrier() registration
Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
3628589b51 zdtm/memfd00: test memfd file mode
Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
fe4be19de4 prctl: test prctl(NO_NEW_PRIVS) setting
Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
znley
788e1e92ef zdtm: add loongarch64 support
Signed-off-by: znley <shanjiantao@loongson.cn>
2023-10-22 13:29:25 -07:00
znley
b2d74fbfd4 zdtm: replace NR_fstat with NR_statx
NR_fstat is a deprecated syscall, some
modern architectures such as riscv and
loongarch64 no longer support this syscall.
It is usually replaced by NR_statx.

NR_statx is supported since linux 4.10.

Signed-off-by: znley <shanjiantao@loongson.cn>
2023-10-22 13:29:25 -07:00
Radostin Stoyanov
056cac474e zdtm: drop python 2 compatibility
This patch removes the code for Python 2 compatibility introduced
with commit e65c7b5 (zdtm: Replace imp module with importlib).

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-10-22 13:29:25 -07:00
Radostin Stoyanov
d388b91de2 test/others: drop setup_swrk() py2 compatibility
This patch removes the code introduced for compatibility
with Python 2 in commits:

4c1ee3e227045fc1dc07b10ac7a538a68299693b
test/other: Resolve Py3 compatibility issues

6b615ca15277fc14b52a09b4eb18314b7c6cbe75
test/others: Reuse setup_swrk()

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-10-22 13:29:25 -07:00
Radostin Stoyanov
ee9983d4a9 test/criu-ns: drop python 2 compatibility
This patch is replacing the set_blocking() function with
os.set_blocking(). This function was introduced for compatibility with
Python 2 in commit 8094df8di (criu-ns: Add tests for criu-ns script).

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-10-22 13:29:25 -07:00
Radostin Stoyanov
ede018176c make: remove checks for python 2 binary
This commit removes the checks for the Python 2 binary in the makefile
and makes sure that ZDTM tests always use python3. Since support for
Python 2 has been dropped, these checks are no longer needed.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-10-22 13:29:25 -07:00
Radostin Stoyanov
642fd99bfd remove python-future dependency
This commit removes the dependency on the __future__ module, which was
used to enable Python 3 features in Python 2 code. With support for
Python 2 being dropped, it is no longer necessary to maintain backward
compatibility.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-10-22 13:29:25 -07:00
Radostin Stoyanov
f5d06571c5 crit: drop python 2 support
This patch reverts changes introduced with the following commits:

4feb07020dedbf845fc00268d8ca02f4645641cd
crit: enable python2 or python3 based crit

b78c4e071a42ebe34aac82fa0711df07ed375e2b
test: fix crit test and extend it

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-10-22 13:29:25 -07:00
Radostin Stoyanov
7825f4ebfa coredump: drop python 2 support
This patch reverts changes introduced for Python 2 compatibility
in commits:

  1c866db (Add new files for running criu-coredump via python 2 or 3)

  3180d35 (Add support for python3 in criu-coredump).

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-10-22 13:29:25 -07:00
Radostin Stoyanov
05f0535de4 ci: clean up CentOS 7 related tweaks
We have disabled CentOS 7 tests in CI. This patch reverts the
changes introduced in the following commit:

24bc083653f7d2b984653194e921b1ff32292b3b
ci: disable some tests on CentOS 7

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-10-22 13:29:25 -07:00
Michał Mirosław
7bda5e656c zdtm: Update netns purpose comment in zdtm_ct.
With the parasite socket clash now guaranteed not to happen,
the comment becomes obsolete. netns is steel needed though, so
update the comment to point at the requirement.

Change-Id: I3cfb253cd5c53b91b955fcb001530b4aee5129f4
Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
c5142104a2 build: Use make-provided AR for building libzdtmtst.
Make $(AR) used also for libzdtmtst build.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Radostin Stoyanov
304a309aed test/thp_disable: fix lint
The fail() macro provides a new line character at the end of the
message. This patch fixes the following lint check that currently
fails in CI:

$ git --no-pager grep -E '^\s*\<(pr_perror|fail)\>.*\\n"'
test/zdtm/static/thp_disable.c:		fail("prctl(GET_THP_DISABLE) returned unexpected value: %d != 1\n", ret);
test/zdtm/static/thp_disable.c:		fail("Flags changed %lx -> %lx\n", orig_flags, new_flags);
test/zdtm/static/thp_disable.c:		fail("Madvs changed %lx -> %lx\n", orig_madv, new_madv);
test/zdtm/static/thp_disable.c:		fail("post-migration prctl(GET_THP_DISABLE) returned unexpected value: %d != 1\n", ret);
test/zdtm/static/thp_disable.c:		fail("Flags changed %lx -> %lx\n", orig_flags, new_flags);
test/zdtm/static/thp_disable.c:		fail("Madvs changed %lx -> %lx\n", orig_madv, new_madv);

Fixes: #2193

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-10-22 13:29:25 -07:00
Michał Mirosław
d0ac547b3d zdtm: sock_opts00: Improve error messages.
Make it clear that the option numbers are indexes not the option
identifiers ("names"). Also show the value change that prompted test
failure.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
6bc00fcb84 zdtm: Implement test sharding.
Allow to split test suite into predictable sets to parallelize runs on
multiple machines or VMs.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
1fb5c410c8 zdtm: Allow --keep-going for single test.
We don't want test framework to change its behaviour on whether we
run a single or multiple tests in a run. When we shard the test suite
it can result in some shards having a single test to run and
unexpectedly change the test output format.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
ed88e3241c zdtm: Add timeouts for test commands.
Extend ability to limit time taken to all CRIU invocations.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
516fade932 zdtm: Allow overriding /tmp.
Use $TMPDIR for tests_root as the host's /tmp might not have enough
features or space.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
93ad8d40de zdtm: thp_disable: Verify MADV_NOHUGEPAGE before migration
Add a sanity check for THP_DISABLE. This discovered a broken commit
in Google's kernel tree.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
01238d2706 zdtm: thp_disable: Verify prctl(THP_DISABLE) migration
Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Michał Mirosław
a0c78a7902 zdtm: thp_disable: Output a single failure message
While at it, don't carry over stale errno to the fail() message.

Signed-off-by: Michał Mirosław <emmir@google.com>
2023-10-22 13:29:25 -07:00
Dhanuka Warusadura
9c9e8ea3f2 criu-ns: Add tests for criu-ns script
These changes add test implementations for criu-ns script.

Fixes: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
2023-10-22 13:29:25 -07:00
Adrian Reber
df7b897a22 ci: fix new codespell errors
Signed-off-by: Adrian Reber <areber@redhat.com>
2023-10-22 13:29:25 -07:00
Suraj Shirvankar
1c0f8787b2 zdtm: Add tests for ip tos restore
Signed-off-by: Suraj Shirvankar <surajshirvankar@gmail.com>
2023-10-22 13:29:25 -07:00
Michal Clapinski
6c728df1dc zdtm: modify rseq01 to include a thread
Testing only the thread group leader is not enough and can hide bugs.

Signed-off-by: Michal Clapinski <mclapinski@google.com>
2023-04-15 21:17:21 -07:00
Michal Clapinski
9683097f27 zdtm: don't ignore rseq_cs mismatch in rseq01 test
Kernel shouldn't clean up rseq_cs inside a critical section.
If rseq_cs has been cleaned up, it means there is a bug in migration.

Signed-off-by: Michal Clapinski <mclapinski@google.com>
2023-04-15 21:17:21 -07:00
Yuriy Vasiliev
ccc790d540 zdtm/lib: fix cwd path freeing
Fix cwd freeing on error path in get_cwd_check_perm and
on non-error-path in unix_fill_sock_name.

v2: use cleanup_free attribute in unix_fill_sock_name

Signed-off-by: Yuriy Vasiliev <yuriy.vasiliev@virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2023-04-15 21:17:21 -07:00
Pavel Tikhomirov
a0158e6927 zdtm: add MNTNS_ZDTM macro to fix initialization
With this macro we can easily declare struct mntns_zdtm variables with
all lists properly initiallized. Let's use it in mount_complex_sharing
as without it we can have segfault on error path when accessing
uninitialized list pointers.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2023-04-15 21:17:21 -07:00
KKrypt
34e2b02219 Optimized shell code with <'s (instead of cat + |)
This patch optimizes shell code as reading a single file as input using a 'cat' command to a program.

It is considered to be a Useless Use of Cat (UUOC).

It's more efficient to simply use redirection.

However, in some cases, even using the redirection operator '<' seems unnecessary.

Signed-off-by: KKrypt <sankalpacharya1211@gmail.com>
2023-04-15 21:17:21 -07:00
Adrian Reber
1d4777e452 test: add long command-line to coredump test
Signed-off-by: Adrian Reber <areber@redhat.com>
2023-04-15 21:17:21 -07:00
Pavel Tikhomirov
676b4579f9 zdtm/transition/epoll: don't rely on errno in case of zero return
Checking errno in case read succeeded is undefined behaviour.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2023-04-15 21:17:21 -07:00
Radostin Stoyanov
11c71656bd ci: add test for crit info
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2023-04-15 21:17:21 -07:00
Pavel Tikhomirov
4a8c02d636 zdtm: Add tests for IP_PKTINFO and IP_FREEBIND sock options
Just creates ipv4/ipv6 raw/dgram sockets with IP_PKTINFO and IP_FREEBIND
socket options enabled/disabled and checks that these options persist.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2023-04-15 21:17:21 -07:00
Pavel Tikhomirov
fb66727a25 zdtm: add mntns_compare check to mount_complex_sharing
This way we can check that mount tree topology (including sharing
groups) is the same before and after c/r.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2023-04-15 21:17:21 -07:00