2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-26 11:57:52 +00:00

283 Commits

Author SHA1 Message Date
Kirill Kolyshkin
5b158804e8 scripts/build/extract-deb-pkg: fix/improve
Numerous improvement to extract-deb-pkg, in no particular order:

 * Use bash
 * More strict error checking (set -u -o pipefail)
 * Print error message if target dir exists
 * Check number of arguments, provide usage info
 * Separate mirror to a variable for easier changing
 * Use mirrors.kernel.org
 * Use https and check cert with curl
 * Make curl silent
 * Use zgrep instead of gunzip | grep
 * Error out with a message in case more than 1 package was found
 * Do not create a target directory before we need it
 * Fix shellcheck warnings (way too many to mention)
 * ...
 * PROFIT!!!111

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-10-17 08:40:10 +03:00
Kirill Kolyshkin
d23617e95d travis ppc64: use ubuntu zesty
This comes with newer libc headers so we can catch errors earlier.
Also, clang 4.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-10-17 08:40:10 +03:00
Kirill Kolyshkin
7b8ed84cd9 scripts/build/binfmt_misc: fix for ppc64le
Got this error trying to build criu on ppc64le under qemu, after
updating the Dockerfile to use Ubuntu Xenial (rather than Trusty):

> $ rm -rf .ccache; make -C scripts/build ppc64le-clang
>
> ...
>
> Processing triggers for libc-bin (2.24-9ubuntu2.2) ...
> /sbin/ldconfig.real: 1: /sbin/ldconfig.real: Syntax error: "(" unexpected
> /sbin/ldconfig.real: 1: /sbin/ldconfig.real: Syntax error: "(" unexpected
> dpkg: error processing package libc-bin (--configure):
>  subprocess installed post-installation script returned error exit status 2
> ...

Apparently, ldconfig.real binary header differs from others:

root@3c7593d3298d:/# od -x /bin/ls | head -2
0000000 457f 464c 0102 0001 0000 0000 0000 0000
0000020 0002 0015 0001 0000 5680 1000 0000 0000

root@3c7593d3298d:/# od -x /sbin/ldconfig.real | head -2
0000000 457f 464c 0102 0301 0000 0000 0000 0000
0000020 0002 0015 0001 0000 1d58 1000 0000 0000

Amend the mask in binfmt_misc entry to take this into account.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-10-17 08:40:10 +03:00
Kirill Kolyshkin
0b044ecb44 travis arm64: switch to zesty
Let's use Ubuntu 17.04 "Zesty" for ARM-64 bit CI.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-10-17 08:40:10 +03:00
Kirill Kolyshkin
7a4bb5fddf Dockerfile.fedora-asan: don't ignore failures
Same as commit e4000c59a71 ("Dockerfiles: don't ignore make failures").
Seems that Dockerfile.fedora-asan copy/pasted an old version.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-10-17 08:40:10 +03:00
Andrei Vagin
c1e68a947e travis: check docker checkpoint
Install the last version of Docker, start a container and C/R it a few times.
2017-10-05 21:04:21 +03:00
Mike Rapoport
6cc31a7f0b travis: exclude futex and lazy-thp tests from lazy passes
Both test seem to reproduce issue #357 [1] too frequently which make it
really annoying. Temporarily remove them from lazy-pages passes until the
issue is fixed.

[1] https://github.com/xemul/criu/issues/357

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-09-17 03:27:02 +03:00
Mike Rapoport
47b9438628 test/travis: update lazy-pages testing
* drop --keep-going etc from --lazy-pages pass
* add --remote-lazy-pages pass

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-09-16 12:30:20 +03:00
Mike Rapoport
516b779551 travis-test: select tests skipped by lazy-pages pass more carefully
Most of zdtm test should pass with --lazy-pages with kernels newer than
4.11.
Some test excluded for older kernels surprisingly pass even now, mainly
becuase they do not actually stress userfaultfd, which will be fixed in the
upcoming commits :)
The cmdlinenv00 fails even with kernel 4.11 because of a race between uffd
and gup in the case external process reads /proc/<pid>/cmdline before
memory containing the command line is populated.

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-09-16 12:29:43 +03:00
Mike Rapoport
bd39d5edc5 travis: add lazy-pages run
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-09-16 11:47:03 +03:00
Andrew Vagin
f68e5a6b3d criu: always enable the userfaultfd support
Add linux/userfaultfd.h to criu sources. This header is a part
of the kernel API and I see nothing wrong to have in the repo.

Why we want to do this:
* to check that criu works correctly if a kernel doesn't
  support userfaultfd.
* to check compilation of the userfaultfd part in travis-ci.

v2: remove UFFD from FEATURES_LIST

Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Acked-by: Adrian Reber <areber@redhat.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-09-16 09:10:03 +03:00
Adrian Reber
e2268aa39c Try to include userfaultfd with criu (part 1)
This is a first try to include userfaultfd with criu. Right now it
still requires a "normal" checkpoint. After checkpointing the
application it can be restored with the help of userfaultfd.

All restored pages with MAP_ANONYMOUS and MAP_PRIVATE set are marked as
being handled by userfaultfd.

As soon as the process is restored it blocks on the first memory access
and waits for pages being transferred by userfaultfd.

To handle the required pages a new criu command has been added. For a
userfaultfd supported restore the first step is to start the
'lazy-pages' server:

  criu lazy-pages -v4 -D /tmp/3/ --address /tmp/userfault.socket

This is part 1 of the userfaultfd integration which provides the
'lazy-pages' server implementation.

v2:
    * provide option '--lazy-pages' to enable uffd style restore
    * use send_fd()/recv_fd() provided by criu (instead of own
      implementation)
    * do not install the uffd as service_fd
    * use named constants for MAP_ANONYMOUS
    * do not restore memory pages and then later mark them as uffd
      handled
    * remove function find_pages() to search in pages-<id>.img;
      now using criu functions to find the necessary pages;
      for each new page search the pages-<id>.img file is opened
    * only check the UFFDIO_API once
    * trying to protect uffd code by CONFIG_UFFD;
      use make UFFD=1 to compile criu with this patch

v3:
   * renamed the server mode from 'uffd' -> 'lazy-pages'
   * switched client and server roles transferring the UFFD FD
     * the criu part running in lazy-pages server mode is now
       waiting for connections
     * the criu restore process connects to the lazy-pages server
       to pass the UFFD FD
   * before UFFD copying anything else the VDSO pages are copied
     as it fails to copy unused VDSO pages once the process is running.
     this was necessary to be able to copy all pages.
   * if there are no more UFFD messages for 5 seconds the lazy-pages
     server switches in copy mode to copy all remaining pages, which
     have not been requested yet, into the restored process
   * check the UFFDIO_API at the correct place
   * close UFFD FD in the restorer to remove open UFFD FD in the
     restored process

v4:
    * removed unnecessary madvise() calls ; it seemed necessary when
      first running tests with uffd; it actually is not necessary
    * auto-detect if build-system provides linux/userfaultfd.h
      header
    * simplify unix domain socket setup and communication.
    * use --address to specify the location of the used
      unix domain socket

v5:
    * split the userfaultfd patch in multiple smaller patches
    * introduced vma_can_be_lazy() function to check if a page
      can be handled by uffd
    * moved uffd related code from cr-restore.c to uffd.c
    * handle failure to register a memory page of the restored process
      with userfaultfd

v6:
    * get PID of to be restored process from the 'criu restore' process;
      first the PID is transferred and then the UFFD
    * code has been re-ordered to be better prepared for lazy-restore
      from remote host
    * compile test for UFFD availability only once

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-09-16 09:10:02 +03:00
Mike Rapoport
98ac646f86 ppc64le: travis: fixup Ubuntu repositories
The ppc64le docker image has broken /etc/apt/sources.list. A small fixup to
it allows running ppc64le tests.

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-31 00:35:34 +03:00
Michael Holzheu
602a948ddd s390: Enable travis
We have to use "debian.jessie" instead of "ubuntu.xenial" because
qemu-s390x-static can only run z900 instructions and Ubuntu is
built with a more recent architecture level set.

We first enable only gcc because there are still some issues with clang.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-09 18:51:41 +03:00
Dmitry Safonov
871ce841a7 travis/ia32: Remove libc6.i386 dependency
Not needed anymore for CONFIG_COMPAT.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-06-14 09:49:30 +03:00
Dmitry Safonov
37b3e5953b ia32/feature-test: Don't check i686 libraries presence
I was adapting CRIU with ia32 support for building with Koji,
and found that Koji can't build x86_64 packages and have
i686 libs installed.
While at it, I found that i686 libraries requirement is
no longer valid since I've deleted the second parasite.

Drop feature test for i686 libs and put test for gcc.
That will effectively test if gcc can compile 32-bit code
and bug with debian's gcc (#315).

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-06-14 09:48:43 +03:00
Dmitry Safonov
f32ffdef90 nmk: Provide try-asm build check function
I need to add feature test written in assembly to check
if the feature can be compiled.

Add a make function for this purpose.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-06-14 09:48:43 +03:00
Kir Kolyshkin
88699b49f7 travis-tests: set CRIU_PMC_OFF conditionally
We only needed it for kernel 3.19. Apparently, Ubuntu 14.04.5 comes
with a kernel from 16.04 (i.e. 4.4), so we can disable this workaround!

Anyway, just in case, let's do it conditionally.

While at it, slightly improve the comment.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-06-14 01:59:46 +03:00
Kir Kolyshkin
2a6b8e1743 travis-tests: install less packages
asciidoc pulls in a lot of dependencies, most of those are not
needed as we just use it to convert txt to a man page. Adding
--no-install-recommended option to apt-get makes it skip those
additional dependencies. The only needed package is xmlto, so
let's add it explicitly.

This results is some 50 packages being skipped (mostly TeX/LaTeX and
some extra SGML tools), wow!

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-06-14 01:59:44 +03:00
Andrei Vagin
71dcc6e918 travis: check the --empty-ns option
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Looks-good-to: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-05-19 09:17:20 +03:00
Dmitry Safonov
a42ad2f033 build/nmk: rename arm64 => aarch64
Let's keep the same name for 64-bit ARM platform across source.

Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-05-10 04:13:43 +03:00
Dmitry Safonov
057c3f2947 python: specify python2 as .py interpreter
On some distro the default python interpreter is Python 3,
which results in such errors:
>  Running zdtm/static/socket-tcp-closed.hook(--post-start)
>  make[1]: Nothing to be done for default.
>  ./socket-tcp-closed --pidfile=socket-tcp-closed.pid --outfile=socket-tcp-closed.out
>    File "zdtm/static/socket-tcp-closed.hook", line 16
>      except OSError, e:
>                    ^
>  SyntaxError: invalid syntax
>  ######### Test zdtm/static/socket-tcp-closed FAIL at hook --post-start #########
>  Running zdtm/static/socket-tcp-closed.hook(--clean)
>    File "zdtm/static/socket-tcp-closed.hook", line 16
>      except OSError, e:
>                    ^
>  SyntaxError: invalid syntax
>  Traceback (most recent call last):
>    File "zdtm.py", line 1921, in <module>
>      do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
>    File "zdtm.py", line 1388, in do_run_test
>      try_run_hook(t, ["--clean"])
>    File "zdtm.py", line 1053, in try_run_hook
>      raise test_fail_exc("hook " + " ".join(args))
>  __main__.test_fail_exc: <__main__.test_fail_exc instance at 0x76294468>

Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-17 18:35:58 +03:00
Andrei Vagin
70ac7a10cd travis: run tests with asan
v2: Use the devicemapper storage driver for docker containers to
run more tests. AUFS doesn't support file handles, so a few tests
(e.g. inotify00 can't be run).

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-11 09:00:49 +03:00
Kir Kolyshkin
e4000c59a7 Dockerfiles: don't ignore make failures
Commit 299e4b4 ("travis: enable ccache for docker/qemu builds") combined
multiple RUN statements in Dockerfiles into a single one, which is good
for performance (as there is an intermediate cache created after each
statement). Unfortunately, it partially did so by combining statements
with use of semicolons, meaning we are ignoring non-zero exit codes.
As a result, failure from make are ignored and Travis builds are all
green.

To fix, replace all occurences of semicolon with &&.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:12:10 +03:00
Kir Kolyshkin
f62818d9ad compel: no -r for ARM ldflags
Commit d9486bd720 ("arm/pie/build: do not produce relocatable parasite
object") removed -r from LDFLAGS used to compile criu pie. This
functionality somehow never made it to criu-dev, and was also lost
in master then compel was ported to it.

Make it work with compel.

Unfortunately it was not as simple as I initially thought, as -r flag
to ld was built into nmk. This patch removes it, and adds it to all
places that need intermediate linking.

Cc: Dmitry Safonov <dsafonov@virtuozzo.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:12:10 +03:00
Kir Kolyshkin
af572b3cf5 nmk: do not sort lib-y objects
When performing static linking, the order of objects is important
(when the linker finds an undefined reference, it looks forward,
never back). Therefore, sorting objects breaks things.

Required for the next patch.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:12:10 +03:00
Kir Kolyshkin
e3f0c52596 travis: add "make uninstall" test
"make uninstall" is supposed to remove all the files that
"make install" (with the same arguments) have created.
This is a test to check that.

PS ideally, "make uninstall" should also remove any empty directories,
but let's not care about it for now.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:09:34 +03:00
Kir Kolyshkin
7290de5902 travis: enable ccache for docker/qemu builds
As we compile-test non-x86_64 architectures under qemu emulation,
it works pretty slow.
Dmitry Safonov suggested, and Andrey Vagin initially implemented
supporting ccache for such builds. This patch is based heavily
on Andrey's work -- all the bugs added are purely mine though.

Performance results: in an ideal environment (two builds of the same
code, one with cold (empty) ccache, another with the hot one)
I saw compile time improvements of 4x to 5x, and total test run time
improvement up to 2x to 2.5x. In layman terms, the complete test run
that was taking more than 50 minutes now takes about 25!

Notes on handling .ccache directory:

1. Before running docker build, .ccache directory (saved in between
   runs by Travis) is moved to criu source code root, from where it
   is copied by docker together with criu sources.

2. In Dockerfile, .ccache gets moved to /tmp, and CCACHE_DIR
   is set accordingly.

3. After running docker build, .ccache is copied out from docker
   container back to the host (from where it is saved by Travis).

Ccache envorinment notes:

1. CCACHE_NOCOMPRESS is needed because otherwise tons of time is spent
   on compression/decompression (big performance hit under qemu).

2. CCACHE_CPP2 is required with clang, see detailed explanation at
   http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
   The logic of setting CCACHE_CPP2 in Dockerfile is somewhat fancy;
   unfortunately I was not able to come up with a simpler approach.

Misc:

1. Travis runs "ccache -s" after the build is completed. A call to
   "ccache -s" is called to Dockerfile before make, so one can
   compare before/after numbers.

2. make invocations are surrounded by "date" calls so one can get the
   compilation times.

Changes in v2:
 - consolidate Dockerfile statements (ENV, RUN)
 - single object make test is no longer commented out
 - simplify "make mrproper" test

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:09:34 +03:00
Kir Kolyshkin
29f9e6e2f1 travis: enable ccache for local builds
For now, it's done for local builds only (i.e. no per-arch Docker
builds yet). The reason is, it's easier to play with ccache when
the compiles are (relatively) fast.

Performance: there is 2x to 3x improvement in build speeds for
ideal cases (same code, hot cache), but the absolute savings
are negligible (example: 7 seconds instead of 23).

Note that ccache is not compatible with gcov, so we only enable it
for non-gcov build (which happens to be the one with clang).

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:09:34 +03:00
Kir Kolyshkin
c903ddfcf1 scripts/build/Makefile: fix
Unify alpine and non-alpine builds. The only difference is foreign
arch builds need some preparation -- separate that to a dependency.

Unfortunately we can't use wildcard targets ("%: ") as non-wildcard
ones are prevaling. Therefore, a somewhat ugly hack to generate
$arch: Dockerfile.$arch dependency is added.

While at it:
 - rename DB_ARGS to DB_CC
 - mark clean as phony
 - make "all" really run all the builds we can

Nice side effect: autocompletion ("make -C scripts/build <TAB>")
now works!

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:09:34 +03:00
Kir Kolyshkin
6866fd2e24 travis: fix clang builds
As pointed out by Andrey, arch clang tests are using gcc regardless
of CLANG=1 set in travis environment.

Frankly, I do not understand how it worked before (while being
pretty sure it worked!), but here is a way to fix it.

Reported-by: Andrey Vagin <avagin@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:09:34 +03:00
Kir Kolyshkin
15a757f6be Makefiles: remove @true
Apparently @true was used as a rule for any target which should have
a non-empty rule doing nothing. For this, there's a "<target>: ;"
syntax, let's use this and eliminate an unnecessary fork/exec :)

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:08 +03:00
Andrey Ryabinin
abec5dabe3 Makefile: Introduce per-file CFLAGS removal.
This adds the reverse of CFLAGS_obj.o with CFLAGS_REMOVE_obj.o.
This allows to prevent certain CFLAGS from being used to
compile files.

travis-ci: success for series starting with [1/6] compel/infect: fix out-of-bounds parasite memcpy()
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-03-15 09:36:04 +03:00
Kir Kolyshkin
9d6228630b compel hgen: use for ARM, kill gen-offsets.sh
I am not quite sure how that happened, but compel hgen was not used for
ARM/ARM64, instead there's a simple version of it, called
gen-offsets.sh. The main difference is, shell script doesn't handle ELF
relocations, which apparently is not (currently?) needed for ARM.

It's bad to maintain two tools for the same functionality, so this
patch kills gen-offsets.sh and related stuff, making compel hgen
working on ARM. ELF relocations are still not handled, this code
is #ifdef-ed out for now and can be fixed to work on ARM later.

This patch also kills some macros and defines that seem obsoleted
now. For example, compel_relocs_apply() is now called unconditionally,
as it handles the trivial case of 0 relocs just fine.

Now, I checked that the blob headers generated by compel hgen and
gen-offsets.h are similar (i.e. generated blob code and values defined
are the same), but haven't done much above that.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:17 +03:00
Kir Kolyshkin
8ea542f78e compel: simplify usage wrt ids
Currently, some compel internals are exposed to user API
(both C and CLI), making its usage more complicated than
it can be.

In particular, compel user have to specify a number of parameters
(names for various data) on the command line, and when in C code
assign a struc piegen_opt_t fields using the same names, without
using those identifiers anywhere else in the code.

It makes sense to hide this complexity from a user, which is what
this commit does.

First, remove the ability to specify individual names for data,
instead introducing a prefix that is prepended to all the names.
Second, generate a function %PREFIX%_setup_c_header() which does
all the needed assignments.
Third, convert users (criu/pie and compel test) to the new API.

NOTE that this patch breaks ARM, as compel hgen is not used for ARM.
This is to be fixed by a later patch in the series.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:16 +03:00
Cyrill Gorcunov
84175119d1 compel: travis -- Disable exec tests
Not supported for a while.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-14 23:58:20 +03:00
Cyrill Gorcunov
11282c6084 compel: test -- Disable compel tests for a while
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-14 23:58:10 +03:00
Dmitry Safonov
31d394bc55 feature-test: add CONFIG_COMPAT compile option
I'll wrap all compatible code in this CONFIG_COMPAT define.
As I'll wrap also compatible parasite generation in this,
it's also makefile variable, rather than just C define.
The test itself consists of including stubs-32.h, which is
glibc6-i686 presence test and is compiled with -m32 option,
which is test for gcc-multilib.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-14 23:58:08 +03:00
Dmitry Safonov
1fff6d8a0c travis-ci: run compel tests on build stage
It took a little time on travis (I didn't measure, just starred
at build and it added not visible delay for build).
But it will help to verify that compel works on all supported arches.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-14 21:03:30 +03:00
Dmitry Safonov
d771ffb942 Dockerfile: add libc6-dev-i386 & gcc-multilib
Fixes the following error on travis-ci:
  CC       arch/x86/syscalls/syscall32.o
In file included from /usr/include/signal.h:28:0,
                 from /home/travis/build/0x7f454c46/criu/criu/arch/x86/include/asm/types.h:5,
                 from arch/x86/syscalls/syscall32.c:1:
/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory
 #  include <sys/cdefs.h>
                         ^

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-14 21:03:20 +03:00
Kir Kolyshkin
d5df3bf2ac nmk: return --no-print-directory
A year ago this flag was removed, as parts of criu were build in
sub-directories (i.e. by using make -C SUBDIR), and therefore
paths printed by make were relevant to a SUBDIR rather than top
source dir, which prevented tools like vim from jumping to a
correct source file with with error (for more details, see
commit XXXXXX "nmk: remove no-print-directory from MAKEFLAGS").

Now, as we have everything (except Documentation and test, which
is rather minor) built from top source directory, we can finally
add the flag back and enjoy cleaner output.

Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-06 20:44:08 +03:00
Kir Kolyshkin
2a9d9c6615 lib Makefiles: integrate
Our whole system of Makefiles are integrated from top to bottom,
meaning:

 1. The paths in sub-makefiles are relative to the top source dir.
 2. Sub-makefiles are executed via make $(build)=<SUBDIR> <TARGET>

For some reason, makefiles under lib/ are the exclusion. Let's fix it.

Side effect: you can now build any individual target under lib/,
for example, "make lib/c/libcriu.so" works.

[v2: use the .FORCE, thanks to dsafonov@]

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-06 20:44:07 +03:00
Stanislav Kinsburskiy
56662c4ab2 systemd-autofs-restart.sh: fix issue with removed check_fs_type reference
"Check_fs_type" helper was repalce by "get_fs_type".
This reference is a silly mistake.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-06 11:44:05 +03:00
Kir Kolyshkin
1510b24868 nmk: clean gcov files, too
When criu is compiled with GCOV=1, .gc* files created are never
cleaned. While 'git clean -dxf' does the job and is popular
among the criu devs, it still feels good to have good ol'
make clean doing the right thing.

Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-02 00:19:03 +03:00
Andrei Vagin
0ecd9c2b28 travis: execute tests on Alpine
"zdtm.py run -a" doesn't work on Alpine:
find: unrecognized: -executable

So run zdtm/static/env00 for now to be sure that
it is not broken at all.

travis-ci: success for travis: execute tests on Alpine
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-03-02 00:19:03 +03:00
Andrei Vagin
46caa25a1a dockerfile: use a newer version of Alpine
We see the "No space left on device" error on the current version,
so let's try to use a newer version of Alpine, maybe this error
has been fixed there.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-02 00:19:02 +03:00
Andrei Vagin
dc20252049 travis: fix collecting code coverage
The problem is in the chroot test:
geninfo: ERROR: /home/travis/build/xemul/criu/test/zdtm/static/chroot.dir.test/home/travis/build/xemul/criu/images/timer.gcno: could not open file

We can just ignore these errors.

travis-ci: success for travis: fix collecting code coverage
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Kir Kolyshkin
0367a1f6fe Drop prefix from own memcpy/memset/memcmp
C compiler might generate calls to memcpy, memset, memcmp, and memmove
as it seem fit (so far we haven't seen memmove being required). That
means we need to provide our own versions of it for code which is not
linked to a libc.

We already have a solution for that in commit bdf6051
("pie: provide memcpy/memcmp/memset for noglibc case")
but we faced another problem of compiler trying to optimize
our builtin_memset() by inserting calls to memset() which
is just an alias in our case and so it lead to infinite recursion.
This was workarounded in commit 8ea0ba7 ("string.h: fix memset
over-optimization with clang") but it's not clear that was a proper
fix.

This patch is considered to be the real solution. As we don't have
any other implementations of memset/memcpy/memcmp in non-libc case,
we can call ours without any prefixes and avoid using weak aliases.

Implementation notes:

1. mem*() functions code had to be moved from .h to .c for the functions
to be compatible with their prototypes declared in /usr/include/string.h
(i.e. "extern").

2. FORTIFY_SOURCE needed to be disabled for code not linked to libc,
because otherwise memcpy() may be replaced with a macro that expands
to __memcpy_chk() which of course can't be resolved during linking.

https://travis-ci.org/kolyshkin/criu/builds/198415449
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 13:29:54 +03:00
Dmitry Safonov
5abbb79124 nmk: recompile/regenerate on Makefile changes
Now changes in top-Makefile, middle-Makefile will result in a correct
recompiling, as it's expected:
  [criu]$ touch criu/Makefile
  [criu]$ make
  <...>
    DEP      criu/arch/x86/sigframe.d
    DEP      criu/arch/x86/sigaction_compat.d
    DEP      criu/arch/x86/crtools.d
    DEP      criu/arch/x86/cpu.d
    DEP      criu/arch/x86/call32.d
    CC       criu/arch/x86/call32.o
    CC       criu/arch/x86/cpu.o
    CC       criu/arch/x86/crtools.o
  <...>

travis-ci: success for Fix rebuild on Makefile changes
Reported-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-03 18:04:23 +03:00
Andrei Vagin
1a89b88c08 zdtm: check sequence numbers for tcp sockets
They have to be the same on each iteration.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00