1. 10 May, 2017 6 commits
    • Pavel Emelyanov's avatar
      files: No getpid in vain · 7a1944ba
      Pavel Emelyanov authored
      Each opening of a file results in getpid() call which
      is now a pure syscall :( For this particular case this
      value is poitless, as log engine already prints pids.
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
      7a1944ba
    • Pavel Emelyanov's avatar
      restore: Don't parse /proc/pid/threads for single-threaded tasks · e3538116
      Pavel Emelyanov authored
      We do this to get real pids of the threads, but sometimes
      we just know that value.
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
      e3538116
    • Veronika Kabatova's avatar
      Extend the parser to accept negative options · f17b60ef
      Veronika Kabatova authored
      Introducing negative options for true / false values. The original
      getopt_long parser is kept since it is able to set flag-like values
      (instead of setting these values in the switch when it's not needed).
      The type of the options needed to be changed to integers for getopt_long
      to accept flag-like value settings (as per getopt_long documentation,
      the address of integer variable has to be passed).
      
      Corresponding negative options are not added for deprecated options.
      
      This patch is a preparation for the addition of configuration files
      (GitHub issue #278). General idea of this feature is to have global
      configuration files in /etc/criu.d/ directory and user-specific
      configuration files in $HOME/.criu.d/ directory, with the possibility
      of specifying a chosen file to be used (default files will be used if
      none is specified, or none in case the default ones are not present,
      to not break compatibility). The options in configuration files should
      be possible to be overriden by the options specified on command line,
      hence the negative options addition.
      
      The whole feature of configuration files will remove the need of
      specifying all the options on command line, with the possibility of
      reusing a file for different use case with only overriding some of the
      values specified there.
      
      In case both types of option (negative and positive) are passed, the
      later one will be applied -- this works with the philosophy of
      overriding the "earlier" options from configuration files.
      
      Changes since v1:
      - Describe the --no- option prefix in the beginning of OPTIONS section in
        both man page and --help instead of mentioning it at every eligible line
        (this also fixes line length issue with --help)
      - Fix the accidental removal of check_only case caused by bad rebase
      - Use a macro for getopt_long struct option generating instead of additional
        defines and hardcoded lines
      Signed-off-by: 's avatarVeronika Kabatova <vkabatov@redhat.com>
      Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
      f17b60ef
    • Mike Rapoport's avatar
    • Adrian Reber's avatar
      zdtm/static/fpu01: check for OSXSAVE instead of XSAVE · b2009641
      Adrian Reber authored
      When checking for XSAVE availability it makes more sense
      to check for OSXSAVE than to check for XSAVE. This way the
      check works on systems booted with the 'noxsave' kernel
      command-line.
      
      travis-ci: success for zdtm/static/fpu01: check for OSXSAVE instead of XSAVE
      Signed-off-by: 's avatarAdrian Reber <areber@redhat.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      b2009641
    • Kirill Tkhai's avatar
      files: Unify clone_service_fd() · 8512efdf
      Kirill Tkhai authored
      Make this function more generic: we want to do not dup not only
      transport socket of parent, but just all service fds, which
      were not opened at the moment of clone() in parent. But,
      yes, currently it's only transport socket.
      
      travis-ci: success for files: Unify clone_service_fd()
      Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      8512efdf
  2. 24 Apr, 2017 1 commit
    • Pavel Emelyanov's avatar
      criu: Version 3.0 · fce87893
      Pavel Emelyanov authored
      So, we've done a HUUGE rework in this release, that's why it's 3.0.
      Two biggest changes are:
      
      * Compel library -- the framwork for parasite code injection.
      * 32bit x86 support. Note, that it's neither x32 support, not 32-bit
        criu. It's purely the ability to dump 32-bit tasks on 64-bit host.
      
      With compel at hands the 'criu exec' is removed.
      
      Main set of kudos go to Cyrill and Dima for this heavy lifting :)
      
      Other things include shutdown-ed UDP sockets, bind-mounts to external
      bind mounts, ASAN, extentions to RPC, rework of SysVIPC shmem dump
      format and some bugfixes and beautifications in CRIT.
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      fce87893
  3. 20 Apr, 2017 3 commits
  4. 17 Apr, 2017 5 commits
    • Dmitry Safonov's avatar
      arm: Workaround shmat() page coloring alignment · e98d16e7
      Dmitry Safonov authored
      Please, see incode comment about the issue.
      There was an attempt to fix this feature in kernel:
        http://www.spinics.net/lists/arm-kernel/msg258870.html
      
      I'll send a patch for kernel with a correct justification.
      Still it's worth to workaround this on older kernels.
      mremap() after shmat() makes it possible to C/R shmem between ARMv7 CPUs.
      Without it C/R will fail even on the same platform.
      
      That is possible that this workaround changes *restore failure* to
      *corruption* in shared memory after restore.
      Still, I think it's worth to be applied by the following reasons:
      1. All ARMv7 CPUs do not have VIPT aliasing data cache.
         And ARMv6 CPUs may have any, but they are not popular because of UMP.
      2. SysV IPC shmem should be writable and SHMLBA unaligned
         (if it's only readable, then it's OK).
      3. For the data corruption we need to migrate from non-VIPT cached CPUs
         to VIPT aliasing.
      4. As this is shmem migration between platforms - quite likely we have
         it`s copy (in case of whole IPC namespace dump - in images).
      5. C/R before on the same CPU may fail (quite likely, more than 50% of
         zdtm/transition/ipc failed while I've test it).
      
      So, I think it's very unlikely that someone uses CRIU to migrate
      from ARMv7 to ARMv6 unaligned writable shmem, but if he is - here is
      a BIG WARNING on restore.
      
      And after all: we've restored application as it was on checkpoint,
      we can't reliably tell that shmem needs align on the target platform,
      but we warned on restoring.
      
      I wanted to test the cpuid for VIPT caching firstly, but it's in cp15
      coprocessor, which means it's unavailable from userspace. Only one
      reliable way to tell is to check couple of first boot lines in dmesg:
      [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
      Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
      Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
      e98d16e7
    • Dmitry Safonov's avatar
      arm32/Makefile: fix readable mappings getting +x · d7c86c8b
      Dmitry Safonov authored
      Flag `noexecstack' for ld implies `EXSTACK_DISABLE_X' ELF flag
      on CRIU binary. Without this flag the kernel ELF loader will set
      `READ_IMPLIES_EXEC' personality bit:
      >	if (elf_read_implies_exec(loc->elf_ex, executable_stack))
      >		current->personality |= READ_IMPLIES_EXEC;
      
      This flag is checked by sys_mmap():
      >	if ((prot & PROT_READ) && (current->personality & READ_IMPLIES_EXEC))
      >		if (!(file && path_noexec(&file->f_path)))
      >			prot |= PROT_EXEC;
      
      Which results in each mmap() syscall returning +x mapping for any
      readable mapping for CRIU binary, e.g:
      Before C/R:
      76fc4000-76fc5000 r--p 0001f000 b3:02 131656     /usr/lib/ld-2.25.so
      76fc5000-76fc6000 rw-p 00020000 b3:02 131656     /usr/lib/ld-2.25.so
      After restore:
      76fc4000-76fc5000 r-xp 0001f000 b3:02 131656     /usr/lib/ld-2.25.so
      76fc5000-76fc6000 rwxp 00020000 b3:02 131656     /usr/lib/ld-2.25.so
      
      Which also makes ZDTM very sad:
      1: Old maps lost: set(["76f80000-76f81000 ['rw-p', '0120400']", "25000-26000
      ['rw-p', '0120400']", "76f7d000-76f7f000 ['rw-p']", "14a8000-14c9000 ['rw-p']",
      "76f4a000-76f4c000 ['r--p', '0120400']", "7ed3d000-7ed7f000 ['rw-p']",
      "76f7f000-76f80000 ['r--p', '0120400']", "24000-25000 ['r--p', '0120400']",
      "76f4c000-76f50000 ['rw-p', '0120400']"])
      1: New maps appeared: set(["76f7f000-76f80000 ['r-xp', '0120400']",
      "7ed3d000-7ed7f000 ['rwxp']", "76f4a000-76f4c000 ['r-xp', '0120400']",
      "76f80000-76f81000 ['rwxp', '0120400']", "24000-25000 ['r-xp', '0120400']",
      "14a8000-14c9000 ['rwxp']", "25000-26000 ['rwxp', '0120400']",
      "76f7d000-76f7f000 ['rwxp']", "76f4c000-76f50000 ['rwxp', '0120400']"])
      
      Maybe we also need to set it for arm64 or even for all archs, but that
      needs to be tested in the first place, so add it now to arm32, x86
      already has it.
      Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
      Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
      Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
      d7c86c8b
    • Dmitry Safonov's avatar
      python: specify python2 as .py interpreter · 057c3f29
      Dmitry Safonov authored
      On some distro the default python interpreter is Python 3,
      which results in such errors:
      >  Running zdtm/static/socket-tcp-closed.hook(--post-start)
      >  make[1]: Nothing to be done for default.
      >  ./socket-tcp-closed --pidfile=socket-tcp-closed.pid --outfile=socket-tcp-closed.out
      >    File "zdtm/static/socket-tcp-closed.hook", line 16
      >      except OSError, e:
      >                    ^
      >  SyntaxError: invalid syntax
      >  ######### Test zdtm/static/socket-tcp-closed FAIL at hook --post-start #########
      >  Running zdtm/static/socket-tcp-closed.hook(--clean)
      >    File "zdtm/static/socket-tcp-closed.hook", line 16
      >      except OSError, e:
      >                    ^
      >  SyntaxError: invalid syntax
      >  Traceback (most recent call last):
      >    File "zdtm.py", line 1921, in <module>
      >      do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
      >    File "zdtm.py", line 1388, in do_run_test
      >      try_run_hook(t, ["--clean"])
      >    File "zdtm.py", line 1053, in try_run_hook
      >      raise test_fail_exc("hook " + " ".join(args))
      >  __main__.test_fail_exc: <__main__.test_fail_exc instance at 0x76294468>
      Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
      Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
      Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
      057c3f29
    • Dmitry Safonov's avatar
      arm/compel: add generated headers to .gitignore · 692da148
      Dmitry Safonov authored
      [criu]# git status -s
      ?? compel/arch/arm/plugins/std/syscalls/syscalls.S
      ?? compel/plugins/include/uapi/std/syscall-aux.S
      ?? compel/plugins/include/uapi/std/syscall-aux.h
      Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
      Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
      Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
      692da148
    • Dmitry Safonov's avatar
      test/maps01: document mmap() failures · ab33ae2d
      Dmitry Safonov authored
      Arm32 devices often have poor amount of RAM. E.g., RPI2 board
      has only 1Gb memory. This lead to failures with maps01 test,
      which tries to mmap() 1Gb of memory. The failures of test is
      not very evident - let's document mmap() errors here to
      blow some light on the situation.
      Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
      Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
      Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
      ab33ae2d
  5. 11 Apr, 2017 18 commits
  6. 02 Apr, 2017 7 commits