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

10636 Commits

Author SHA1 Message Date
Adrian Reber
bb5bad5326 test: move vt test to minor 65 on s390x
Our Jenkins s390x vt test fails with

./vt --pidfile=vt.pid --outfile=vt.out --filename=vt.test
make: *** [Makefile:432: vt.pid] Error 1
 Test zdtm/static/vt FAIL at ['make', '--no-print-directory', '-C', 'zdtm/static', 'vt.pid']
Test output: ================================
08:08:15.556:    54: ERR: vt.c:38: Open virtual terminal vt.test failed (errno = 6 (No such device or address))
08:08:15.556:    53: ERR: test.c:316: Test exited unexpectedly with code 1

Because the host has no ttyS0 as used previously. This changes the test
to use 'ttysclp0'. That seems to exist on multiple s390x we checked.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Dmitry Safonov
c66ca3aa23 zdtm/fpu03: Add .desc file to omit running on !x86
I managed to forget .desc file and ppc on Jenkins now fails with:

> === Run 177/394 =======--------- zdtm/static/fpu03
> timens isn't supported on 5.8.18-100.fc31.ppc64le
> ========================== Run zdtm/static/fpu03 in h ==========================
> Start test
> ./fpu03 --pidfile=fpu03.pid --outfile=fpu03.out
> make: *** [Makefile:430: fpu03.pid] Error 1
>  Test zdtm/static/fpu03 FAIL at ['make', '--no-print-directory', '-C', 'zdtm/static', 'fpu03.pid']
> Test output: ================================
> 08:56:48.325:    56: SKIP: fpu03.c:116: Unsupported arch
> 08:56:48.325:    55: ERR: test.c:316: Test exited unexpectedly with code 0
>
>  <<< ================================

Signed-off-by: Dmitry Safonov <dima@arista.com>
2021-09-03 10:31:00 -07:00
Dmitry Safonov
a87c61fe8e Revert "compel: add -ffreestanding to force gcc not to use builtin memcpy, memset"
This reverts commit c98af78c58.

Now FPU/SSE/MMX/etc can be used inside parasite.
Let's have compiler optimizations back.

Cc: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
2021-09-03 10:31:00 -07:00
Dmitry Safonov
1bac3a64b9 s390: Purge stale comment
Signed-off-by: Dmitry Safonov <dima@arista.com>
2021-09-03 10:31:00 -07:00
Dmitry Safonov
39b7252c6f fault-injection: Run fpu corruption tests
For the thread leader and for subthreads too.

Signed-off-by: Dmitry Safonov <dima@arista.com>
2021-09-03 10:31:00 -07:00
Dmitry Safonov
21e3c53073 compel: Provide compel_set_task_ext_regs()
Arch-dependend way to restore extended registers set.
Use it straight-away to restore per-thread registers.

Signed-off-by: Dmitry Safonov <dima@arista.com>
2021-09-03 10:31:00 -07:00
Dmitry Safonov
3613b6f15f compel: Store extended registers set in the thread context
Extended registers set for task is restored with rt_sigreturn() through
prepared sigframe. For threads it's currently lost.
Preserve it inside thread context to restore on thread curing.

Signed-off-by: Dmitry Safonov <dima@arista.com>
2021-09-03 10:31:00 -07:00
Dmitry Safonov
7af06af10d zdtm/fpu03: Add a test to check fpu C/R in a thread
CRIU dumps main thread and sub-threads differently, so there needed
a test to check if fpu is preserved across C/R in sub-threads.

Signed-off-by: Dmitry Safonov <dima@arista.com>
2021-09-03 10:31:00 -07:00
Dmitry Safonov
6c879c3c83 zdtm/fpu00: Simplify ifdeffery
..to introduce a new one! ;-D

Signed-off-by: Dmitry Safonov <dima@arista.com>
2021-09-03 10:31:00 -07:00
Dmitry Safonov
e2e8be37f2 x86/compel/fault-inject: Add a fault-injection for corrupting extended regset
With pseudo-random garbage, the seed is printed with pr_err().
get_task_regs() is called during seizing the task and also for each
thread.
At this moment only for x86.

Signed-off-by: Dmitry Safonov <dima@arista.com>
2021-09-03 10:31:00 -07:00
Pavel Tikhomirov
327e14933d namespaces: properly handle errors of snprintf
If snprintf was truncated we should probably know about it instead of
continuing to increase off, as snprintf returns number of characters
which would have been written and not the number which was actually
written.

Normally we check snprintf only for overflow not for error, some modern
compilers print warnings if truncation was not checked.

Probably it was the case why we implemented [1], the truncation happened
and on the next iteration of for loop we've hit negative size for
snprintf and got -1.

Fixes: 90f043dea ("namespaces: handle errors of snprintf") [1]
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2021-09-03 10:31:00 -07:00
Dmitry Safonov
ffb848e6d9 x86: Use PTRACE_GET_THREAD_AREA instead of sys_get_thread_area()
To minimize things done in parasite, PTRACE_GET_THREAD_AREA can be
used to get remote tls. That also removes an additional compat stack
(de)allocation in the parasite (also asm-coded syscall).

In order to use PTRACE_GET_THREAD_AREA, the dumpee should be stopped.
So, let's move this from criu to compel to non-seized state and put tls
into thread info on x86.

Signed-off-by: Dmitry Safonov <dima@arista.com>
2021-09-03 10:31:00 -07:00
Dmitry Safonov
72dc328502 ci/compat: Check if tests are 32-bit ELFs
To be sure that we don't lose COMPAT_TEST=y on the way to make.

Signed-off-by: Dmitry Safonov <dima@arista.com>
2021-09-03 10:31:00 -07:00
Andrei Vagin
10fe08c37f github/stale: separate labels with commas without following spaces
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
ff38944b98 ci: fix Fedora rawhide CI failures
It seems the Fedora rawhide /tmp is no longer 1777 but 755.

Change it back to 1777 to make our CI runs successful again.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Pavel Tikhomirov
79b3893ecf plugin: check for plugin path truncation
New compilators print warnings if snprintf return value is not checked
for truncation. Let's make them happy.

Fixes: #1372
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2021-09-03 10:31:00 -07:00
Andrei Vagin
8782235600 sk-unix: check whether a socket name is NULL before printing it
criu/include/log.h:72:2: error: '%s' directive argument is null [-Werror=format-overflow=]
   72 |  print_on_level(LOG_DEBUG,     \
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |          LOG_PREFIX fmt, ##__VA_ARGS__)
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
criu/sk-unix.c:133:2: note: in expansion of macro 'pr_debug'
  133 |  pr_debug("\t%s: ino %u peer_ino %u family %4d type %4d state %2d name %s\n",
      |  ^~~~~~~~
  CC       criu/stats.o

Fixes: #1373
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2021-09-03 10:31:00 -07:00
Andrei Vagin
9582a44ce1 bug: add __builtin_unreachable in BUG_ON_HANDLER
This will surpress false gcc warnings like this:
criu/stats.c:85:10: error: array subscript 4 is above array bounds
of 'struct timing[2]' [-Werror=array-bounds]
   85 |   return &rstats->timings[t];
      |          ^~~~~~~~~~~~~~~~~~~
criu/stats.c:25:16: note: while referencing 'timings'
   25 |  struct timing timings[RESTORE_TIME_NS_STATS];
      |                ^~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
4eb43dc4de test: fix test compilation on rawhide
The latest glibc has redefined SIGSTKSZ as 'sysconf (_SC_SIGSTKSZ)' and
this breaks a static char[] definition.

Hardcoding TESTSIGSTKSZ to 16384 in the test. This fixes:

 sigaltstack.c:17:13: error: variably modified 'stack_thread' at file scope
   17 | static char stack_thread[SIGSTKSZ + TEST_MSG_BUFFER_SIZE] __stack_aligned__;
      |             ^~~~~~~~~~~~
sigaltstack.c:18:13: error: variably modified 'stack_main' at file scope
   18 | static char stack_main[SIGSTKSZ + TEST_MSG_BUFFER_SIZE] __stack_aligned__;
      |             ^~~~~~~~~~

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Radostin Stoyanov
6f8e671351 zdtm: Add javaTests output to .gitignore
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-09-03 10:31:00 -07:00
Radostin Stoyanov
7b3eb03ab2 test: Reduce verbosity of mvn output
The -q option will only show errors

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-09-03 10:31:00 -07:00
Radostin Stoyanov
ae143161b8 javaTests: Add --file-locks option
Resolves #1370

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-09-03 10:31:00 -07:00
Radostin Stoyanov
56d7dbd7cd file-lock: Add space in error message
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-09-03 10:31:00 -07:00
Adrian Reber
950805bf16 ci: use runc instead of crun for podman tests
The latest podman pulls in crun instead of runc. Unfortunately crun is
not built against libcriu and does not support checkpoint/restore.

Switch back to runc.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Nicolas Viennot
719e42fe1c seccomp: initialize seccomp_mode in all cases
In parse_pid_status(), it is assumed that the seccomp field can be
missing from /proc/pid/status. When the field is missing, it is not
properly initialized, leading to bad behavior.

We initialize seccomp_mode to SECCOMP_MODE_DISABLED by default,
similarly to what is done in compel/src/lib/infect.c:parse_pid_status.

Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
2021-09-03 10:31:00 -07:00
Andrey Zhadchenko
2dc65a6360 zdtm: add second fifo_upon_unix test
This differs from the previous one by
1. using relative path instead of absolute
2. chdir() after setup

Reviewed-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
2021-09-03 10:31:00 -07:00
Andrey Zhadchenko
1f2e10771a zdtm: add fifo upon unix socket test case
Create unix socket and unlink it. Make fifo in this place.

Reviewed-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
2021-09-03 10:31:00 -07:00
Andrey Zhadchenko
7c5c813661 sk-unix: rework unix_resolve_name
Use SIOCUNIXFILE ioctl approach to get socket fd opened with O_PATH. Utilise it
for detecting deletion and resolving relative name. Preserve old method as
fallback if this new IOCTL fails.

Also remove overmount_sock crfail in zdtm. With the unix_resolve_name
reworked to use SIOCUNIXFILE criu can now pass this test.

Reviewed-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
2021-09-03 10:31:00 -07:00
Andrey Zhadchenko
d0308e5ecc sk-unix: make criu respect existing files while restoring ghost unix socket fd
If there are any file in place of ghost unix socket, criu will delete it at
restore while trying to recreate ghost one.

Reviewed-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
2021-09-03 10:31:00 -07:00
Andrey Zhadchenko
49889baa20 files-reg: rework strip_deleted
Moved strip_deleted to util and reworked it so other parts of criu can use
it without the need of files-reg.h

Reviewed-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
2021-09-03 10:31:00 -07:00
Andrey Zhadchenko
129cc7fbc4 files: Don't forget on stripping deleted postfix on linked files
Otherwise we gonna accumulated "(deleted)" postfix generated by
kernel on every c/r iteration eventually overflowing PATH_MAX
which will make container undumpable.

Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
3a4bffc143 ci: move coverage run to github
This also connects the coverage run to codecov.io.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Andrei Vagin
6be56e92c8 test/zdtm: check that locks are not dumped if --file-locks isn't set
If criu finds a file lock and the --file-locks option isn't set, it
stops dumping processes, resumes them and exits with an error.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2021-09-03 10:31:00 -07:00
Andrei Vagin
7b5e7166ec dump: dump has to fail if there is locks and --file-locks isn't set
If criu finds a file lock and the --file-locks option isn't set, it
stops dumping processes, resumes them and exits with an error.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
37c09f8904 ci: move compat tests to Github Actions
Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
246c37ad3a README.md: remove unused badges; add a few new badges
Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
fad9f805cf README.md: remove trailing whitespaces
Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
67ce4e46c0 ci: move asan and image streamer test to github
Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
anatasluo
f983a55e68 vdso: fix segmentation fault caused by char pointer array
When I compile criu with "make DEBUG=1" and run it to restore my
program, it produces a segmentation fault.

In aarch64, with compile flag "-O0", when criu executes the code in pie,
it is unable to visit the content of ARCH_VDSO_SYMBOLS. So I put these
variables into the stack.

Signed-off-by: anatasluo <luolongjuna@gmail.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
909ce55d8c Tell podman to use vfs as storage-driver
Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
f4c5937cac ci: move Fedora Rawhide based tests away from Travis
This moves Fedora Rawhide based tests away from Travis. To Github
Actions for x86_64 and to Drone for aarch64.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
ed7cefe217 ci: factor out Fedora Rawhide CI setup
To run Fedora Rawhide based aarch64 containers on Drone CI our current
Dockerfile setup does not work.

This moves the package installation out of the Dockerfile into
scripts/ci/prepare-for-fedora-rawhide.sh to be usable in the Dockerfile
environment and in the Drone CI environment.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
95c4a8b400 ci: skip bpf tests on vagrant
See: https://github.com/checkpoint-restore/criu/issues/1354

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
bb2078f368 ci: upgrade vagrant and Fedora version
The updates to the latest Vagrant version and from Fedora 32 to 33.

Also using --no-tty instead of > /dev/null for vagrant up.

Also run 'dnf upgrade -y' in out vagrant VM to get the latest kernel.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
da2c83d871 ci: fix syntax error in stale.yml
The commas need to be inside of the quotes. Not on the outside.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Andrei Vagin
fc5ba7de72 zdtm: handle a case when a test vma is merged with another one
Fixes: #1346
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2021-09-03 10:31:00 -07:00
Andrei Vagin
d74353d771 util: zero the events pointer to avoid its double free
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2021-09-03 10:31:00 -07:00
Andrei Vagin
540141c7c5 namespaces: handle errors of snprintf
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
b83a1dd956 ci: also use clang for compel-host-bin
Running in an environment with clang and without gcc even installed
does not work as compel-host-bin uses HOSTCC which defaults to gcc.

If CLANG=1 is set this also sets HOSTCC to clang to actually build
compel-host-bin with clang and not with gcc.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Adrian Reber
baad84efb2 ci: run aarch64 compile tests on Drone
Besides Travis CI Drone CI seems to be only service providing ARM based
builds. This switches the aarch64 and arm32 builds to drone.io.

Because Drone CI is running in a Docker container we cannot use 'setarch
linux32' as it requires the blocked syscall 'personality(2)'.

But Drone CI provides an 'arch: arm' which gives the same architecture
as 'setarch linux32' on Travis aarch64: armv8l

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00