1. 24 Oct, 2016 21 commits
    • Kir Kolyshkin's avatar
      CI: add clang build for travis-ci · 5992d719
      Kir Kolyshkin authored
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      5992d719
    • Kir Kolyshkin's avatar
      zdtm/grow_map: fix test failure for clang · 391bdbe4
      Kir Kolyshkin authored
      When this code is compiled by clang, it optimizes two byte writes into
      one word write, like this:
      
      >        fake_grow_down[0] = 'c';
      >        *(fake_grow_down - 1) = 'b';
      > 401b60:       66 41 c7 46 ff 62 63    movw   $0x6362,-0x1(%r14)
      
      This is incorrect, as the stack is supposed to grow page by page,
      so we need to touch one page then another, i.e. the order is important.
      
      To fix, let's use volatile pointer. After this change, the following
      (correct) code is generated:
      
      >        *p-- = 'c';
      >   401b60:       41 c6 06 63             movb   $0x63,(%r14)
      >        *p = 'b';
      >   401b64:       41 c6 46 ff 62          movb   $0x62,-0x1(%r14)
      
      [v2: same fix for another similar place]
      
      Cc: Andrei Vagin <avagin@virtuozzo.com>
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Acked-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      391bdbe4
    • Kir Kolyshkin's avatar
      CI: move GCOV flag to travis.yml · 5465179f
      Kir Kolyshkin authored
      Move GCOV to travis environment, so now we can change it easily
      on a per-build basis.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      5465179f
    • Kir Kolyshkin's avatar
      Makefile: don't compile with -O0 if GCOV=1 · 9fb43a48
      Kir Kolyshkin authored
      I found that everything we test on travis-ci is built with -O0.
      I believe this is the wrong thing to do as we test something that is
      compiled not the way it would be compiled for any real use.
      
      Drop enabling DEBUG for GCOV.
      
      Signed-off-by: Kir Kolyshkin <kir at openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      9fb43a48
    • Kir Kolyshkin's avatar
      CI: move travis' after_success to a script · 2f2fc082
      Kir Kolyshkin authored
      It is easier to handle it this way
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      2f2fc082
    • Kir Kolyshkin's avatar
      f6459962
    • Kir Kolyshkin's avatar
      parasite.c: rm unneeded init · ca677a91
      Kir Kolyshkin authored
      This "struct ctl_msg" initialization is not really needed, as it is
      initalized right away in __parasite_daemon_wait_msg() function.
      
      The real reason of removing this init is when compiled by clang
      with -O0 etc (i.e. compiler flags set when GCOV=1 env var is present),
      clang inserts a call to memset to initialize the structure. This,
      of course, leads to "compel piegen" complaining:
      
      	Unexpected undefined symbol: `memset'. External symbol in PIE?
      
      One way of solving it would be to provide a memset() which will call
      builtin_memset(), or a simple C implemenation. But as this is the only
      place that triggers such a call to memset(), and this initialization
      is not really needed, it's easier just to remove it.
      
      Now, there might be more cases like this in the future, but for now
      we are good.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      ca677a91
    • Kir Kolyshkin's avatar
      restorer.c: rm unneded struct init · b4441d1b
      Kir Kolyshkin authored
      This 'struct timespec' initialization is non needed as we call
      clock_gettime() right away which is supposed to fill it in.
      
      The real reason of removing this init is when compiled by clang
      with -O0 etc (i.e. compiler flags set when GCOV=1 env var is present),
      clang inserts a call to memset to initialize the structure. This,
      of course, leads to "compel piegen" complaining:
      
      	Unexpected undefined symbol: `memset'. External symbol in PIE?
      
      One way of solving it would be to provide a memset() which will call
      builtin_memset(), or a simple C implemenation. But as this is the only
      place that triggers such a call to memset(), and this initialization
      is not really needed, it's easier just to remove it.
      
      Now, there might be more cases like this in the future, but for now
      we are good.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      b4441d1b
    • Kir Kolyshkin's avatar
      maps007 test: fix for clang · f18fce45
      Kir Kolyshkin authored
      CLang doesn't like explicit NULL pointer dereference:
      > maps007.c:176:2: error: indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]
      >         *((int *) 0) = 0;
      >         ^~~~~~~~~~~~
      > maps007.c:176:2: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
      >
      
      Apparently, we need to add volatile to make it happy.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      f18fce45
    • Kir Kolyshkin's avatar
      cmdlinenv00 test: fix for clang · 2ac1cc67
      Kir Kolyshkin authored
      clang complains:
      > cmdlinenv00.c:35:11: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
      >                 if (ret < 0) {
      >                     ~~~ ^ ~
      
      The fix is to use ssize_t not size_t.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      2ac1cc67
    • Kir Kolyshkin's avatar
      apparmor test: fix for clang · 2479c25d
      Kir Kolyshkin authored
      clang complains:
      > apparmor.c:86:20: error: too many arguments in call to 'checkprofile' [-Werror]
      >         if (checkprofile(0) == 0)
      >             ~~~~~~~~~~~~  ^
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      2479c25d
    • Kir Kolyshkin's avatar
      rtc.c test: fix for clang · 514ca4e9
      Kir Kolyshkin authored
      clang complains:
      > clang -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -iquote ../lib/arch/x86/include -I../lib   rtc.c ../lib/libzdtmtst.a ../lib/libzdtmtst.a -o rtc
      > rtc.c:50:7: error: taking the absolute value of unsigned type 'unsigned long' has no effect [-Werror,-Wabsolute-value]
      >                 if (labs(delta - 1000000 / TEST_HZ ) > 100000) {
      >                     ^
      
      Declare delta as long.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      514ca4e9
    • Kir Kolyshkin's avatar
      groups.c test: fix for clang · 21c46753
      Kir Kolyshkin authored
      clang complains:
      > clang -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -iquote ../lib/arch/x86/include -I../lib   groups.c ../lib/libzdtmtst.a ../lib/libzdtmtst.a -o groups
      > groups.c:22:9: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
      >         if (ng < 0) {
      >             ~~ ^ ~
      
      Declare ng as int.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      21c46753
    • Kir Kolyshkin's avatar
      vdso01 test: fix for clang · 4be8daa1
      Kir Kolyshkin authored
      clang complains:
      > clang -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -iquote ../lib/arch/x86/include -I../lib   vdso01.c ../lib/libzdtmtst.a ../lib/libzdtmtst.a -lrt -o vdso01
      > vdso01.c:305:6: error: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value
      >       [-Werror,-Wabsolute-value]
      >         if (abs(ts1.tv_sec - ts2.tv_sec) > TIME_DELTA_SEC) {
      >             ^
      > vdso01.c:305:6: note: use function 'labs' instead
      
      Let's use labs() indeed.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      4be8daa1
    • Kir Kolyshkin's avatar
      inotify_system tests: fix for clang · fe21d145
      Kir Kolyshkin authored
      When compiling with clang, it complains like this:
      
      > clang -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -iquote ../lib/arch/x86/include -I../lib   inotify_system.c ../lib/libzdtmtst.a ../lib/libzdtmtst.a -o inotify_system
      > inotify_system.c:323:50: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
      >         if ((common_desc.inot < 0) || (common_desc.file < 0) || \
      >                                        ~~~~~~~~~~~~~~~~ ^ ~
      > inotify_system.c:324:21: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
      >                         (common_desc.dir < 0) || (common_desc.link < 0)) {
      >                          ~~~~~~~~~~~~~~~ ^ ~
      > inotify_system.c:324:47: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
      >                         (common_desc.dir < 0) || (common_desc.link < 0)) {
      >                                                   ~~~~~~~~~~~~~~~~ ^ ~
      > 3 errors generated.
      
      Indeed these fields are uint32_t. As they are used to store the results of
      inotify_init() and inotify_add_watch() function calls, the type should be int.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      fe21d145
    • Kir Kolyshkin's avatar
      fpu00 test: fix for clang · 8f9c6ff5
      Kir Kolyshkin authored
      clang complains a number of times on our inline asm code, like this:
      
      > fpu00.c:13:6: error: ambiguous instructions require an explicit suffix
      > (could be 'flds', 'fldl', or 'fldt')
      >                           "fld  %0\n"
      >                           ^
      > <inline asm>:1:2: note: instantiated into assembly here
      >         fld     -4(%rsp)
      >         ^
      
      As floats are used, the suffix should be 's' ("short", 32-bit, float).
      
      Add it where needed.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      8f9c6ff5
    • Kir Kolyshkin's avatar
      zombie00 test: fix for clang · a95939c0
      Kir Kolyshkin authored
      CLang doesn't like explicit NULL pointer dereference:
      
      > zombie00.c:52:5: error: indirection of non-volatile null pointer will be
      > deleted, not trap [-Werror,-Wnull-dereference]
      >                                 *(int *)NULL = 0;
      >                                 ^~~~~~~~~~~~
      > zombie00.c:52:5: note: consider using __builtin_trap() or qualifying
      > pointer with 'volatile'
      > 1 error generated.
      
      Apparently, we need to add volatile to make it happy.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      a95939c0
    • Kir Kolyshkin's avatar
      zdtm: compile fix for clang · 3c75cf51
      Kir Kolyshkin authored
      clang complains about an unused function:
      
      > clang -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
      > -iquote ./arch/x86/include  -c -o parseargs.o parseargs.c
      > parseargs.c:12:1: error: unused function '__check_help'
      > [-Werror,-Wunused-function]
      > TEST_OPTION(help, bool, "print help message and exit", 0);
      > ^
      > ./zdtmtst.h:71:2: note: expanded from macro 'TEST_OPTION'
      >         param_check_##type(name, &(name));
      > \
      >         ^
      > <scratch space>:46:1: note: expanded from here
      > param_check_bool
      > ^
      > ./zdtmtst.h:84:35: note: expanded from macro 'param_check_bool'
      > #define param_check_bool(name, p) __param_check(name, p, int)
      >                                   ^
      > ./zdtmtst.h:78:22: note: expanded from macro '__param_check'
      >         static inline type *__check_##name(void) { return(p); }
      >                             ^
      > <scratch space>:47:1: note: expanded from here
      > __check_help
      > ^
      > 1 error generated.
      > <builtin>: recipe for target 'parseargs.o' failed
      
      As far as I can tell, the functions __check_##name are generated in
      order to check the argument type by the compiler.
      
      For gcc, the "inline" keyword is enough to suppress the "unused function"
      warning even when -Wunused-function is used. For clang, it's not the
      case (see https://llvm.org/bugs/show_bug.cgi?id=22712).
      
      A way to "use" the function is to use its name as a pointer and cast it
      to void. This is what this patch does.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      3c75cf51
    • Kir Kolyshkin's avatar
      criu/mount.c: rm unused function · e48a46f3
      Kir Kolyshkin authored
      Commit 308741d0 removes all calls to path_length(), but the function
      itself is still there. Now, clang complains that it is unused.
      
      Remove it.
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      e48a46f3
    • Kir Kolyshkin's avatar
      criu/filesystems.c: refactor binfmt_misc_restore_bme · 02c3605c
      Kir Kolyshkin authored
      The following error is emitted by clang:
      
      >   CC       criu/filesystems.o
      > criu/filesystems.c:280:13: error: variable 'ret' is used uninitialized
      >    whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
      >         } else if (bme->extension) {
      >                    ^~~~~~~~~~~~~~
      > criu/filesystems.c:287:6: note: uninitialized use occurs here
      >         if (ret > 0) {
      >             ^~~
      > criu/filesystems.c:280:9: note: remove the 'if' if its condition is
      >    always true
      >         } else if (bme->extension) {
      >                ^~~~~~~~~~~~~~~~~~~~
      > criu/filesystems.c:272:9: note: initialize the variable 'ret' to silence
      >    this warning
      >         int ret;
      >                ^
      >                 = 0
      > 1 error generated.
      
      This code was a result of commit 398e7d3.
      
      If we look closely, this is a false alarm, as "else if (bme->extension)"
      is always true as it was checked before. But this is not very clear,
      and the issue with clangs still needs to be fixed.
      
      There are many ways to do so:
      
      1. Initialize ret to 0. This is what initial version of this patch did.
      
      2. Remove the always-true condition, like this:
      
      	-	} else if (bme->extension) {
      	+	} else {
      
      In my opinion this would hurt readability.
      
      3. Change the code flow, improving readability at the same time.
      
      I believe that #3 is what this patch does. In addition, it fixes
      handling of a few corner cases:
      
      - an overflow in snprintf();
      - a case when bme->name is NULL (as it is used for strlen/snprintf,
        there is a potential for SIGSEGV);
      - a case of ret == 0 (currently there is no code flow that
        results in ret being 0, so it's just for the future).
      
      [v2: use linux kernel style for 'else' after a block]
      [xemul: Fix // comments ]
      
      Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Acked-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      02c3605c
    • Adrian Reber's avatar
      Added --display-stats to the man page · 64f964f0
      Adrian Reber authored
      Signed-off-by: 's avatarAdrian Reber <areber@redhat.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      64f964f0
  2. 17 Oct, 2016 1 commit
  3. 14 Oct, 2016 1 commit
  4. 13 Oct, 2016 14 commits
  5. 10 Oct, 2016 3 commits
    • Pavel Emelyanov's avatar
      parasite: Pass exec start point to parasite_prep_ctl · 78a3670b
      Pavel Emelyanov authored
      The parasite_prep_ctl() will become compel call, so it won't
      have the code that scans CRIU's vma area list. For pure compel
      users we'll need to add simple /proc/maps scanner that'd find
      the entry point.
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      78a3670b
    • Kir Kolyshkin's avatar
      handle-elf.c: whitespace cleanup · c158ccdf
      Kir Kolyshkin authored
      travis-ci: success for handle-elf.c: whitespace cleanup
      Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      c158ccdf
    • Tycho Andersen's avatar
      images: rename NONE to CG_NONE · 5e1cfded
      Tycho Andersen authored
      with newer versions of protobuf, I get:
      
      ./crit
      Traceback (most recent call last):
        File "./crit", line 7, in <module>
          import pycriu
        File "/home/ubuntu/criu/crit/pycriu/__init__.py", line 2, in <module>
          import images
        File "/home/ubuntu/criu/crit/pycriu/images/__init__.py", line 2, in <module>
          from images import *
        File "/home/ubuntu/criu/crit/pycriu/images/images.py", line 52, in <module>
          from pb import *
        File "/home/ubuntu/criu/crit/pycriu/images/pb.py", line 35, in <module>
          from packet_sock_pb2 import *
        File "/home/ubuntu/criu/crit/pycriu/images/packet_sock_pb2.py", line 18, in <module>
          import sk_opts_pb2 as sk__opts__pb2
        File "/home/ubuntu/criu/crit/pycriu/images/sk_opts_pb2.py", line 23, in <module>
          serialized_pb=_b('\n\rsk-opts.proto\"\xe2\x02\n\rsk_opts_entry\x12\x11\n\tso_sndbuf\x18\x01 \x02(\r\x12\x11\n\tso_rcvbuf\x18\x02 \x02(\r\x12\x16\n\x0eso_snd_tmo_sec\x18\x03 \x02(\x04\x12\x17\n\x0fso_snd_tmo_usec\x18\x04 \x02(\x04\x12\x16\n\x0eso_rcv_tmo_sec\x18\x05 \x02(\x04\x12\x17\n\x0fso_rcv_tmo_usec\x18\x06 \x02(\x04\x12\x11\n\treuseaddr\x18\x07 \x01(\x08\x12\x13\n\x0bso_priority\x18\x08 \x01(\r\x12\x13\n\x0bso_rcvlowat\x18\t \x01(\r\x12\x0f\n\x07so_mark\x18\n \x01(\r\x12\x13\n\x0bso_passcred\x18\x0b \x01(\x08\x12\x12\n\nso_passsec\x18\x0c \x01(\x08\x12\x14\n\x0cso_dontroute\x18\r \x01(\x08\x12\x13\n\x0bso_no_check\x18\x0e \x01(\x08\x12\x14\n\x0cso_bound_dev\x18\x0f \x01(\t\x12\x11\n\tso_filter\x18\x10 \x03(\x06*6\n\x0bsk_shutdown\x12\x08\n\x04NONE\x10\x00\x12\x08\n\x04READ\x10\x01\x12\t\n\x05WRITE\x10\x02\x12\x08\n\x04\x42OTH\x10\x03')
        File "/usr/lib/python2.7/dist-packages/google/protobuf/descriptor.py", line 827, in __new__
          return _message.default_pool.AddSerializedFile(serialized_pb)
      TypeError: Couldn't build proto file into descriptor pool!
      Invalid proto descriptor for file "sk-opts.proto":
        NONE: "NONE" is already defined in file "rpc.proto".
        NONE: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "NONE" must be unique within the global scope, not just within "sk_shutdown".
      
      this fixes that.
      Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
      CC: Laurent Dufour <ldufour@linux.vnet.ibm.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
      5e1cfded