- 11 Apr, 2017 18 commits
-
-
Pavel Emelyanov authored
Unix socket name can be a string with any bytes in it. So to print the name we use base64 encoding. Doing so doesn't allow to see the socket name when it contains only printable chars. So here's the custom encoding for bytes fields, that can be used for custom conversion. Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Pavel Emelyanov authored
There are several places in image files, where we store integers, but these numbers actually mean some string. E.g. socket families, states and types and tasks states. So here's the (criu).dict option for such fields that helps to convert the numbers into strings and back. Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Adrian Reber authored
Instead of parsing the output of 'criu -V' this offers a RPC interface to get CRIU's version. In a follow up patch a test script is included to use the new interface: ./version.py Connecting to CRIU in swrk mode to check the version: RPC: Success CRIU major 2 CRIU minor 12 CRIU gitid v2.12-635-g6d3ae4d This change exports the following version fields: * major * minor * gitid (optional) * sublevel (optional) * extra (optional) * name (optional) The optional gitid field is not set when CRIU is not built from git. Signed-off-by:
Adrian Reber <areber@redhat.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Adrian Reber authored
This script connects to 'criu swrk' and asks for the version. If running from a git checkout the output would look like this: $ ./version.py Connecting to CRIU in swrk mode to check the version: RPC: Success CRIU major 2 CRIU minor 12 CRIU gitid v2.12-635-g6d3ae4d If not running from git checkout it looks like this: $ ./version.py Connecting to CRIU in swrk mode to check the version: RPC: Success CRIU major 2 CRIU minor 12 If running with a CRIU binary which does not support the VERSION command: $ ./version.py Connecting to CRIU in swrk mode to check the version: Error (cr-service.c:116): RPC error: Invalid req: Success RPC: Unexpected msg type Signed-off-by:
Adrian Reber <areber@redhat.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Pavel Emelyanov authored
Right now the contents of the sysvipc shmem segment is stored as raw blob in the ipcns-shm image. This is bad for two reasons. First is that huge segments with holes are filled with real zeroes in image. Second is that we prefer not to mix images with pb object and raw data. To fix both let's re-use the shmem.c code that keeps anon shared memory contents in pagemap/pages images. https://github.com/xemul/criu/issues/287Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Pavel Emelyanov authored
Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Pavel Emelyanov authored
Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Dmitry Safonov authored
After the commit 02c763939c10 ("test/zdtm: unify common code") CFLAGS with -D_GNU_SOURCE defined in the top Makefile are being passed to tests Makefiles. As _GNU_SOURCE is also defined by tests, that resulted in zdtm tests build failures: make[2]: Entering directory `/home/criu/test/zdtm/lib' CC test.o test.c:1:0: error: "_GNU_SOURCE" redefined [-Werror] #define _GNU_SOURCE ^ <command-line>:0:0: note: this is the location of the previous definition cc1: all warnings being treated as errors make[2]: *** [test.o] Error 1 However, we didn't catch this in time by Travis-CI, as zdtm.py doesn't do `make zdtm`, rather it does `make -C test/zdtm/{lib,static,transition}`. By calling middle makefile this way, it doesn't have _GNU_SOURCE in CFLAGS from top-Makefile. I think the right thing to do here - is following CRIU's way: rely on definition of _GNU_SOURCE by Makefiles. This patch is almost fully generated with find test/zdtm/ -name '*.c' -type f \ -exec sed -i '/define _GNU_SOURCE/{n;/^$/d;}' '{}' \; \ -exec sed -i '/define _GNU_SOURCE/d' '{}' \; With an exception for adding -D_GNU_SOURCE in tests Makefile.inc for keeping the same behaviour for zdtm.py. Also changed utsname.c to use utsname::domainname, rather private utsname::__domainname, as now it's uncovered (from sys/utsname.h): > struct utsname > { ... > # ifdef __USE_GNU > char domainname[_UTSNAME_DOMAIN_LENGTH]; > # else > char __domainname[_UTSNAME_DOMAIN_LENGTH]; > # endif Reported-by:
Adrian Reber <areber@redhat.com> Cc: Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Andrei Vagin authored
v2: Use the devicemapper storage driver for docker containers to run more tests. AUFS doesn't support file handles, so a few tests (e.g. inotify00 can't be run). Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Pavel Emelyanov authored
Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Pavel Emelyanov authored
v2: Use logerr where needed. Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Andrei Vagin authored
An abstract name can contain zero characters. Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Andrei Vagin authored
In this patch, we replace all zero characters to '@'. ==30==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300000e3ca at pc 0x7f34144b6be1 bp 0x7ffee7b6bb20 sp 0x7ffee7b6b298 READ of size 26 at 0x60300000e3ca thread T0 #0 0x7f34144b6be0 (/lib64/libasan.so.3+0x8dbe0) #1 0x7f34144b8e4d in __interceptor_vsnprintf (/lib64/libasan.so.3+0x8fe4d) #2 0x4966cb in vprint_on_level criu/log.c:228 #3 0x496b64 in print_on_level criu/log.c:249 #4 0x505c94 in collect_one_unixsk criu/sk-unix.c:1401 #5 0x4e7ae3 in collect_image criu/protobuf.c:213 #6 0x462c5c in root_prepare_shared criu/cr-restore.c:247 #7 0x462c5c in restore_task_with_children criu/cr-restore.c:1420 #8 0x7f34132d70ec in __clone (/lib64/libc.so.6+0x1030ec) 0x60300000e3ca is located 0 bytes to the right of 26-byte region [0x60300000e3b0,0x60300000e3ca) allocated by thread T0 here: #0 0x7f34144efe70 in malloc (/lib64/libasan.so.3+0xc6e70) #1 0x7f3413bdb021 (/lib64/libprotobuf-c.so.1+0x6021) Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
Using open_proc/fopen_proc/__open_proc is better since - it uses openat - it comes with nice error reporting Let's use it in places where we can. Even if it does not give any improvements (such as in cr-check.c), error message unification is good enough reason to do so. Requested-by:
Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
Replace 8-spaces with a tab in code. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
So, in places where we have errno available (and it makes sense to show it), we want to use pr_perror(). In places where errno is not set/used, use pr_err(). Cc: Dengguangxing <dengguangxing@huawei.com> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
1. No newline (pr_perror() already adds one for you) 2. No colon before file name, e.g. WAS: Can't open file: /some/file: permission denied NOW: Can't open file /some/file: permission denied Cc: Kirill Tkhai <ktkhai@virtuozzo.com> Cc: Dengguangxing <dengguangxing@huawei.com> Reviewed-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
Unlike pr_perror(), pr_err() does not append a newline. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
- 02 Apr, 2017 22 commits
-
-
Andrei Vagin authored
It's very hard to understand an error without a context Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Andrei Vagin authored
Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Pavel Emelyanov authored
The contents of sysvshm areas is sometimes dumped twice. First time it goes via cr_dump_shmem(), since each attachment of the segment is noted by the add_shmem_area() and thus gets into the list scanned by the former call(). Second time it is dumped by dump_ipc_shm_pages(). Another thing is that in the 1st dump memory gets into the standard pagemap/pages image pair, while in the 2nd time it's all written as plain byte array into ipcns-shm.img. At restore contents is read from the ipcns-shm.img (2nd). While the first way is preferred, let's (temporarily) eliminate it. Historically these segments were dumped and restored the 2nd way. Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
This is just to prevent a compiler warning. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
When this test is compiled on ARMv7, we get this: > maps03.c: In function 'main': > maps03.c:15:31: error: result of '10l << 30' requires 35 bits > to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=] > mem = (void *)mmap(NULL, (10L << 30), PROT_READ | PROT_WRITE, > ^~ Surely, the nature of the test looks like it needs 64-bit addressing. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
Make it possible to use a custom message telling why the test is skipped. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
Makefile knows that a binary depends on .o file, and the .o file depends on .c file, and adds the per-target variables even in the indirect case. Therefore, .o suffix is not needed here. Note that it not hurts to leave it as is, so this commit is done only for the sake of keeping things simple. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
This test name was added by commit 1ce1cca2, but there is no test. We do not use these lists since zdtm.py was introduced, therefore the error went unnoticed. I found it while running "make dep". Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
This commit expands the success with lib/Makefile to the rest of ztdm/Makefiles. In particular, it moves the common part to Makefile.inc and let {lib,static,transition}/Makefile use it. This results in: - dependencies being handled properly; - reduction of makefiles length due to unification; - possibly more proper dependencies and builds. While at it, let's also: - make rules for criu-rtc.so silent; - set default CC=gcc; - remove duplicate -m32 from CFLAGS. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
In GNU make, 'override' means change a variable even if it was set from the make command line (as in "make VAR=value"). As we do not intend to modify CFLAGS/LDFLAGS from the command line, 'override' can be dropped. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
Brevity is the soul of wit. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
When optimizing our Travis runs, I noticed that test/zdtm/lib is built 3 times in a row -- first time the binaries, 2nd and 3rd time the deps, in parallel (sic!). I took a look at Makefile and found this, and some more problems, like: - dependencies are generated but not included - cleandep does not depend on clean - groups.c dependencies are not generated (or used) - "make all" does not make groups binary - overcomplicated and unused groups.{pid,out,cleanout} targets - extra -f flag to rm - etc. This patch (hopefully) fixes all of the above. In addition, it provides a few enhancements: - enables "silent make" rules, so now lib/ is in line with the rest of zdtm - adds "dep" target (not used, just for convenience) Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
Commit 299e4b4 ("travis: enable ccache for docker/qemu builds") combined multiple RUN statements in Dockerfiles into a single one, which is good for performance (as there is an intermediate cache created after each statement). Unfortunately, it partially did so by combining statements with use of semicolons, meaning we are ignoring non-zero exit codes. As a result, failure from make are ignored and Travis builds are all green. To fix, replace all occurences of semicolon with &&. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
Since commit 93db22b ("compel: no -r for ARM ldflags") and commit ce043d3 ("compel: make plugins .a archives") the generated parasite/restorer blobs for 32-bit ARM are no longer relocatable, and so their ELF header has e_type of ET_EXEC (rather than ET_REL). As a result, we have "Unsupported header detected" message and a failure from compel hgen. This commit allows e_type == ET_EXEC in case NO_RELOCS is defined. I am not sure if it's OK to still allow ET_REL -- maybe Dmitry can chime in on that. Cc: Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
revert_unix_sk_cwd() may rewrite errno, so call pr_perror() firstly. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Andrei Vagin authored
A static test has to be stopped, because zdtm.py compares file descriptors before and after c/r. Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
Commit d9486bd7 ("arm/pie/build: do not produce relocatable parasite object") removed -r from LDFLAGS used to compile criu pie. This functionality somehow never made it to criu-dev, and was also lost in master then compel was ported to it. Make it work with compel. Unfortunately it was not as simple as I initially thought, as -r flag to ld was built into nmk. This patch removes it, and adds it to all places that need intermediate linking. Cc: Dmitry Safonov <dsafonov@virtuozzo.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
The objective is to only do parasite code linking once -- when we link parasite objects with compel plugin(s). So, let's use ar (rather than ld) here. This way we'll have a single ld invocation with the proper flags (from compel ldflags) etc. There are two tricks in doing it: 1. The order of objects while linking is important. Therefore, compel plugins should be the last to add to ld command line. 2. Somehow ld doesn't want to include parasite-head.o in the output (probably because no one else references it), so we have to force it in with the modification to our linker scripts. NB: compel makefiles are still a big mess, but I'll get there. Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
When performing static linking, the order of objects is important (when the linker finds an undefined reference, it looks forward, never back). Therefore, sorting objects breaks things. Required for the next patch. Cc: Cyrill Gorcunov <gorcunov@openvz.org> Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
1. Remove .FORCE, it's not used. 2. Consolidate CFLAGS stripping into a single line. Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
The way criu/pie/Makefile is currently written, ld is run twice: 1. link $(NAME-obj-y) objects to NAME.built-in.o 2. link NAME.built-in.o, pie.lib.a, and compel plugins to NAME.built-in.bin.o (with compel ldflags and linker script) There is absolutely no need for such two-stage linking, but it was OK. It is not OK now, as "compel ldflags" for ARM doesn't need -r, and we can't run the first stage with -r and the second stage without it. So, let's simplify linking using a single ld invocation. This is my third attempt in doing it, I think I nailed it this time -- it is now clean and (relatively) simple. While at it: - fix compel linker script dependency (it was not working); - rearrange the Makefile so variables goes first, then rules; - remove a comment about mount implementation in restorer. NOTE that compel is called with ./ prefix so the file paths it prints are also prefixed with ./, which is needed for objectify macro to ignore those. Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kir Kolyshkin authored
1. Remove useless LDFLAGS -- dynamic linker is not used here. 2. Remove $(iquotes) -- there are none defined here. 3. Consolidate filter-out statements into a single one. Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-