Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[draft] support of bindmounted unix dgram sockets #1001

Draft
wants to merge 277 commits into
base: criu-dev
Choose a base branch
from
This pull request is big! We’re only showing the most recent 250 commits.

Commits on Jan 24, 2020

  1. remote: Remove unused constants

    Drop the constants for default cache host/port and page size because
    they are not used anywhere.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    36b628b View commit details
    Browse the repository at this point in the history
  2. crtools: Fix typo

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    1a8c654 View commit details
    Browse the repository at this point in the history
  3. criu: fix leaks detected by coverity scan

    1) fix sfle memory leak on get_fle_for_scm error
    2) fix gfd open descriptor leak on get_fle_for_scm error
    3-6) fix buf memory leak on read and pwrite errors
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Snorch authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    be22689 View commit details
    Browse the repository at this point in the history
  4. test: make zdtm.py python2/python3 compatible

    Cc: Adrian Reber <areber@redhat.com>
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    91babe7 View commit details
    Browse the repository at this point in the history
  5. crtools: image-{cache, proxy} requires address/port

    Show error message when image-{cache,proxy} is called without --port
    and image-proxy without --address argument.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    2df652d View commit details
    Browse the repository at this point in the history
  6. criu: fix gcc-8 warnings

    criu/sk-packet.c:443:3: error: 'strncpy' output may be truncated
    copying 14 bytes from a string of length 15
       strncpy(addr_spkt.sa_data, req.ifr_name, sa_data_size);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    criu/img-remote.c:383:3: error: 'strncpy' specified bound 4096
    equals destination size
       strncpy(snapshot_id, li->snapshot_id, PATHLEN);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    criu/img-remote.c:384:3: error: 'strncpy' specified bound 4096
    equals destination size
       strncpy(path, li->name, PATHLEN);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    criu/files.c:288:3: error: 'strncpy' output may be truncated copying
    4095 bytes from a string of length 4096
       strncpy(buf, link->name, PATH_MAX - 1);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    criu/sk-unix.c:239:36: error: '/' directive output may be truncated
    writing 1 byte into a region of size between 0 and 4095
       snprintf(path, sizeof(path), ".%s/%s", dir, sk->name);
                                        ^
    criu/sk-unix.c:239:3: note: 'snprintf' output 3 or more bytes
    (assuming 4098) into a destination of size 4096
       snprintf(path, sizeof(path), ".%s/%s", dir, sk->name);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    criu/mount.c:2563:3: error: 'strncpy' specified bound 4096 equals
    destination size
       strncpy(path, m->mountpoint, PATH_MAX);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    criu/cr-restore.c:3647:2: error: 'strncpy' specified bound 16 equals
    destination size
      strncpy(task_args->comm, core->tc->comm, sizeof(task_args->comm));
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    62c6539 View commit details
    Browse the repository at this point in the history
  7. remote: don't read from pointer after free

    CID 190778 (checkpoint-restore#1 of 1): Read from pointer after free (USE_AFTER_FREE)
    7. deref_after_free: Dereferencing freed pointer rop.
    
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    f2054ba View commit details
    Browse the repository at this point in the history
  8. img-proxy: Remove duplicated include

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    d170cca View commit details
    Browse the repository at this point in the history
  9. remote: Merge check_pending_{reads,forwards}

    Both functions check_pending_forwards() and check_pending_reads()
    have very similar functionality. This patch aims to reduce the
    duplication of code by merging both functions into check_pending()
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    383da03 View commit details
    Browse the repository at this point in the history
  10. remote: Replace PATHLEN with PATH_MAX

    The macro PATHLEN is redundant. It is defined such that its replacement
    token sequence is the token PATH_MAX.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Acked-by: Adrian Reber <areber@redhat.com>
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    69ed736 View commit details
    Browse the repository at this point in the history
  11. remote: Refactor TCP server setup

    The function `setup_TCP_server_socket` (defined in img-remote.c) and
    `setup_tcp_server` (defined in util.c) have very similar functionality.
    
    Replace setup_TCP_server_socket() with setup_tcp_server() to reduce
    code duplication and to enable IPv6 support for the image-cache action
    of CRIU.
    
    We set SO_REUSEADDR flag to allow reuse of local addresses.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    68d4924 View commit details
    Browse the repository at this point in the history
  12. remote: Refactor TCP client setup

    Remove setup_TCP_client_socket() and use setup_tcp_server() instead as
    both functions have very similar functionality.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    a713c2c View commit details
    Browse the repository at this point in the history
  13. remote: pull_snapshot_ids: Simplify if condition

    Check only once if (sockfd < 0)
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    b99a274 View commit details
    Browse the repository at this point in the history
  14. remote: Use tmp file buffer when restore ip dump

    When CRIU calls the ip tool on restore, it passes the fd of remote
    socket by replacing the STDIN before execvp. The stdin is used by the
    ip tool to receive input. However, the ip tool calls ftell(stdin)
    which fails with "Illegal seek" since UNIX sockets do not support file
    positioning operations. To resolve this issue, read the received
    content from the UNIX socket and store it into temporary file, then
    replace STDIN with the fd of this tmp file.
    
     # python test/zdtm.py run -t zdtm/static/env00 --remote -f ns
     === Run 1/1 ================ zdtm/static/env00
    
     ========================= Run zdtm/static/env00 in ns ==========================
     Start test
     ./env00 --pidfile=env00.pid --outfile=env00.out --envname=ENV_00_TEST
     Adding image cache
     Adding image proxy
     Run criu dump
     Run criu restore
     =[log]=> dump/zdtm/static/env00/31/1/restore.log
     ------------------------ grep Error ------------------------
     RTNETLINK answers: File exists
     (00.229895)      1: do_open_remote_image RDONLY path=route-9.img snapshot_id=dump/zdtm/static/env00/31/1
     (00.230316)      1: 	Running ip route restore
     Failed to restore: ftell: Illegal seek
     (00.232757)      1: Error (criu/util.c:712): exited, status=255
     (00.232777)      1: Error (criu/net.c:1479): IP tool failed on route restore
     (00.232803)      1: Error (criu/net.c:2153): Can't create net_ns
     (00.255091) Error (criu/cr-restore.c:1177): 105 killed by signal 9: Killed
     (00.255307) Error (criu/mount.c:2960): mnt: Can't remove the directory /tmp/.criu.mntns.dTd7ak: No such file or directory
     (00.255339) Error (criu/cr-restore.c:2119): Restoring FAILED.
     ------------------------ ERROR OVER ------------------------
     ################# Test zdtm/static/env00 FAIL at CRIU restore ##################
     ##################################### FAIL #####################################
    
    Fixes checkpoint-restore#311
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    3b9babc View commit details
    Browse the repository at this point in the history
  15. python: Replace xrange with range

    In Py2 `range` returns a list and `xrange` creates a sequence object
    that evaluates lazily. In Py3 `range` is equivalent to `xrange` in Py2.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    ae5a850 View commit details
    Browse the repository at this point in the history
  16. image: fix typo in debug message

    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    Snorch authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    2fffe9c View commit details
    Browse the repository at this point in the history
  17. py: Reformat everything into pep8 style

    As discussed on the mailing list, current .py files formatting does not
    conform to the world standard, so we should better reformat it. For this
    the yapf tool is used. The command I used was
    
    yapf -i $(find -name *.py)
    
    Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
    xemul authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    85f1a3e View commit details
    Browse the repository at this point in the history
  18. Fix typos

    Most of the typos were found by codespell.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    0dbf262 View commit details
    Browse the repository at this point in the history
  19. remote: Fix code indentation

    This patch does not introduce any functional changes.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    88c337e View commit details
    Browse the repository at this point in the history
  20. img-cache: Drop unnecessary accept_proxy_to_cache

    The function accept_proxy_to_cache() is a wrapper around accept().
    Use accept() directly instead.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    96a823e View commit details
    Browse the repository at this point in the history
  21. img-cache/proxy: Close sockets on failure

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    66f2f31 View commit details
    Browse the repository at this point in the history
  22. remote: Drop unused PB_LOCAL_IMAGE_SIZE

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    d2c44c3 View commit details
    Browse the repository at this point in the history
  23. remote: Introduce strflags() macro

    Reduce code duplication by introducing a strflags() macro which maps
    a flag to corresponding string.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    a539277 View commit details
    Browse the repository at this point in the history
  24. remote: Fix stringop-truncation warning

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    7223ac7 View commit details
    Browse the repository at this point in the history
  25. remote: Fix 'flags' maybe uninitialized warning

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    0a58954 View commit details
    Browse the repository at this point in the history
  26. remote: Make private functions static

    This patch makes various private variables and procedures static.
    
    These changes conform to the following code style conventions:
    
     When declaring pointer data or a function that returns a pointer type,
     the preferred use of ``*`` is adjacent to the data name or function
     name and not adjacent to the type name.
    
     Statements longer than 80 columns will be broken into sensible chunks,
     unless exceeding 80 columns significantly increases readability and
     does not hide information. Descendants are always substantially
     shorter than the parent and are placed substantially to the right.
     The same applies to function headers with a long argument list.
    
    from https://www.kernel.org/doc/Documentation/process/coding-style.rst
    
    The function declarations {send,recv}_image() from img-remote.h are
    removed because they do not have a corresponding implementation.
    
    The following functions are made static because they are not used
    outside img-remote.c:
    * {send,recv}_image_async()
    * {read,write}_remote_header()
    * socket_set_non_blocking()
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    3058b3f View commit details
    Browse the repository at this point in the history
  27. remote: Use xmalloc/xzalloc/xfree

    There is no need to print an error message, __xalloc() does that.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    d2d254c View commit details
    Browse the repository at this point in the history
  28. remote: Ignore interupt signals

    When an interrupt signal (even SIGWINCH when strace is used) is
    received while epoll_wait() sleeps, it will return a value of
    -1 and set errno to EINTR, which is not an error and should be
    ignored.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    7f63b26 View commit details
    Browse the repository at this point in the history
  29. util: Don't pass address/port as arguments

    There is no need to pass the values for address and port as arguments
    when creating a TCP server. The external `opts` object, which provides
    opts.addr and opts.port, is accessible in all components that require
    these values.
    
    With this change, a value specified with the `--address` option will
    used by image-cache in the same way as with page-server.
    
    Example:
    criu image-cache --address 127.0.0.1 --port 1234
    criu page-server --address 127.0.0.1 --port 1234
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    f428d30 View commit details
    Browse the repository at this point in the history
  30. remote: Rename 'proxy_to_cache_fd' to 'remote_sk'

    The variable name 'remote_sk' is shorter than 'proxy_to_cache_fd' and
    it is more similar to 'page_server_sk' (used in criu/page-xfer.c).
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    a37a02d View commit details
    Browse the repository at this point in the history
  31. remote: Rename 'local_req_fd' to 'local_sk'

    The name 'local_sk' is shorter than 'local_req_fd', and it is more
    similar to the name 'page_server_sk' used in criu/page-xfer.c
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    c64f657 View commit details
    Browse the repository at this point in the history
  32. util: Fix addr casting for IPv4/IPv6 in autobind

    When saddr.ss_family is AF_INET6 we should cast &saddr to
    (struct sockaddr_in6 *).
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    75dead1 View commit details
    Browse the repository at this point in the history
  33. util: Introduce fd_set_nonblocking()

    Combine the functionality of socket_set_non_blocking() and
    socket_set_blocking() into a new function, and move it in
    criu/util.c to enable reusability throughout the code base.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    2f665d8 View commit details
    Browse the repository at this point in the history
  34. remote: Use \0 as indicator for a "finish" msg

    Combine the macro constants DUMP_FINISH and RESTORE_FINISH, into
    a single one, called FINISH.
    
    In addition, replace the key-word strings used by the above-mentioned
    constants, and NULL_SNAPSHOT_ID, with a \0 character that will be used
    to indicate a "finish" message.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    047b127 View commit details
    Browse the repository at this point in the history
  35. Sort includes in criu/img-*.c

    Sort and remove unused/unnecessary include statements in criu/img-*.c
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    861510f View commit details
    Browse the repository at this point in the history
  36. util: Remove deprecated print_data() routine

    The print_data() function was part of the deprecated (and removed)
    'show' action, and it was moved in util.c with the following commit:
    
    	a501b48
    	The 'show' action has been deprecated since 1.6, let's finally drop it.
    
    	The print_data() routine is kept for yet another (to be deprecated too)
    	feature called 'criu exec'.
    
    The criu exec feature was removed with:
    
    	909590a
    	Remove criu exec code
    
    	It's now obsoleted by compel library.
    	Maybe-TODO: Add compel tool exec action?
    
    Therefore, now we can drop print_data() as well.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    48ff3f1 View commit details
    Browse the repository at this point in the history
  37. criu-ns: Convert to python3 style print() syntax

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    83cb0c0 View commit details
    Browse the repository at this point in the history
  38. criu-ns: Print usage info when no args provided

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    3846d16 View commit details
    Browse the repository at this point in the history
  39. criu-ns: Convert c_char_p strings to bytes object

    class ctypes.c_char_p
        Represents the C char * datatype when it points to a zero-
        terminated string. For a general character pointer that may
        also point to binary data, POINTER(c_char) must be used.
        The constructor accepts an integer address, or a bytes object.
    
    https://docs.python.org/3/library/ctypes.html#ctypes.c_char_p
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    50b1a49 View commit details
    Browse the repository at this point in the history
  40. Convert spaces to tabs

    There are a few places where spaces have been used instead of tabs for
    indentation. This patch converts the spaces to tabs for consistency
    with the rest of the code base.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    38a9b23 View commit details
    Browse the repository at this point in the history
  41. net: fix coverity RESOURCE_LEAK

    criu-3.12/criu/net.c:2043: overwrite_var: Overwriting "img" in "img =
    open_image_at(-1, CR_FD_IP6TABLES, 0UL, pid)" leaks the storage that
    "img" points to.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    13d2868 View commit details
    Browse the repository at this point in the history
  42. py: Manual fixlets of code formatting

    Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    fe9ad62 View commit details
    Browse the repository at this point in the history
  43. files-reg: Drop clear_ghost_files() prototype

    The function clear_ghost_files() has been removed in commit
    b11eeea "restore: auto-unlink for ghost files (v2)".
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    a981ddf View commit details
    Browse the repository at this point in the history
  44. cr-dump: Remove redundant if-statement

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    cf7e7fc View commit details
    Browse the repository at this point in the history
  45. arch/x86: push correct eip on the stack before lretq

    Right now we use pushq, but it pushes sign-extended value, so if the
    parasite code is placed higher that 2Gb, we will see something like
    this:
    
       0xf7efd5b0:	pushq  $0x23
       0xf7efd5b2:	pushq  $0xfffffffff7efd5b9
    => 0xf7efd5b7:	lretq
    
    Actually we want to push 0xf7efd5b9 instead of 0xfffffffff7efd5b9.
    
    Fixes: checkpoint-restore#398
    
    Cc: Dmitry Safonov <dima@arista.com>
    Cc: Cyrill Gorcunov <gorcunov@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    Acked-by: Dmitry Safonov <0x7f454c46@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    024bb21 View commit details
    Browse the repository at this point in the history
  46. compel/x86: Don't use pushq for a label

    `pushq` sign-extends the value. Which is a bummer as the label's address
    may be higher that 2Gb, which means that the sign-bit will be set.
    
    As it long-jumps with ia32 selector, %r11 can be scratched.
    Use %r11 register as a temporary to push the 32-bit address.
    
    Complements: a9a7602 ("arch/x86: push correct eip on the stack
    before lretq")
    Cc: Cyrill Gorcunov <gorcunov@gmail.com>
    Reported-by: Andrei Vagin <avagin@gmail.com>
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    266db50 View commit details
    Browse the repository at this point in the history
  47. scripts: Drop Fedora 28/rawhide fix

    This change was introduced with c75cb2b and it is no longer necessary.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    bdee0a7 View commit details
    Browse the repository at this point in the history
  48. Add new command line option: --cgroup-yard

    Instead of creating cgroup yard in CRIU, now we can create it externally
    and pass it to CRIU. Useful if somebody doesn't want to grant
    CAP_SYS_ADMIN to CRIU.
    
    Signed-off-by: Michał Cłapiński <mclapinski@google.com>
    mclapinski authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    f3caa7f View commit details
    Browse the repository at this point in the history
  49. test: implement test for new --cgroup-yard option

    Signed-off-by: Michał Cłapiński <mclapinski@google.com>
    mclapinski authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    10fb1cf View commit details
    Browse the repository at this point in the history
  50. travis: Install missing diffutils dependency

    The following tests fail in Fedora rawhide because /usr/bin/diff
    is missing.
    
     * zdtm/static/bridge(ns)
     * zdtm/static/cr_veth(uns)
     * zdtm/static/macvlan(ns)
     * zdtm/static/netns(uns)
     * zdtm/static/netns-nf(ns)
     * zdtm/static/sit(ns)
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    cc1fcfa View commit details
    Browse the repository at this point in the history
  51. arch/x86: fpu_state->fpu_state_ia32.xsave hast to be 64-byte aligned

    Before the 5.2 kernel, only fpu_state->fpu_state_64.xsave has to be
    64-byte aligned. But staring with the 5.2 kernel, the same is required
    for pu_state->fpu_state_ia32.xsave.
    
    The behavior was changed in:
    c2ff9e9a3d9d ("x86/fpu: Merge the two code paths in __fpu__restore_sig()")
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    cf54e13 View commit details
    Browse the repository at this point in the history
  52. Introduce flush_early_log_to_stderr destructor

    Prior log initialisation CRIU preserves all (early) log messages in a
    buffer. In case of error the content of the content of this buffer
    needs to be printed out (flushed).
    
    Suggested-by: Dmitry Safonov <0x7f454c46@gmail.com>
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    463227b View commit details
    Browse the repository at this point in the history
  53. Convert pr_msg() error messages to pr_err()

    Print error messages to stderr (instead of stdout).
    
    Suggested-by: Andrei Vagin <avagin@gmail.com>
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    8d2a56a View commit details
    Browse the repository at this point in the history
  54. test/cgroup_yard: always clean up a test cgroup yard

    Right now it is cleaned up from a post-restore hook,
    but zdtm.py can be executed with the norst option:
    $ zdtm.py run -t zdtm/static/cgroup_yard --norst
    ...
    OSError: [Errno 17] File exists: 'external_yard'
    
    Cc: Michał Cłapiński <mclapinski@google.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    3e03d51 View commit details
    Browse the repository at this point in the history
  55. zdtm/cgroup_yard: create a test cgroup yard from the post-start hook

    Right now, it is created from the pre-dump hook, but
    if the --snap option is set, the test fails:
    $ python test/zdtm.py run -t zdtm/static/cgroup_yard -f h --snap --iter 3
    ...
    Running zdtm/static/cgroup_yard.hook(--pre-dump)
    Traceback (most recent call last):
      File zdtm/static/cgroup_yard.hook, line 14, in <module>
        os.mkdir(yard)
    OSError: [Errno 17] File exists: 'external_yard'
    
    Cc: Michał Cłapiński <mclapinski@google.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    78f70bd View commit details
    Browse the repository at this point in the history
  56. cgroup: fixup nits

    1) s/\s*$//
    2) fix snprintf out of bound access
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Snorch authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    bd80be8 View commit details
    Browse the repository at this point in the history
  57. pipe: print pipe_id as unsigned to generate an external pipe name

    Reported-by: Mr Jenkins
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    7df16f9 View commit details
    Browse the repository at this point in the history
  58. unix: print inode numbers as unsigned int

    Reported-by: Mr Jenkins
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    1816886 View commit details
    Browse the repository at this point in the history
  59. Cleanup do_full_int80()

    1) Instead of tampering with the nr argument, do_full_int80() returns
    the value of the system call. It also avoids copying all registers back
    into the syscall_args32 argument after the syscall.
    
    2) Additionally, the registers r12-r15 were added in the list of
    clobbers as kernels older than v4.4 do not preserve these.
    
    3) Further, GCC uses a 128-byte red-zone as defined in the x86_64 ABI
    optimizing away the correct position of the %rsp register in
    leaf-functions. We now avoid tampering with the red-zone, fixing a
    SIGSEGV when running mmap_bug_test() in debug mode (DEBUG=1).
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    nviennot authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    fdbaf4a View commit details
    Browse the repository at this point in the history
  60. restorer/inotify: Don't overflow PIE stack

    PATH_MAX == 4096; PATH_MAX*8 == 32k; RESTORE_STACK_SIZE == 32k.
    
    Fixes: a3cdf94 ("inotify: cleanup auxiliary events from queue")
    Cc: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Cc: Andrei Vagin <avagin@gmail.com>
    Co-debugged-with: Andrei Vagin <avagin@gmail.com>
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    36e1da9 View commit details
    Browse the repository at this point in the history
  61. Adding --pre-dump-mode option

    Two modes of pre-dump algorithm:
        1) splicing memory by parasite
            --pre-dump-mode=splice (default)
        2) using process_vm_readv syscall
            --pre-dump-mode=read
    
    Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    dubeyabhishek authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    e515ef0 View commit details
    Browse the repository at this point in the history
  62. Handling iov generation for non-PROT_READ regions

    Skip iov-generation for regions not having
    PROT_READ, since process_vm_readv syscall
    can't process them during "read" pre-dump.
    Handle random order of "read" & "splice"
    pre-dumps.
    
    Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    dubeyabhishek authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    1c673f3 View commit details
    Browse the repository at this point in the history
  63. Skip adding PROT_READ to non-PROT_READ mappings

    "read" mode pre-dump may fail even after
    adding PROT_READ flag. Adding PROT_READ
    works when dumping statically. See added
    comment for details.
    
    Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    dubeyabhishek authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    bb504a8 View commit details
    Browse the repository at this point in the history
  64. Adding cnt_sub for stats manipulation

    adding cnt_sub function (complement of cnt_add).
    cnt_sub is utilized to decrement stats counter
    according to skipped page count during "read"
    mode pre-dump.
    
    Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    dubeyabhishek authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    cce4019 View commit details
    Browse the repository at this point in the history
  65. read mode pre-dump implementation

    Pre-dump using the process_vm_readv syscall.
    During frozen state, only iovecs will be
    generated and draining of memory happens
    after the task is unfrozen. Pre-dumping of
    shared memory remains unmodified.
    
    Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    dubeyabhishek authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    a39e7a9 View commit details
    Browse the repository at this point in the history
  66. Refactor time accounting macros

    refactoring time macros as per read mode
    pre-dump design.
    
    Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    dubeyabhishek authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    0b56cdc View commit details
    Browse the repository at this point in the history
  67. zdtm: handle --pre-dump-mode in the rpc mode

    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    55bcadb View commit details
    Browse the repository at this point in the history
  68. lib/c: fix a compile time error

    lib/c/criu.c:343:30: error: implicit conversion from enumeration type
    'enum criu_pre_dump_mode' to different enumeration type 'CriuPreDumpMode'
    (aka 'enum _CriuPreDumpMode') [-Werror,-Wenum-conversion
    
                    opts->rpc->pre_dump_mode = mode;
                                             ~ ^~~~
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    4b9bcba View commit details
    Browse the repository at this point in the history
  69. criu: use atomic_add instead of atomic_sub

    atomic_sub isn't defined for all platforms.
    
    Reported-by: Mr Jenkins
    Cc: Abhishek Dubey <dubeyabhishek777@gmail.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    31e47a5 View commit details
    Browse the repository at this point in the history
  70. image: avoid name conflicts in image files

    Conflict register for file "sk-opts.proto": READ is already defined in
    file "rpc.proto". Please fix the conflict by adding package name on the
    proto file, or use different name for the duplication.  Note: enum
    values appear as siblings of the enum type instead of children of it.
    
    checkpoint-restore#815
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    141e697 View commit details
    Browse the repository at this point in the history
  71. Guard against empty file lock status

    The lock status string may be empty. This can happen when the owner of
    the lock is invisible from our PID namespace. This unfortunate behavior
    is fixed in kernels v4.19 and up (see commit 1cf8e5de40)
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    nviennot authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    919f4e7 View commit details
    Browse the repository at this point in the history
  72. page-pipe: Resize up to PIPE_MAX_SIZE

    When performing pre-dump we continuously increase the page-pipe size to
    fit the max amount memory pages in the pipe's buffer. However, we never
    actually set the pipe's buffer size to max. By doing so, we can reduce
    the number of pipe-s necessary for pre-dump and improve the performance
    as shown in the example below.
    
    For example, let's consider the following process:
    
    	#include <stdio.h>
    	#include <stdlib.h>
    	#include <unistd.h>
    
    	void main(void)
    	{
    		int i = 0;
    		void *cache = calloc(1, 1024 * 1024 * 1024);
    		while(1) {
    			printf("%d\n", i++);
    			sleep(1);
    		}
    	}
    
    stats-dump before this change:
    
    	frozen_time: 123538
    	memdump_time: 95344
    	memwrite_time: 11980078
    	pages_scanned: 262721
    	pages_written: 262169
    	page_pipes: 513
    	page_pipe_bufs: 519
    
    stats-dump after this change:
    
    	frozen_time: 83287
    	memdump_time: 54587
    	memwrite_time: 12547466
    	pages_scanned: 262721
    	pages_written: 262169
    	page_pipes: 257
    	page_pipe_bufs: 263
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    40b5731 View commit details
    Browse the repository at this point in the history
  73. cgroup: fix cg_yard leak on error path in prepare_cgroup_sfd

    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Snorch authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    48ae837 View commit details
    Browse the repository at this point in the history
  74. image-desc: Remove CR_FD_FILE_LOCKS_PID

    The support for per-pid images with locks has been dropped with
    commit d040219 ("locks: Drop support for per-pid images with locks")
    and CR_FD_FILE_LOCKS_PID is not used.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    196551b View commit details
    Browse the repository at this point in the history
  75. service: Use space on stack for msg buffer

    RPC messages are have fairly small size and using space on the stack
    might be a better option. This change follows the pattern used with
    do_pb_read_one() and pb_write_one().
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    91a5cad View commit details
    Browse the repository at this point in the history
  76. Couple of fixes to build and run libcriu tests

    libcriu tests are currently broken. This patch fixes couple of
    issues to allow the building and running libcriu tests.
    
    1. lib/c/criu.h got updated to include version.h which is present
    at "criu/include", but the command to compile libcriu tests is not
    specifying "criu/include" in the path to be searched for header
    files. This resulted in compilation error.
    This can be fixed by adding "-I ../../../../../criu/criu/include"
    however it causes more problems as "criu/include/fcntl.h" would now
    hide system defined fcntl.h
    Solution is to use "-iquote ../../../../../criu/criu/include"
    which applies only to the quote form of include directive.
    
    2. Secondly, libcriu.so major version got updated to 2 but
    libcriu/run.sh still assumes verion 1. Instead of just updating the
    version in libcriu/run.sh to 2, this patch updates the libcriu/Makefile
    to use "CRIU_SO_VERSION_MAJOR" so that future changes to major version
    of libcriu won't cause same problem again.
    
    Signed-off-by: Ashutosh Mehra <asmehra1@in.ibm.com>
    Ashutosh Mehra authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    ee96348 View commit details
    Browse the repository at this point in the history
  77. Enable libcriu testing in travis jobs

    Updated scripts/travis/travis-tests to run libcriu test.
    
    Signed-off-by: Ashutosh Mehra <asmehra1@in.ibm.com>
    Ashutosh Mehra authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    4c1350d View commit details
    Browse the repository at this point in the history
  78. Add criu to PATH env variable in libcriu tests

    PATH is pointing to incorrect location for `criu` executable
    causing libcriu tests to fail when running in travis.
    Also added statements to display log file contents on failure
    to help in debugging.
    
    Signed-off-by: Ashutosh Mehra <asmehra1@in.ibm.com>
    Ashutosh Mehra authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    870eaa5 View commit details
    Browse the repository at this point in the history
  79. early-log: Print warnings only if the buffer is full

    I don't see many issues with early-log, so we probably don't
    need the warning when it was used. Note that after
    commit 74731d9 ("zdtm: make grep_errors also grep warnings")
    also warnings are grepped by zdtm.py (and I believe that was
    an improvement) which prints some bothering lines:
    
    > =[log]=> dump/zdtm/static/inotify00/38/1/dump.log
    > ------------------------ grep Error ------------------------
    > (00.000000) Will allow link remaps on FS
    > (00.000034) Warn  (criu/log.c:203): The early log isn't empty
    > ------------------------ ERROR OVER ------------------------
    
    Instead of decreasing loglevel of the message, improve it by
    reporting a real issue.
    
    Cc: Adrian Reber <adrian@lisas.de>
    Cc: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Cc: Radostin Stoyanov <rstoyanov1@gmail.com>
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    99049e2 View commit details
    Browse the repository at this point in the history
  80. Action scripts should be invoked with normal signal behavior

    Signal masks propagate through execve, so we need to clear them before
    invoking the action scripts as it may want to handle SIGCHLD, or SIGSEGV.
    
    Signed-off-by: Nicolas Viennot <nicolas.viennot@twosigma.com>
    nviennot authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    48c9672 View commit details
    Browse the repository at this point in the history
  81. Fix broken web-links

    ligurio authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    0d6e92a View commit details
    Browse the repository at this point in the history
  82. travis: start to use aarch64 hardware

    With the newly introduced aarch64 at Travis it is possible for the CRIU
    test-cases to switch to aarch64.
    
    Travis uses unprivileged LXD containers on aarch64 which blocks many of
    the kernel interfaces CRIU needs. So for now this only tests building
    CRIU natively on aarch64 instead of using the Docker+QEMU combination.
    
    All tests based on Docker are not working on aarch64 is there currently
    seems to be a problem with Docker on aarch64. Maybe because of the
    nesting of Docker in LXD.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    c28e3b8 View commit details
    Browse the repository at this point in the history
  83. test/static:conntracks: Support nftables

    Update test to support both iptables and nft to create conntrack rules.
    
    Signed-off-by: Vitaly Ostrosablin <vostrosablin@virtuozzo.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    Vitaly Ostrosablin authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    2bb53e7 View commit details
    Browse the repository at this point in the history
  84. test/java: Add FileRead Tests

    Signed-off-by: Nidhi Gupta <itsnidhi16@gmail.com>
    nidhi1605 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    a43ea01 View commit details
    Browse the repository at this point in the history
  85. travis: Disallow failures on ia32

    It seems pretty stable and hasn't add many false-positives during last
    months. While can reveal some issues for compatible C/R code.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    72d44f8 View commit details
    Browse the repository at this point in the history
  86. mount: remove useless check in populate_mnt_ns

    The path:
    
    restore_root_task
     prepare_namespace_before_tasks
      mntns_maybe_create_roots
    
    is always called before the path below:
    
    retore_root_task
     fork_with_pid
      restore_task_with_children
       prepare_namespace
        prepare_mnt_ns
         populate_mnt_ns
    
    So (!!mnt_roots) == (root_ns_mask & CLONE_NEWNS) in populate_mnt_ns, but
    in prepare_mnt_ns we've already checked that it is true, so there is no
    need in these check - remove it.
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Snorch authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    d125c2b View commit details
    Browse the repository at this point in the history
  87. ns: make rst_new_ns_id static

    It's never used outside of namespaces.c
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Snorch authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    53b22e4 View commit details
    Browse the repository at this point in the history
  88. ns/restore/image: do not read namespace images for non-namespaced case

    Images for mount and net namespaces are empty if ns does not belong to
    us, thus we don't need to collect on restore.
    
    By adding these checks we will eliminate suspicious messages in logs
    about lack of images:
    
    ./test/zdtm.py run -k always -f h -t zdtm/static/env00
    
    env00/54/2/restore.log:(00.000332) No mountpoints-5.img image
    env00/54/2/restore.log:(00.000342) No netns-2.img image
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Snorch authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    743cb26 View commit details
    Browse the repository at this point in the history
  89. mount: rework mount tree build step on restore

    Build each mntns mount tree alone just after reading mounts for it from
    image. These additional step before merging everything to a single mount
    tree allows us to have pointers to each mntns root mount at hand, also
    it allows us to remove extra complication from mnt_build_tree.
    
    Teach collect_mnt_from_image return a tail pointer, so we can merge
    lists together later after building each tree.
    
    Add separate merge_mount_trees helper to create joint mount tree for all
    mntns'es and simplify mnt_build_ids_tree.
    
    I don't see any place where we use mntinfo_tree on restore, so save the
    real root of mntns mounts tree in it, instead of root_yard_mp, will need
    it in next patches for checking restore of these trees.
    
    v2: prepend children to the root_yard in merge_mount_trees so that the
    order in merged tree persists
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Snorch authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    74faa96 View commit details
    Browse the repository at this point in the history
  90. mount: make mnt_resort_siblings nonrecursive and reuse friendly

    Add mnt_subtree_next DFS-next search to remove recursion.
    
    v5: add these patch, remove recursion from sorting helpers
    v6: rip out butifull yet unused step-part of nfs-next algorithm
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Snorch authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    8529a48 View commit details
    Browse the repository at this point in the history
  91. Run java functional tests on travis

    Signed-off-by: Nidhi Gupta <itsnidhi16@gmail.com>
    nidhi1605 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    7cc9a72 View commit details
    Browse the repository at this point in the history
  92. travis: fix copy paste error from previous commit

    In my previous commit I copied a line with a return into the main script
    body. bash can only return from functions. This changes return to exit.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    7cdca4c View commit details
    Browse the repository at this point in the history
  93. travis: Do not run privileged containers in LXD

    Travis uses unprivileged containers for aarch64 in LXD. Docker with
    '--privileged' fails in such situation. This changes the travis setup
    to only start docker with '--privileged' if running on x86_64.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    e98fe21 View commit details
    Browse the repository at this point in the history
  94. Makefile hack for travis aarch64/armv8l

    For CRIU's compile only tests for armv7hf on Travis we are using
    'setarch linux32' which returns armv8l on Travis aarch64.
    
    This adds a path in the Makefile to treat armv8l just as armv7hf during
    compile. This enables us to run armv7hf compile tests on Travis aarch64
    hardware. Much faster. Maybe not entirely correct, but probably good
    enough for compile testing in an armv7hf container.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    f7c5bc8 View commit details
    Browse the repository at this point in the history
  95. travis: switch all arm related tests to real hardware

    This switches all arm related tests (32bit and 64bit) to the aarch64
    systems Travis provides. For arm32 we are running in a armv7hf container
    on aarch64 with 'setarch linux32'.
    
    The main changes are that docker on Travis aarch64 cannot use
    '--privileged' as Travis is using unprivileged LXD containers to setup
    the testing environment.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    6f1fb1b View commit details
    Browse the repository at this point in the history
  96. travis: switch pcp64le and s390x to real hardware

    Now that Travis also supports ppc64le and s390x we can remove all qemu
    based docker emulation from our test setup. This now runs ppc64le and
    s390x tests on real hardware (LXD containers).
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    524263e View commit details
    Browse the repository at this point in the history
  97. travis: remove group from .travis.yml

    Tests are successful even after removing 'group:' from .travis.yml.
    Apparently it is not necessary.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    025f8d9 View commit details
    Browse the repository at this point in the history
  98. lib/ptrace: Allow PTRACE_PEEKDATA with errno != 0

    >From man ptrace:
    > On error, all requests return -1, and errno is set appropriately.
    > Since the value returned by a successful PTRACE_PEEK* request may be
    > -1, the caller must clear errno before the call, and then check
    > it afterward to determine whether or not an error occurred.
    
    FWIW: if ptrace_peek_area() is called with (errno != 0) it may
    false-fail if the data is (-1).
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    05b078f View commit details
    Browse the repository at this point in the history
  99. lib/ptrace: Be more elaborate about failures

    Also, don't use the magic -2 => return errno on failure.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    c19c153 View commit details
    Browse the repository at this point in the history
  100. compel/infect: Warn if close() failed on memfd

    As a preparation for __must_check on compel_syscall(), check it on
    close() too - maybe not as useful as with other syscalls, but why not.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    038f3eb View commit details
    Browse the repository at this point in the history
  101. compel: Mark compat argument of __NR() as used

    And remove __maybe_unused work-around.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    eda9a11 View commit details
    Browse the repository at this point in the history
  102. lib/infect: Check if compel succeed in executing munmap

    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    0020f2a View commit details
    Browse the repository at this point in the history
  103. cr-dump: Try to cure remote on err-pathes

    On daemon stop or threads dump failures it's still desired to remove
    parasite from the remote (if possible). Try best and keep hopeing.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    0998ac6 View commit details
    Browse the repository at this point in the history
  104. cr-dump: Warn if unmapping local memfd failed

    Probably, not the worst that could happen, but still unexpected.
    Preparing the ground to make compel_cure*() functions __must_check.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    341d781 View commit details
    Browse the repository at this point in the history
  105. cr-restore: Warn if restorer can't be unmapped

    Too late to stop restore: it's already printed that restore was
    successful. Oh, well warn aloud about infection.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    0a4d747 View commit details
    Browse the repository at this point in the history
  106. parasite-syscall: Log if can't cure on failed infection

    Maybe expected, hopefully never happens - let's warn in any case.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    281c9f3 View commit details
    Browse the repository at this point in the history
  107. compel/infect: Detach but fail compel_resume_task()

    Unknown state means that the task in the end may be not in wanted state.
    Return err code.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    9e998ad View commit details
    Browse the repository at this point in the history
  108. criu: Kill tasks even when the network is unlocked

    Currently if anything fails after network has been unlocked tasks aren't
    killed. Which doesn't work anyway: any stage sets `ret` and nothing
    later gets called. Which means the tasks aren't resumed properly.
    Furthermore, functions like catch_tasks() and compel_stop_on_syscall()
    return failure on the first error.
    
    Let's do the cleanup even when the network is unlocked.
    If we want to keep the mess and ignore failures - a cli option should be
    introduced for that (and existing code should be reworked with decisions
    what is critical and what can be ignored).
    
    Move "Restore finished successfully" message accordingly where
    everything is evidently good.
    
    While at here, any late failure will result not only in cleanup but in
    criu returning error code.
    
    Which in result makes tests to fail in such case:
    > ======================= Run zdtm/static/inotify04 in ns ========================
    > Start test
    > ./inotify04 --pidfile=inotify04.pid --outfile=inotify04.out --dirname=inotify04.test
    > Run criu dump
    > =[log]=> dump/zdtm/static/inotify04/84/1/dump.log
    > ------------------------ grep Error ------------------------
    > (00.119763) fsnotify: 			openable (inode match) as zdtm/static/inotify04.test/inotify-testfile
    > (00.119766) fsnotify: 	Dumping /zdtm/static/inotify04.test/inotify-testfile as path for handle
    > (00.119769) fsnotify: id 0x00000b flags 0x000800
    > (00.119787) 88 fdinfo 5: pos:                0 flags:             4000/0
    > (00.119796) Warn  (criu/fsnotify.c:336): fsnotify: The 0x00000c inotify events will be dropped
    > ------------------------ ERROR OVER ------------------------
    > Run criu restore
    > =[log]=> dump/zdtm/static/inotify04/84/1/restore.log
    > ------------------------ grep Error ------------------------
    > (00.391582) 123 was stopped
    > (00.391667) 106 was trapped
    > (00.391674) 106 (native) is going to execute the syscall 11, required is 11
    > (00.391697) 106 was stopped
    > (00.391720) Error (compel/src/lib/infect.c:1439): Task 123 is in unexpected state: b7f
    > (00.391736) Error (compel/src/lib/infect.c:1447): Task stopped with 11: Segmentation fault
    > ------------------------ ERROR OVER ------------------------
    > 5: Old maps lost: set([])
    > 5: New maps appeared: set([u'10000-1a000 rwxp', u'1a000-24000 rw-p'])
    > ############### Test zdtm/static/inotify04 FAIL at maps compare ################
    > Send the 9 signal to  106
    > Wait for zdtm/static/inotify04(106) to die for 0.100000
    > ======================= Test zdtm/static/inotify04 PASS ========================
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    674bd13 View commit details
    Browse the repository at this point in the history
  109. compel/criu: Add __must_check

    All those compel functions can fail by various reasons.
    It may be status of the system, interruption by user or anything else.
    It's really desired to handle as many PIE related errors as possible
    otherwise it's hard to analyze statuses of parasite/restorer
    and the C/R process.
    
    At least warning for logs should be produced or even C/R stopped.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    bcbe0af View commit details
    Browse the repository at this point in the history
  110. Checkpoint only specified controllers

    Before this change CRIU would checkpoint all controllers, even the ones
    not specified in --cgroup-dump-controller. That becomes a problem if
    there's a cgroup controller on the checkpointing machine that doesn't
    exist on the restoring machine even if CRIU is instructed not to dump
    that controller. After that change everything works as expected.
    
    Signed-off-by: Michał Cłapiński <mclapinski@google.com>
    mclapinski authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    715a105 View commit details
    Browse the repository at this point in the history
  111. travis: group lazy-pages options

    The amount of lazy-pages options keeps growing, let's put the common ones
    into a variable.
    
    Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
    rppt authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    078efae View commit details
    Browse the repository at this point in the history
  112. travis: exclude uns tests for lazy-pages on newer kernels

    Kernels 5.4 and higher will restrict availability of UFFD_EVENT_FORK only
    for users with SYS_CAP_PTRACE. This prevents running --lazy-pages tests
    with 'uns' flavor.
    
    Disable 'uns' for lazy pages testing in travis for newer kernels.
    
    Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
    rppt authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    f5c8c9e View commit details
    Browse the repository at this point in the history
  113. mount: Add error messages

    Suggested-by: Andrei Vagin <avagin@gmail.com>
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    4c1ff11 View commit details
    Browse the repository at this point in the history
  114. mount: Bind-mount root via userns_call

    When restoring a runc container with enabled user namespace CRIU fails
    to mount the specified root directory because the path is under
    /run/runc which is inaccessible to unprivileged users.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    1b31164 View commit details
    Browse the repository at this point in the history
  115. restore: Create temp proc in /tmp

    When restoring a container with user namespace, CRIU fails to create
    a temporary directory for proc. The is because the unprivileged user
    that has been just restored does not have permissions to access the
    working directory used by CRIU.
    
    Resolves checkpoint-restore#828
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    91884a1 View commit details
    Browse the repository at this point in the history
  116. man: Describe --root option requirements

    These requirements have been described in
    
    https://github.com/opencontainers/runc/blob/b133feae/libcontainer/container_linux.go#L1265
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    6f23010 View commit details
    Browse the repository at this point in the history
  117. zdtm: Replace if->continue with if->elif->else

    Replacing the if->continue pattern with if->elif->else
    reduces the number of lines while preserving the logic.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    49a0fb0 View commit details
    Browse the repository at this point in the history
  118. zdtm: Set --root path to 0700 on restore

    Update zdtm tests to verify that CRIU does not require the --root
    path to be accessible to the unprivileged user being restored when
    restoring user namespace.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    7b970be View commit details
    Browse the repository at this point in the history
  119. build: Remove SRCARCH

    SRCARCH is always equal ARCH. There are no rules when to use one or
    another and architectures may forget to set one of them up.
    
    No need for a second variable meaning the same and confusing people.
    Remove it completely.
    
    Self-correction [after some debug]: SRCARCH was different in one place:
    zdtm Makefile by some unintentional mistake:
    > ifeq ($(ARCH),arm64)
    >         ARCH		?= aarch64
    >         SRCARCH	?= aarch64
    > endif
    
    That meant to be "ARCH := aarch64" because "?=" would never work inside
    that ifeq. Fix up this part of mess too.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    e7baaf1 View commit details
    Browse the repository at this point in the history
  120. build/nmk: Remove SRCARCH

    It's not used anywhere now.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    70a5b0c View commit details
    Browse the repository at this point in the history
  121. build/nmk: Provide proper SUBARCH

    It's always equal ARCH and not very useful (so nothing actually uses it).
    Time for a change: SUBARCH now is meaningful and gives a way to detect
    what kind of ARCH flavor build is dealing with.
    
    Also, for cross-compiling sake don't set SUBARCH if the user supplied it.
    (and don't call useless uname during cross compilation)
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    da58a10 View commit details
    Browse the repository at this point in the history
  122. build: Use SUBARCH

    Instead of doing additional `uname -m` - use provided $(SUBARCH) to detect
    what architecture flavour the build should produce the result for.
    
    Fixes two things:
    - zdtm make now correctly supplies $(USERCFLAGS)
    - subtly fixes cross compilation by providing a way to specify $(SUBARCH)
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    1f09aba View commit details
    Browse the repository at this point in the history
  123. build/zdtm: Support cross-build

    Maybe not that useful, but only little change needed.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    37eb8bf View commit details
    Browse the repository at this point in the history
  124. build/zdtm: Makefile hack for travis aarch64/armv8l

    The very same hack to build aarch32 zdtm tests on armv8 Travis-CI
    as in the commit dfa0a1e ("Makefile hack for travis
    aarch64/armv8l")
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    f577270 View commit details
    Browse the repository at this point in the history
  125. build/zdtm: Use pkg-config to find includes/libs

    Helps to cross-compile zdtm tests in case somebody needs it.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    3e09b0b View commit details
    Browse the repository at this point in the history
  126. travis: Add armv7-cross as cross-compile test

    Fixes: checkpoint-restore#455
    Based-on-patch-by: Andrei Vagin <avagin@gmail.com>
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    c3e1157 View commit details
    Browse the repository at this point in the history
  127. Documentation: Add a hint about docker build

    The original/old guide probably doesn't work anymore:
    - the patch isn't accessible;
    - criu now depends on more libraries not only protobuf
    
    Still, keep it as it might be helpful for someone.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    53018af View commit details
    Browse the repository at this point in the history
  128. zdtm/socket-tcp-fin-wait1: Use array index fro TEST_MSG

    Fixes the following compile-error:
    >  CC        socket-tcp-fin-wait1.o
    > socket-tcp-fin-wait1.c:144:26: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
    >                 if (write(fd, TEST_MSG + 2, sizeof(TEST_MSG) - 2) != sizeof(TEST_MSG) - 2) {
    >                               ~~~~~~~~~^~~
    > socket-tcp-fin-wait1.c:144:26: note: use array indexing to silence this warning
    >                 if (write(fd, TEST_MSG + 2, sizeof(TEST_MSG) - 2) != sizeof(TEST_MSG) - 2) {
    >                                        ^
    >                               &        [  ]
    > 1 error generated.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    0x7f454c46 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    455e8f4 View commit details
    Browse the repository at this point in the history
  129. Add File-based Java Functional Tests

    Signed-off-by: Nidhi Gupta <itsnidhi16@gmail.com>
    nidhi1605 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    5d451ee View commit details
    Browse the repository at this point in the history
  130. travis: ignore fails of podman-test

    until it will not be fixed.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    4405944 View commit details
    Browse the repository at this point in the history
  131. kerndat: check whether the new mount API is supported of not

    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    41bcada View commit details
    Browse the repository at this point in the history
  132. util: introduce the mount_detached_fs helper

    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    cb1f602 View commit details
    Browse the repository at this point in the history
  133. mount: use new mount API to open the proc file system

    It doesn't require to create a temporary directory and mount the proc
    file system in it.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    08a86c7 View commit details
    Browse the repository at this point in the history
  134. net: use new mount API to open the sysfs file system

    It doesn't require to create a temporary directory and mount the proc
    file system in it.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    2a4fffb View commit details
    Browse the repository at this point in the history
  135. cgroup: use new mount API to open the cgroup file system

    It doesn't require to create a temporary directory and mount the proc
    file system in it.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    e209cd6 View commit details
    Browse the repository at this point in the history
  136. readme: github pull-requests is the preferred way to contribute

    We will continue accepting patches.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    fd4d0e6 View commit details
    Browse the repository at this point in the history
  137. restorer/inotify: reorder inotify cleanup after waiting helpers and z…

    …ombies
    
    We've seen ppoll interrupted with signal in VZ7 CT migration tests, that
    is because in the beggining of CR_STATE_RESTORE_SIGCHLD zombies and
    helpers die, and that can trigger SIGCHILDs sent to their parents.
    
    Adding additional debug (printing "Task..." for zombies and helpers) in
    sigchld_handler I see:
    
      (15.644339) pie: 1: Task 10718 exited, status= 0
      (15.644349) pie: 1: Cleaning inotify events from 29
      (15.644359) pie: 1: Cleaning inotify events from 19
      (15.644367) pie: 1: Cleaning inotify events from 10
    
    And previousely we had:
    
      (05.718449) pie: 104: Cleaning inotify events from 5
      (05.718835) pie: 330: Cleaning inotify events from 3
      (05.719046) pie: 1: Cleaning inotify events from 23
      (05.719164) pie: 80: Cleaning inotify events from 7
      (05.719185) pie: 1: Error (criu/pie/restorer.c:1287): Failed to poll from inotify fd: -4
      (05.719202) pie: 95: Cleaning inotify events from 6
      (05.719269) pie: 1: Error (criu/pie/restorer.c:1890): Restorer fail 1
    
    So reordering cleanup and wait should fix it.
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Snorch authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    f728391 View commit details
    Browse the repository at this point in the history
  138. mount: Order call_helper_process calls

    When we do clone threads in a later stage of restore procedure
    it may race with helpers which do call clone_noasan by self.
    
    Thus we need to walk over each clone_noasan call and figure
    out if calling it without last_pid lock is safe.
    
     - open_mountpoint: called by fusectl_dump, dump_empty_fs,
       binfmt_misc_dump, tmpfs_dump -- they all are processing
       dump stage, thus safe
    
     - call_helper_process: try_remount_writable -- called from
       various places in reg-files.c, in particular open_reg_by_id
       called in parallel with other threads, needs a lock
       remount_readonly_mounts -- called from sigreturn_restore,
       so in parallel, needs a lock
    
     - call_in_child_process: prepare_net_namespaces -- called
       from prepare_namespace which runs before we start forking,
       no need for lock
    
    Thus call_helper_process should use lock_last_pid and
    unlock_last_pid helpers and wait for subprocess to finish.
    
    Same time put a warning text into clone_noasan comment
    so next time we need to use it we would recall the pitfalls.
    
    v2:
     - fix unitialized ret variable
    v3:
     - use exit_code instead of ret
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
    cyrillos authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    a1533cd View commit details
    Browse the repository at this point in the history
  139. unix: sysctl -- Preserve max_dgram_qlen value

    The /proc/sys/net/unix/max_dgram_qlen is a per-net variable and
    we already noticed that systemd inside a container may change its value
    (for example it sets it to 512 by now instead of kernel's default
    value 10), thus we need keep it inside image and restore then.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander@mihalicyn.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
    cyrillos authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    5515496 View commit details
    Browse the repository at this point in the history
  140. zdtm: sysctl net.unix.max_dgram_qlen value preservation test

    Test checks that if the /proc/sys/net/unix/max_dgram_qlen value has
    been changed in process net namespace, then it is saved after c/r.
    
    Signed-off-by: Alexander Mikhalitsyn <alexander@mihalicyn.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
    mihalicyn authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    1e39d9b View commit details
    Browse the repository at this point in the history
  141. x86/cpu: cleanup and improve xfeatures_mask check

    Make xfeatures_mask check explicit. We were relying on our guess about
    hardware "backward compatibility" and used ">" check here for a long
    time. But it looks better to explicitly check that all xfeature bits
    available on the source are also available on the destination.
    
    For xsave_size we need to have smaller size on destination than on
    source, because xsave operation on small allocated buffer may corrupt
    the nearby data. So split up comments about xfeatures_mask and
    xsave_size, as having single comment for quiet a different cases is less
    understandable.
    
    v2: improve comments, remove extra else-ifs, remove extra typecast
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Snorch authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    08766ef View commit details
    Browse the repository at this point in the history
  142. crit: fix python3 encoding issues

    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    nviennot authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    51c1445 View commit details
    Browse the repository at this point in the history
  143. scripts: alpine: Install py2 packages with pip

    The py-future package has been renamed to py3-future [1] and py2 package
    for yaml has been dropped [2].
    
    [1] https://git.alpinelinux.org/aports/commit/main?id=316d44abaed13964e97eb43c095cd1b64e3943ad
    [2] https://git.alpinelinux.org/aports/commit/main?id=e369c1fd7707a73f2c3e2b11b613198d9a4106de
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    65cd7a6 View commit details
    Browse the repository at this point in the history
  144. sockets: Remove duplicate variable assignment

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    210166b View commit details
    Browse the repository at this point in the history
  145. socket: c/r support for SO_KEEPALIVE

    TCP keepalive packets can be used to determine if a connection
    is still valid. When the SO_KEEPALIVE option is set, TCP packets
    are periodically sent to keep the connection alive.
    
    This patch implements checkpoint/restore support for SO_KEEPALIVE,
    TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT options.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    5dc8827 View commit details
    Browse the repository at this point in the history
  146. zdtm: Add test for SO_KEEPALIVE

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    c8e9637 View commit details
    Browse the repository at this point in the history
  147. Fix tests on Ubuntu

    It seems like Ubuntu introduced a overlayfs change which breaks CRIU:
    
    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1857257
    
    This disables overlayfs (unfortunately) in most tests by switching to
    devicemapper or vfs.
    
    Upstream kernels do not seem to have this problem.
    
    This also adds the 'docker-test' for xenial which still has a working
    overlayfs from CRIU's point of view.
    
    Also adjust Podman Ubuntu package location
    
    Podman Ubuntu packages are now available via OBS and no longer via PPA.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    d5a1c54 View commit details
    Browse the repository at this point in the history
  148. style: Enforce kernel style -Wdeclaration-after-statement

    Include warnings that the kernel uses during compilation:
    -Wdeclaration-after-statement: enforces having variables declared at the top of scopes
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    [Generated a commit message from the pull request]
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    nviennot authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    ee96f50 View commit details
    Browse the repository at this point in the history
  149. style: Enforce kernel style -Wstrict-prototypes

    Include warnings that the kernel uses during compilation:
    -Wstrict-prototypes: enforces full declaration of functions.
    Previously, when declaring extern void func(), one can call func(123)
    and have no compilation error. This is dangerous. The correct declaration
    is extern void func(void).
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    [Generated a commit message from the pull request]
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    nviennot authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    09c918c View commit details
    Browse the repository at this point in the history
  150. net: add nftables c/r

    After Centos-8 nft used instead of iptables. But we had never supported nft rules in
    CRIU, and after c/r all rules are flushed.
    
    Co-developed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander@mihalicyn.com>
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    mihalicyn authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    faf310c View commit details
    Browse the repository at this point in the history
  151. zdtm: nft tables preservation test

    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander@mihalicyn.com>
    [Added test_author to zdtm test]
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    mihalicyn authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    ec1690d View commit details
    Browse the repository at this point in the history
  152. files: fix ghost file error path

    Signed-off-by: Nicolas Viennot <nicolas.viennot@twosigma.com>
    nviennot authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    6905c22 View commit details
    Browse the repository at this point in the history
  153. python: Improve decoding of file flags

    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    nviennot authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    e6946e2 View commit details
    Browse the repository at this point in the history
  154. files: Remove O_CLOEXEC from file flags

    The kernel artificially adds the O_CLOEXEC flag when reading from the
    /proc/fdinfo/fd interface if FD_CLOEXEC is set on the file descriptor
    used to access the file.
    
    This commit removes the O_CLOEXEC flag in our file flags.
    
    To restore the proper FD_CLOEXEC value in each of the file descriptors,
    CRIU uses fcntl(F_GETFD) to retrieve the FD_CLOEXEC status, and restore
    it later with fcntl(F_SETFD). This is necessary because multiple file
    descriptors may point to the same open file.
    nviennot authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    4470237 View commit details
    Browse the repository at this point in the history
  155. files: Add FD_CLOEXEC test

    nviennot authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    74f8c75 View commit details
    Browse the repository at this point in the history
  156. travis: switch alpine to python3

    Now that Python 2 has officially reached its end of life also switch the
    Alpine based test to Python 3.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    de7690d View commit details
    Browse the repository at this point in the history
  157. Add Socket-based Java Functional Tests

    Signed-off-by: Nidhi Gupta <itsnidhi16@gmail.com>
    nidhi1605 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    0d75cd9 View commit details
    Browse the repository at this point in the history
  158. Switch open-j9 alpine tests to python3

    Signed-off-by: Nidhi Gupta <itsnidhi16@gmail.com>
    nidhi1605 authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    32f4f8b View commit details
    Browse the repository at this point in the history
  159. ppc64le: remove register '1' from clobber list

    Compiling 'criu-dev' on Fedora 31 gives two errors about wrong clobber
    lists:
    
    compel/include/uapi/compel/asm/sigframe.h:47:9: error: listing the stack pointer register ‘1’ in a clobber list is deprecated [-Werror=deprecated]
    
    criu/arch/ppc64/include/asm/restore.h:14:2: error: listing the stack pointer register ‘1’ in a clobber list is deprecated [-Werror=deprecated]
    
    There was also a bug report from Debian that CRIU does not build because
    of this.
    
    Each of these errors comes with the following note:
    
    note: the value of the stack pointer after an ‘asm’ statement must be the same as it was before the statement
    
    As far as I understand it this should not be a problem in this cases as
    the code never returns anyway.
    
    Running zdtm very seldom fails during 'zdtm/static/cgroup_ifpriomap'
    with a double free or corruption. This happens not very often and I
    cannot verify if it happens without this patch. As CRIU does not build
    without the patch.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    72925cc View commit details
    Browse the repository at this point in the history
  160. image: core -- Reserve start_time field

    To ensure consistency of runtime environment processes within a
    container need to see same start time values over suspend/resume
    cycles. We introduce new field to the core image structure to
    store start time of a dumped process. Later same value would be
    restored to a newly created task. In future the feature is likely
    to be pulled here, so we reserve field id in protobuf descriptor.
    
    Signed-off-by: Valeriy Vdovin <valeriy.vdovin@virtuozzo.com>
    valeriyvdovin authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    2121d21 View commit details
    Browse the repository at this point in the history
  161. travis: reduce the number of podman tests

    We are running each podman test loop 50 times. This takes more than 20
    minutes in Travis. Reduce both test loops to only run 20 times.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    7e7b647 View commit details
    Browse the repository at this point in the history
  162. kerndat: detect if system support clone3() with set_tid

    Linux kernel 5.4 extends clone3() with set_tid to allow processes to
    specify the PID of a newly created process. This introduces detection
    of the clone3() syscall and if set_tid is supported.
    
    This first implementation is X86_64 only.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    bde7bea View commit details
    Browse the repository at this point in the history
  163. Add assembler wrapper for clone3()

    To create a new process/thread with a certain PID based on clone3() a
    new assembler wrapper is necessary as there is not glibc wrapper (yet).
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    e97bc57 View commit details
    Browse the repository at this point in the history
  164. Use clone3() with set_tid to create processes

    With the in Linux Kernel 5.4 introduced clone3() with set_tid it is no
    longer necessary to write to to /proc/../ns_last_pid to influence the
    next PID number. clone3() can directly select a PID for the newly
    created process/thread.
    
    After checking for the availability of clone3() with set_tid and adding
    the assembler wrapper for clone3() in previous patches, this extends
    criu/pie/restorer.c and criu/clone-noasan.c to use the newly added
    assembler clone3() wrapper to create processes with a certain PID.
    
    This is a RFC and WIP, but I wanted to share it and run it through CI
    for feedback. As the CI will probably not use a 5.4 based kernel it
    should just keep on working as before.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    2082c03 View commit details
    Browse the repository at this point in the history
  165. s390x: remove stack pointer from clobber list

    Just like on all other supported architectures gcc complains about the
    stack pointer register being part of the clobber list:
    
    error: listing the stack pointer register ‘15’ in a clobber list is deprecated [-Werror=deprecated]
    
    This removes the stack pointer from the clobber list.
    
    'zdtm.py run -a' still runs without any errors after this change.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    c53ed92 View commit details
    Browse the repository at this point in the history
  166. s390x: use clone3() if possible

    This adds the parasite clone3() with set_tid wrapper for s390x.
    
    In contrast to the x86_64 implementation the thread start address and
    arguments are not put on the thread stack but passed via r4 and r5. As
    those registers are caller-saved they still contain the correct value
    (thread start address and arguments) after returning from the syscall.
    
    Tested on 5.5.0-rc6.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    0f0564a View commit details
    Browse the repository at this point in the history
  167. arm: remove stack pointer from clobber list

    Just like on all other supported architectures gcc complains about the
    stack pointer register being part of the clobber list. This removes the
    stack pointer from the clobber list.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    b2d9412 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2020

  1. ppc64le: use clone3() if possible

    This adds the parasite clone3() with set_tid wrapper for ppc64le.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 26, 2020
    Configuration menu
    Copy the full SHA
    0d9209d View commit details
    Browse the repository at this point in the history

Commits on Jan 29, 2020

  1. clone3: handle clone3() with CLONE_PARENT

    clone3() explicitly blocks setting an exit_signal if CLONE_PARENT is
    specified. With clone() it also did not work, but there was no error
    message. The exit signal from the thread group leader is taken.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 29, 2020
    Configuration menu
    Copy the full SHA
    a369581 View commit details
    Browse the repository at this point in the history

Commits on Jan 30, 2020

  1. aarch64: use clone3() if possible

    This adds the parasite clone3() with set_tid wrapper for aarch64.
    
    Tested on Fedora 31 with 5.5.0-rc6.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 30, 2020
    Configuration menu
    Copy the full SHA
    784919b View commit details
    Browse the repository at this point in the history
  2. arm: use clone3() if it exists

    This is the last architecture specific change to make CRIU use clone3()
    with set_tid if available. Just as on all other architectures this adds
    a clone3() based assembler wrapper to be used in the restorer code.
    
    Tested on Fedora 31 with the same 5.5.0-rc6 kernel as on the other
    architectures.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Jan 30, 2020
    Configuration menu
    Copy the full SHA
    8d108a9 View commit details
    Browse the repository at this point in the history

Commits on Feb 4, 2020

  1. travis: fix warning and errors from validation

    This fixes the validation errors from Travis:
    
     Build config validation
     root: deprecated key sudo (The key `sudo` has no effect anymore.)
     root: missing os, using the default linux
     root: key matrix is an alias for jobs, using jobs
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Feb 4, 2020
    Configuration menu
    Copy the full SHA
    f075c1d View commit details
    Browse the repository at this point in the history
  2. compel: add -ffreestanding to force gcc not to use builtin memcpy, me…

    …mset
    
    This patch fixes the problem with SSE (xmm) registers corruption on amd64
    architecture. The problem was that gcc generates parasite blob that uses
    xmm registers, but we don't preserve this registers in CRIU when injecting
    parasite. Also, gcc, even with -nostdlib option uses builtin memcpy,
    memset functions that optimized for amd64 and involves SSE registers.
    
    It seems, that optimal solution is to use -ffreestanding gcc option
    to compile parasite. This option implies -fno-builtin and also it designed
    for OS kernels compilation/another code that suited to work on non-hosted
    environments and could prevent future sumilar bugs.
    
    To check that you amd64 CRIU build affected by this problem you could simply
    objdump -dS criu/pie/parasite.o | grep xmm
    Output should be empty.
    
    Reported-by: Diyu Zhou <zhoudiyupku at gmail.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander@mihalicyn.com>
    mihalicyn authored and avagin committed Feb 4, 2020
    Configuration menu
    Copy the full SHA
    bdcf709 View commit details
    Browse the repository at this point in the history
  3. doc/Makefile: don't hide xmlto stderr

    In case asciidoc is installed and xmlto is not, make returns an error
    but there's no diagnostics shown, since "xmlto: command not found"
    goes to /dev/null.
    
    Remove the redirect.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin authored and avagin committed Feb 4, 2020
    Configuration menu
    Copy the full SHA
    049cd5b View commit details
    Browse the repository at this point in the history
  4. criu(8): some minor rewording

    1. Add a/the articles where I see them missing
    
    2. s/Forbid/disable/
    
    3. s/crit/crit(1)/ as we're referring to a man page
    
    4. Simplify some descriptions
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin authored and avagin committed Feb 4, 2020
    Configuration menu
    Copy the full SHA
    9d219e8 View commit details
    Browse the repository at this point in the history
  5. criu(8): fix for asciidoctor

    Commit 0493724 added support for using asciidoctor
    (instead of asciidoc + xmlto) to generate man pages.
    
    For some reason, asciidoctor does not deal well with some
    complex formatting that we use for options such as --external,
    leading to literal ’ and ' appearing in the man page instead
    of italic formatting. For example:
    
    > --inherit-fd fd[’N']:’resource'
    
    (here both N and resource should be in italic).
    
    Asciidoctor documentation (asciidoctor --help syntax) tells:
    
    > == Text Formatting
    >
    > .Constrained (applied at word boundaries)
    > *strong importance* (aka bold)
    > _stress emphasis_ (aka italic)
    > `monospaced` (aka typewriter text)
    > "`double`" and '`single`' typographic quotes
    > +passthrough text+ (substitutions disabled)
    > `+literal text+` (monospaced with substitutions disabled)
    >
    > .Unconstrained (applied anywhere)
    > **C**reate+**R**ead+**U**pdate+**D**elete
    > fan__freakin__tastic
    > ``mono``culture
    
    so I had to carefully replace *bold* with **bold** and
    'italic' with __italic__ to make it all work.
    
    Tested with both terminal and postscript output, with both
    asciidoctor and asciidoc+xmlto.
    
    TODO: figure out how to fix examples (literal multi-line text),
    since asciidoctor does not display it in monospaced font (this
    is only true for postscript/pdf output so low priority).
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin authored and avagin committed Feb 4, 2020
    Configuration menu
    Copy the full SHA
    0011cbb View commit details
    Browse the repository at this point in the history
  6. criu: fix build failure against gcc-10

    On gcc-10 (and gcc-9 -fno-common) build fails as:
    
    ```
    ld: criu/arch/x86/crtools.o:criu/include/cr_options.h:159:
      multiple definition of `rpc_cfg_file'; criu/arch/x86/cpu.o:criu/include/cr_options.h:159: first defined here
    make[2]: *** [scripts/nmk/scripts/build.mk:164: criu/arch/x86/crtools.built-in.o] Error 1
    ```
    
    gcc-10 will change the default from -fcommon to fno-common:
    https://gcc.gnu.org/PR85678.
    
    The error also happens if CFLAGS=-fno-common passed explicitly.
    
    Reported-by: Toralf Förster
    Bug: https://bugs.gentoo.org/707942
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
    Sergei Trofimovich authored and avagin committed Feb 4, 2020
    Configuration menu
    Copy the full SHA
    af9157f View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2020

  1. test/vdso: check the code path when here is no API to map vDSO

    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Feb 5, 2020
    Configuration menu
    Copy the full SHA
    c172688 View commit details
    Browse the repository at this point in the history
  2. vdso: use correct offsets to remap vdso and vvar mappings

    In the current version, the offsets of remapping vvar and vdso regions
    are mixed up.
    
    If vdso is before vvar, vvar has to be mapped with the vdso_size offset.
    if vvar is before vdso, vdso has to be mapped with the vvar_size offset.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Feb 5, 2020
    Configuration menu
    Copy the full SHA
    f32a4e4 View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2020

  1. typo: fix missing space in error message

    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    nviennot authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    83e0882 View commit details
    Browse the repository at this point in the history
  2. memfd: add file support

    See "man memfd_create" for more information of what memfd is.
    
    This adds support for memfd open files, that are not not memory mapped.
    
    * We add a new kind of file: MEMFD.
    * We add two image types MEMFD_FILE, and MEMFD_INODE.
      MEMFD_FILE contains usual file information (e.g., position).
      MEMFD_INODE contains the memfd name, and a shmid identifier
      referring to the content.
    * We reuse the shmem facilities for dumping memfd content as it
      would be easier to support incremental checkpoints in the future.
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    nviennot authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    c365f70 View commit details
    Browse the repository at this point in the history
  3. files: increase path buffer size in inherited_fd()

    Prepare memfd to use inherited_fd(), needing long path names support.
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    nviennot authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    1386dbb View commit details
    Browse the repository at this point in the history
  4. memfd: add --inherit-fd support

    Upon file restore, inherited_fd() is called to check for a user-defined
    inerit-fd override. Note that the MEMFD_INODE image is read at each
    invocation (memfd name is not cached).
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    nviennot authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    883d3e4 View commit details
    Browse the repository at this point in the history
  5. memfd: add memory mapping support

    * During checkpoint, we add a vma flags: VMA_AREA_MEMFD to denote memfd
      regions.
    * Even though memfd is backed by the shmem device, we use the file
      semantics of memfd (via /proc/map_files/<vma>) which we already have
      support for.
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    nviennot authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    8c006c2 View commit details
    Browse the repository at this point in the history
  6. memfd: add seals support

    See "man fcntl" for more information about seals.
    
    memfd are the only files that can be sealed, currently. For this
    reason, we dump the seal values in the MEMFD_INODE image.
    
    Restoring seals must be done carefully as the seal F_SEAL_FUTURE_WRITE
    prevents future write access. This means that any memory mapping with
    write access must be restored before restoring the seals.
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    nviennot authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    3eb95b5 View commit details
    Browse the repository at this point in the history
  7. inhfd_test: add support for non-pair files

    File pairs naturally block on read() until the write() happen (or the
    writer is closed). This is not the case for regular files, so we
    take extra precaution for these.
    
    Also cleaned-up an extra my_file.close()
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    nviennot authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    557b191 View commit details
    Browse the repository at this point in the history
  8. memfd: add tests

    Testing for all the memfd features, namely support for CR of:
    * the same fd shared by multiple processes
    * the same file shared by multiple processes
    * the memfd content
    * file flags and fd flags
    * mmaps, MAP_SHARED and MAP_PRIVATE
    * seals, excluding F_SEAL_FUTURE_WRITE because this feature only exists
      in recent kernels (5.1 and up)
    * inherited fd
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    nviennot authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    6cf5182 View commit details
    Browse the repository at this point in the history
  9. criu: Use strlcpy() instead of strncpy()

    gcc8 in Fedora Rawhide has a new useful warning:
    
    > criu/img-remote.c: In function 'push_snapshot_id':
    > criu/img-remote.c:1099:2: error: 'strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation]
    >  1099 |  strncpy(rn.snapshot_id, snapshot_id, PATH_MAX);
    >       |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    From man 3 strncpy:
    > Warning:  If there is no null byte among the first n bytes of src,
    > the string placed in dest will not be null-terminated.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    9049d7b View commit details
    Browse the repository at this point in the history
  10. criu: Make use strlcpy() to copy into allocated strings

    strncpy() with n == strlen(src) won't put NULL-terminator in dst.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    6875c9a View commit details
    Browse the repository at this point in the history
  11. zdtm: Make test_{doc,author} weak variables

    Allows to override them in every test, optionally.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    7491326 View commit details
    Browse the repository at this point in the history
  12. vdso: Add vdso_is_present() helper

    Use it in kerndat to check if the kernel provides vDSO.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    a3501c0 View commit details
    Browse the repository at this point in the history
  13. vdso: Repair !CONFIG_VDSO

    Apparently, C/R is broken when CONFIG_VDSO is not set.
    Probably, I've broken it while adding arm vdso support.
    Or maybe some commits after.
    
    Repair it by adding checks into vdso_init_dump(), vdso_init_restore().
    Also, don't try handling vDSO in restorer if it wasn't present in
    parent. And prevent summing VDSO_BAD_SIZE to {vdso,vvar}_rt_size.
    
    Reported-by: Adrian Reber <areber@redhat.com>
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    fa292e4 View commit details
    Browse the repository at this point in the history
  14. vdso: Don't page-align vvar

    It's always page-aligned (as any VMA).
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    540ab31 View commit details
    Browse the repository at this point in the history
  15. zdtm: mntns_rw_ro_rw update error msg

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    7150497 View commit details
    Browse the repository at this point in the history

Commits on Feb 10, 2020

  1. Travis: fix podman test case

    Podman changed the output of 'podman ps'. For the test only running
    containers are interesting. Adding the filter '-f status=running' only
    returns running containers as previously.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Feb 10, 2020
    Configuration menu
    Copy the full SHA
    43a7b34 View commit details
    Browse the repository at this point in the history

Commits on Feb 16, 2020

  1. test/zdtm/inhfd: update dump options one each iteration

    This allows to run inhfd tests with many iterations of C/R.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Feb 16, 2020
    Configuration menu
    Copy the full SHA
    b5e857b View commit details
    Browse the repository at this point in the history
  2. python: sort imports

    202 Additional newline in a group of imports.
    I100 Import statements are in the wrong order.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Feb 16, 2020
    Configuration menu
    Copy the full SHA
    a6083ea View commit details
    Browse the repository at this point in the history

Commits on Feb 21, 2020

  1. test/jenkins: remove empty line at the end of file

    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Snorch authored and avagin committed Feb 21, 2020
    Configuration menu
    Copy the full SHA
    285e689 View commit details
    Browse the repository at this point in the history

Commits on Feb 29, 2020

  1. uffd: use userns_call() to execute ioctl(UFFDIO_API)

    In the recent kernels the userfaultfd support for FORK events is limited to
    CAP_SYS_PTRACE. That causes the followong error when the ioctl(UFFDIO_API)
    is executed from non-privilieged userns:
    
    Error (criu/uffd.c:273): uffd: Failed to get uffd API: Operation not permitted
    
    Wrapping the call to ioctl(UFFDIO_API) in userns_call() resolves the issue.
    
    Fixes: checkpoint-restore#964
    Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
    rppt authored and avagin committed Feb 29, 2020
    Configuration menu
    Copy the full SHA
    a5f6158 View commit details
    Browse the repository at this point in the history
  2. criu(8): Add documentation for --enable-fs

    This option was introduced with:
    
    checkpoint-restore@e2c3824
    
    v2: (comment from Pavel Tikhomirov) --enable-fs does not fit with
    --external dev[]:, see try_resolve_ext_mount, external dev mounts
    only determined for FSTYPE__UNSUPPORTED.
    
    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Feb 29, 2020
    Configuration menu
    Copy the full SHA
    832ab07 View commit details
    Browse the repository at this point in the history
  3. criu(8): Convert tabs to spaces

    Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    rst0git authored and avagin committed Feb 29, 2020
    Configuration menu
    Copy the full SHA
    30b07fc View commit details
    Browse the repository at this point in the history
  4. seize: prepare for cgroupv2 freezer

    The cgroupv2 freezer does not return the same strings as v1. Instead of
    THAWED and FROZEN v2 returns 0 and 1 (strings). This prepares the seize
    code to use 0 and 1 everywhere and THAWED and FROZEN only for v1
    specific code paths.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Feb 29, 2020
    Configuration menu
    Copy the full SHA
    4c27b3d View commit details
    Browse the repository at this point in the history
  5. seize: factor out opening and writing the freezer state

    More preparations for cgroupv2 freezer. Factor our the freezer state
    opening and writing to have one location where to handle v1 and v2
    differences.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Feb 29, 2020
    Configuration menu
    Copy the full SHA
    aac4116 View commit details
    Browse the repository at this point in the history
  6. seize: support cgroup v2 freezer

    This adds support to checkpoint processes using the cgroup v2 freezer.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Feb 29, 2020
    Configuration menu
    Copy the full SHA
    6f19249 View commit details
    Browse the repository at this point in the history
  7. cgroup2: add minimal cgroup2 support

    The runc test cases are (sometimes) mounting a cgroup inside of the
    container. For these tests to succeed, let CRIU know that cgroup2 exists
    and how to restore such a mount.
    
    This does not fix any specific cgroup2 settings, it just enables CRIU to
    mount cgroup2 in the restored container.
    
    Signed-off-by: Adrian Reber <areber@redhat.com>
    adrianreber authored and avagin committed Feb 29, 2020
    Configuration menu
    Copy the full SHA
    378337a View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2020

  1. fs: use __open_proc instead of open("/proc/...", ... )

    Processes can run in a mount namespace without /proc.
    
    Reported-by: Mr Jenkins
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    0c4b856 View commit details
    Browse the repository at this point in the history
  2. memfd: don't corrupt a state of the dumped fd

    Right now, criu uses a dumped fd to dump content of a memfd "file".
    
    Here are two reasons why we should not do this:
    * a state of a dumped fd doesn't have to be changed, but now criu calls
      lseek on it. This can be workarounded by using pread.
    * a dumped descriptor can be write-only.
    
    Reported-by: Mr Jenkins
    Cc: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    9be35de View commit details
    Browse the repository at this point in the history
  3. zdtm/inhfd: force python to read new data from a file

    python 2.7 doesn't call the read system call if it's read file to the
    end once. The next seek allows to workaround this problem.
    
    inhfd/memfd.py hangs due to this issue.
    
    Reported-by: Mr Jenkins
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    e333749 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2020

  1. fown: Don't fail on dumping files opened with O_PATH

    O_PATH opened files are special: they have empty
    file operations in kernel space, so there not that
    much we can do with them, even setting position is
    not allowed. Same applies to a signal number for
    owner settings.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
    Co-developed-by: Alexander Mikhalitsyn <alexander@mihalicyn.com>
    Signed-off-by: Alexander Mikhalitsyn (Virtuozzo) <alexander@mihalicyn.com>
    cyrillos authored and avagin committed Mar 5, 2020
    Configuration menu
    Copy the full SHA
    52c5dd5 View commit details
    Browse the repository at this point in the history
  2. zdtm: add a test for files opened with O_PATH

    On these test without the patch ("fown: Don't fail on dumping files opened
    wit O_PATH") we trigger these errors:
    
    Error (criu/pie/parasite.c:340): fcntl(4, F_GETOWN_EX) -> -9
    Error (criu/files.c:403): Can't get owner signum on 18: Bad file descriptor
    Error (criu/files-reg.c:1887): Can't restore file pos: Bad file descriptor
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Signed-off-by: Alexander Mikhalitsyn (Virtuozzo) <alexander@mihalicyn.com>
    Snorch authored and avagin committed Mar 5, 2020
    Configuration menu
    Copy the full SHA
    a90e88d View commit details
    Browse the repository at this point in the history
  3. files: allow dumping opened symlinks

    To really open symlink file and not the regular file below it, one needs
    to do open with O_PATH|O_NOFOLLOW flags. Looks like systemd started to
    open /etc/localtime symlink this way sometimes, and before that nobody
    actually used this and thus we never supported this in CRIU.
    
    Error (criu/files-ext.c:96): Can't dump file 11 of that type [120777]
    (unknown /etc/localtime)
    
    Looks like it is quiet easy to support, as c/r of symlink file is almost
    the same as c/r of regular one. We need to only make fstatat not
    following links in check_path_remap.
    
    Also we need to take into account support of ghost symlinks.
    
    Signed-off-by: Alexander Mikhalitsyn (Virtuozzo) <alexander@mihalicyn.com>
    Co-developed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    mihalicyn authored and avagin committed Mar 5, 2020
    Configuration menu
    Copy the full SHA
    657268d View commit details
    Browse the repository at this point in the history
  4. zdtm: add a test on open symlink migration

    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Co-Developed-by: Vitaly Ostrosablin <vostrosablin@virtuozzo.com>
    Signed-off-by: Vitaly Ostrosablin <vostrosablin@virtuozzo.com>
    Signed-off-by: Alexander Mikhalitsyn (Virtuozzo) <alexander@mihalicyn.com>
    Snorch authored and avagin committed Mar 5, 2020
    Configuration menu
    Copy the full SHA
    27807fb View commit details
    Browse the repository at this point in the history

Commits on Mar 9, 2020

  1. zdtm/fifo_loop: don't try to write more than pipe size

    ... otherwise write() can block.
    
    Reported-by: Mr Jenkins
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Mar 9, 2020
    Configuration menu
    Copy the full SHA
    84ad718 View commit details
    Browse the repository at this point in the history
  2. criu: Remove compel.h includes

    The plan is to remove "compel.h". That file only includes other headers
    (which may be not needed). If we aim for one-include-for-compel, we
    could instead paste all subheaders into "compel.h".
    Rather, I think it's worth to migrate to more fine-grained compel
    headers than follow the strategy 'one header to rule them all'.
    
    Further, the header creates problems for cross-compilation: it's
    included in files, those are used by host-compel. Which rightfully
    confuses compiler/linker as host's definitions for fpu regs/other
    platform details get drained into host's compel.
    
    As a first step - stop including "compel.h" in criu.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Mar 9, 2020
    Configuration menu
    Copy the full SHA
    8ca165e View commit details
    Browse the repository at this point in the history
  3. compel: Remove compel.h

    The file only includes other headers (which may be not needed).
    If we aim for one-include-for-compel, we could instead paste all
    subheaders into "compel.h".
    Rather, I think it's worth to migrate to more fine-grained compel
    headers than follow the strategy 'one header to rule them all'.
    
    Further, the header creates problems for cross-compilation: it's
    included in files, those are used by host-compel. Which rightfully
    confuses compiler/linker as host's definitions for fpu regs/other
    platform details get drained into host's compel.
    
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Mar 9, 2020
    Configuration menu
    Copy the full SHA
    fb386c2 View commit details
    Browse the repository at this point in the history
  4. travis: Add aarch64-cross test on amd64

    Fixes: checkpoint-restore#924
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Mar 9, 2020
    Configuration menu
    Copy the full SHA
    e419f2e View commit details
    Browse the repository at this point in the history
  5. travis: Use debian/buster as base for cross build tests

    Jessie is called 'oldoldstable', migrate to Buster.
    
    Suggested-by: Adrian Reber <areber@redhat.com>
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    0x7f454c46 authored and avagin committed Mar 9, 2020
    Configuration menu
    Copy the full SHA
    037aaf9 View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2020

  1. crit-recode: skip (not try to parse) nftables raw image

    We should ignore (not parse) images that has non-crtool format,
    that images has no magic number (RAW_IMAGE_MAGIC equals 0).
    
    nftables images has format compatible with `nft -f /proc/self/fd/0`
    input format.
    
    Reported-by: Mr Jenkins
    Signed-off-by: Alexander Mikhalitsyn (Virtuozzo) <alexander@mihalicyn.com>
    mihalicyn authored and avagin committed Mar 14, 2020
    Configuration menu
    Copy the full SHA
    717de3e View commit details
    Browse the repository at this point in the history

Commits on Mar 15, 2020

  1. travis: add ppc64-cross test on amd64

    Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
    rppt authored and avagin committed Mar 15, 2020
    Configuration menu
    Copy the full SHA
    e7c8ac1 View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2020

  1. mailmap: update my email

    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Mar 21, 2020
    Configuration menu
    Copy the full SHA
    e0fca8b View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2020

  1. make: use cflags/ldflags for config.h detection mechanism

    The config.h detection scripts should use the provided CFLAGS/LDFLAGS
    as it tries to link libnl, libnet, and others.
    
    Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
    nviennot authored and avagin committed Mar 23, 2020
    Configuration menu
    Copy the full SHA
    9433b7b View commit details
    Browse the repository at this point in the history
  2. mem: dump shared memory file descriptors

    Any shared memroy mapping can be opened via /proc/self/maps_files/.
    Such file descriptors look like memfd file descriptors, so
    they can be dumped by the same way.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Mar 23, 2020
    Configuration menu
    Copy the full SHA
    2334261 View commit details
    Browse the repository at this point in the history
  3. mem/vma: set VMA_FILE_{PRIVATE,SHARED} if a vma file is borrowed

    Here is a fast path when two consequent vma-s share the same file.
    
    But one of these vma-s can map a file with MAP_SHARED, but another one
    can map it with MAP_PRIVATE and we need to take this into account.
    avagin committed Mar 23, 2020
    Configuration menu
    Copy the full SHA
    27c6039 View commit details
    Browse the repository at this point in the history
  4. test/zdtmp: add a test to C/R shared memory file descriptors

    Any shared memory region can be openned via /proc/self/map_files.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Mar 23, 2020
    Configuration menu
    Copy the full SHA
    941d31b View commit details
    Browse the repository at this point in the history
  5. zdtm: Implemented get_current_dir_name wrapper that checks for 'x' pe…

    …rmissions
    
    Any filesystem syscall, that needs to navigate to inode by it's
    absolute path performs successive lookup operations for each part of the
    path. Lookup operation includes access rights check.
    Usually but not always zdtm tests processes fall under 'other' access
    category. Also, usually directories don't have 'x' bit set for other.
    In case when bit 'x' is not set and user-ID and group-ID of a process
    relate it to 'other', test's will not succeed in performing these
    syscalls which are most of filesystem api, that has const char *path
    as part of it arguments (open, openat, mkdir, bind, etc).
    The observable behavior of that is that zdtm tests fail at file
    creation ops on one system and pass on the other. The above is not
    immediately clear to the developer by just looking at failed test's logs.
    Investigation of that is also not quick for a developer due to the
    complex structure of zdtm runtime where nested clones with
    NAMESPACE flags take place alongside with bind-mounts.
    
    As an additional note: 'get_current_dir_name' is documented as returning
    EACCESS in case when some part of the path lacks read/list permissions.
    But in fact it's not always so. Practice shows, that test processes can
    get false success on this operation only to fail on later call to
    something like mkdir/mknod/bind with a given path in arguments.
    
    'get_cwd_check_perm' is a wrapper around 'get_current_dir_name'. It also
    checks for permissions on the given filepath and logs the error. This
    directs the developer towards the right investigation path or even
    eliminates the need for investigation completely.
    
    Signed-off-by: Valeriy Vdovin <valeriy.vdovin@virtuozzo.com>
    valeriyvdovin authored and avagin committed Mar 23, 2020
    Configuration menu
    Copy the full SHA
    419ccc9 View commit details
    Browse the repository at this point in the history
  6. zdtm: Use safe helper function to initialize unix socket sockaddr str…

    …ucture
    
    The helper function removes code duplication from tests that want to
    initialize unix socket address to an absolute file path, derived from
    current working directory of the test + relative filename of a resulting
    socket. Because the former code used cwd = get_current_dir_name() as
    part of absolute filename generation, the resulting filepath could later
    cause failure of bind systcall due to unchecked permissions and
    introduce confusing permission errors.
    
    Signed-off-by: Valeriy Vdovin <valeriy.vdovin@virtuozzo.com>
    valeriyvdovin authored and avagin committed Mar 23, 2020
    Configuration menu
    Copy the full SHA
    f883e92 View commit details
    Browse the repository at this point in the history

Commits on Mar 24, 2020

  1. pipe: restore pipe size even if a pipe is empty

    Without this patch, pipe size is restored only if a pipe has
    queued data.
    
    Reported-by: Mr Jenkins
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    49cc6ce View commit details
    Browse the repository at this point in the history
  2. test/pipe03: check that pipe size is restored

    Create two pipes with and without queued data.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    b00267e View commit details
    Browse the repository at this point in the history
  3. test/fifo_loop: change sizes of all fifo-s to fit a test buffer

    This test doesn't expect that the write operation will block.
    
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    avagin committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    d2b99a2 View commit details
    Browse the repository at this point in the history
  4. vz7: sockets: Separate socket buffer size setting into a helper

    It is known that for unix sockets we need to setup
    qlen first before restoring queue itself, otherwise
    there might be not enough place for data.
    
    Thus move the snippet into separate helper. Most
    likely we will merge it back again once it's
    been proved that for any kind of sockets it
    is safe to setup all options before queue
    data itself.
    
    https://jira.sw.ru/browse/PSBM-63762
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    ff6c7d9 View commit details
    Browse the repository at this point in the history
  5. sk-unix -- Restore qlen before pushing queued data back

    The size of qlen may be bigger than one provided by kernel as default,
    so pushing data may lead to
    
    Error (criu/sk-queue.c:500): Failed to send packet: Resource temporarily unavailable
    
    ie to -EAGAIN.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander@mihalicyn.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    f42491e View commit details
    Browse the repository at this point in the history
  6. unix: image -- Move uflags into enum

    This values are part of abi, so must be set in image file.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander@mihalicyn.com>
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    c6d3f25 View commit details
    Browse the repository at this point in the history
  7. unix: Collect bindmounted unix sockets

    Mount points might be beindmount to some resources (say unix binded
    sockets) thus when times come to do real bind mount call we need
    to prepare appropriate resource first.
    
    On dump procedure we walk over all bind-mounts and check if
    the mountpoint is a unix socket saving the mnt_id into
    the image then. To distinguish such sockets from others
    we use UNIX_UFLAGS__BINDMOUNT flag.
    
    Note at moment we support only DGRAM closed sockets.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
    cyrillos authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    1b85265 View commit details
    Browse the repository at this point in the history
  8. unix: Collect images before opening mountpoints

    Because we need to gather unix sockets earlier than
    we start creating mount tree. Thus we will be able
    to handle bindmounted sockets.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
    cyrillos authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    9d83f94 View commit details
    Browse the repository at this point in the history
  9. unix: Collect bindmounted unix sockets into own list

    So when we will be examinating mount points and
    sockets we won't waste time on non-bindmounted.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
    cyrillos authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    b2b2bfb View commit details
    Browse the repository at this point in the history
  10. unix: Move shared data init into early stage

    We will need to take mutex when bind()
    bindmounted sockets. Strictly speaking we
    won't support bindmounted and deleted sockets
    for now but better prepare this scaffolds early.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
    cyrillos authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    5dda301 View commit details
    Browse the repository at this point in the history
  11. unix: Add support for bindmounted sockets

    Some unix sockets might be bindmounted (say /dev/log
    bound to another place). So to handle it we need to
    change the logic we open such sockets especially
    because we create mount tree earlier than we start
    to restore files.
    
    Thus here what we do:
    
     - on dump mark such sockets with UNIX_UFLAGS__BINDMOUNT
       flag so we would distinguish them on restore;
    
     - collect unix sockets before creating mount tree;
       note that at this moment we able to simply gather
       this sockets into own @unix_mnt_sockets list and
       nothing more because setting up the peers and such
       happens later in that named post action procedures;
    
     - when we need to create a bindmount point we enter
       into unix engine and figure out if there a socket
       to bindmount over; if found we pre-allocate the
       socketpair, bind it and save inside fdstore engine;
       using socketpair is important because later we need
       both peers to restore queued data;
    
     - finally when we start restoring files we simply
       fetch the socket from the fdstore and use it
       directly.
    
    All this scheme is working simply because we support
    dgram standalone sockets only, adding support for
    streamed sockets requires a way more engine rework
    and hopefully we won't need it in near future.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    b2ee9fa View commit details
    Browse the repository at this point in the history
  12. unix: test -- Add bind-mount-unix test case

    To test a case where unix socket is bind mounted to somewhere
    so restore may fail if socket has not been created.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    3ec1c5a View commit details
    Browse the repository at this point in the history
  13. unix: bindmount -- Move mounting code to be called before first mount

    Otherwise the mount call may fail since bindmounted unix socket
    wont be created.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    6c9ee70 View commit details
    Browse the repository at this point in the history
  14. zdtm: Add sstrncpy helper

    To elimitane compilation warnings with gcc-8.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
    cyrillos authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    271a6cb View commit details
    Browse the repository at this point in the history
  15. unix: bindmount -- Show details about queuer

    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    803ffb0 View commit details
    Browse the repository at this point in the history
  16. unix: break_connected -- Add a log recod

    For better debug
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    6ee1ad6 View commit details
    Browse the repository at this point in the history
  17. unix: make_socket -- Add more detailed logs

    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    32e74c2 View commit details
    Browse the repository at this point in the history
  18. unix: make_socket -- Break connected pair if requested

    No need to check for pair argument, it is rather confusing.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    7f93219 View commit details
    Browse the repository at this point in the history
  19. unix: bind_unix_sk -- Add ability to skip waiters notification

    Currently bind_unix_sk is used in two contexts: to bind freshly
    created socket pairs and to bind name for sockets which are
    to be queued into fdstore (binmounted sockets). For first
    case we should notify the waiting side immediately but
    in turn bindmount sockets are created early and there might
    be the case where peers are not yet even opened and notification
    may simply lost or even cause sigsegv since file list is yet
    empty. In turn we should defer it until we do a real bindmount
    socket opening right after we fetched it from the fdstore.
    
    https://jira.sw.ru/browse/PSBM-88274
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    2f9a89f View commit details
    Browse the repository at this point in the history
  20. unix: unlink_sk -- Don't unlink bindmounted sockets

    The unlink procedure is rather a cleanup before we
    start creating new sockets, but bindmounted sockets
    are pre-created early so we should not touch them.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    9581911 View commit details
    Browse the repository at this point in the history
  21. unix: unix_prepare_bindmount -- Allow to connect via relative name

    Once socket is bounded we should allow to connect to us
    via relative name.
    
    https://jira.sw.ru/browse/PSBM-88274
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    726f6b0 View commit details
    Browse the repository at this point in the history
  22. test: bind-mount-unix -- Implement real connect

    Also full rework to make sure we can test the situation
    where client is not yet opened when we're restoring
    bindmount.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    95c2c84 View commit details
    Browse the repository at this point in the history
  23. unix: Don't forget to close ns descriptor on error path

    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    2aa32b3 View commit details
    Browse the repository at this point in the history
  24. unix: Disable switching mount namespace

    Previously we always created sockets in root mount
    namespace but in 019ebec
    we've tried to resolve this problem setting up proper
    mount namespace. This is not always possible though:
    the root task from which we trying to switch ns might
    already have a number of children with CLONE_FS|CLONE_FILES
    set and kernel doesn't allow to do that.
    
    Lets disable this ability until we find a proper solution.
    
    https://jira.sw.ru/browse/PSBM-89126
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Cyrill Gorcunov authored and mihalicyn committed Mar 24, 2020
    Configuration menu
    Copy the full SHA
    bdc533e View commit details
    Browse the repository at this point in the history