2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00
Commit Graph

2493 Commits

Author SHA1 Message Date
Alexander Kartashov
a27f0e5cb0 cr-restore: align the stack on 8-byte boundary
The section 5.2.1.2 of the AAPCS says that the stack must be 8-byte aligned
and this rule is broken when the thread restore_task_with_children()
is forked by the function fork_with_pid() since the variable ca
and its field stack are likely to be 4-byte aligned.

This patch forces 8-byte alingment of the field cr_clone_arg::stack.
This made the following tests pass on ARM:
* static/shm,
* static/ipc_namespace.

Particulary the unaligned stack results in incorrect passing
of the 64-bit argument to the function snprintf() in the function
sysctl_write_u64().

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-29 09:21:46 +04:00
Pavel Emelyanov
5d7cfa8fcf sk: Don't fail collect_sockets in non netns case
This is already so, just move the check for netns case
into collect_sockets. It knows it does so.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-25 15:20:38 +04:00
Pavel Emelyanov
1505815760 sk: Fix check for whether or not to restore namespace in collect_sockets
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-25 15:14:17 +04:00
Cyrill Gorcunov
1f0f2cb995 docs: Put a \Backslash where needed
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-25 14:58:09 +04:00
Cyrill Gorcunov
e28960c348 make: protobuf -- Simplify sed'ing
No need for multiple sed calls, better pass
all options in once.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-25 14:57:52 +04:00
Alexander Kartashov
d9adda7cd1 zdtm: autodetect the target machine v2
Andrew Vagin pointed out that the static testsuite compilation
may run as standalone so the variable ARCH won't be available.

This patch introduces the facility test/zdtm/Makefile.inc
designated to detect the target machine automatically
if the variable ARCH isn't defined. This makefile is supposed
to be included into all test subsuite Makefiles.

Andrew Vagin also pointed out that machine-dependent tests
may be added into non-static subsuites as well so the macro
adding machine-specific headers into CPPFLAGS goes to
the file test/zdtm/Makefile.inc.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-24 15:16:39 +04:00
Cyrill Gorcunov
008457e1e2 make: protobuf -- Order .c files generation
This patch introduce dependencies on .c files
generation parsing import keywords in .proto
files.

In particular, the core.proto file refers to
core-x86.proto which means we need to generate
.[c|h] files from core-x86.proto earlier than
handlig of core.proto.

A positive side effect of this patch is that
the compilation is independent now of order the
proto files are declated in the make file.

Instead of currently present manual order

PROTO_FILES	+= core-x86.proto
PROTO_FILES	+= core-arm.proto
PROTO_FILES	+= core.proto

one can write it in any arrangement, say

PROTO_FILES     += core.proto
PROTO_FILES     += core-arm.proto
PROTO_FILES     += core-x86.proto

and it still be resolved correctly.

BUT beware of circular import directives,
we can't handle them now.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-24 13:22:05 +04:00
Cyrill Gorcunov
d701221e54 make: protobuf -- Generate protofiles deps
Some protobuf files do import another files so
we should generate dependencies and rebuild
the program when needed.

For example core.proto imports core-x86.proto
and core-arm.proto, thus if any of them are
changed the final core.pb-c.c should be regenerated.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-24 13:21:52 +04:00
Cyrill Gorcunov
2e7982ce3f make: protobuf -- Mangle integer constant on ARM only
It's known to work on x86-64 so make the build procedure
a bit faster here.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-24 13:21:35 +04:00
Cyrill Gorcunov
7d1d2e9f9d make: Simplify ARCH retrieval
Actually the former code was being expanding
uname_M variable which is not set that early
(this was not a problem since we assign it a
line below, still it was a dead code which
should be fixed).

Also update

 | ifeq ($(findstring arm,$(ARCH)),arm)

to simple

 | ifeq ($(ARCH),arm)

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-24 13:20:57 +04:00
Cyrill Gorcunov
629e045466 protobuf: Move arch core resources to core-$(ARCH).proto
To unweave arch dependent part from general core.proto file.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-23 18:22:47 +04:00
Cyrill Gorcunov
10a1045b8a x86: Drop #ifdef CONFIG_X86_64 guard
We do check for proper architectrue in a makefile,
no need for additional guards.

After all porting the project for x86-32 is a far more
bigger than "just implement proper core for parts covered
by #else /* CONFIG_X86_64 */".

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-23 17:43:38 +04:00
Cyrill Gorcunov
709b091f9f make: Yield error on x86-32
Since we don't support x86-32 yet, issue an error early.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-23 17:43:30 +04:00
Cyrill Gorcunov
43407bdf87 make: Drop redundant DEBUG assignment
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-23 17:43:12 +04:00
Cyrill Gorcunov
79f27d49e8 make: Split long lines
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-23 17:43:04 +04:00
Alexander Kartashov
8fa8ca9feb arm: added ARM-specific files modelled after arch/x86
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:53:24 +04:00
Alexander Kartashov
a0c86a25ab core.proto: added ARM-specific parts to a Core message
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:52:39 +04:00
Alexander Kartashov
31f9ef8f90 zdtm: moved lib/atomic.h to lib/arch/x86/include/asm/atomic.h
The file lib/atomic.h is the only machine-dependent file in the test suite
that breaks compilation of the test static/session01 on ARM.

The file is moved into a separate directory and the build system is modified
accordingly to prevent this.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:52:00 +04:00
Andrey Vagin
5500145557 test: add ability to execute tests in parallel
All tests which executed in pid namespaces can be executed in parallel.

$ make zdtm_ns
real	0m54.806s
user	0m2.779s
sys	0m4.338s

$ make -j zdtm_ns
real	0m11.587s
user	0m3.361s
sys	0m5.134s

Another feature of this patch is that the subset of parallel tests is
executed before the subset of sequential tests.

If a first subset are not failed, the second one has a small chance to
fail, so a most part of bugs will be found in a few first seconds.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:48:00 +04:00
Andrey Vagin
f35bfe1f7d zdtm.sh: exec cleanout per test
It's required for parallel execution of tests.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:47:58 +04:00
Andrey Vagin
c8484f10ef zdtm: add ablitiy to execute cleanout per test
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:47:56 +04:00
Andrey Vagin
ea767143f1 tty: require stdin to be a terminal only if shell_job is set
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:45:31 +04:00
Andrey Vagin
749116b49e crtools: fix the name of --file-locks in the help message
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:39:26 +04:00
Andrey Vagin
324e432cbb zdtm: get a test file name from arguments
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:39:18 +04:00
Andrey Vagin
abdaea2421 zdtm: don't hardcode file names
A test should get file names from arguments

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:39:13 +04:00
Andrey Vagin
cd88cafc37 app-emu/lxc: dump/restore file locks
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:36:38 +04:00
Andrey Vagin
ab2d10c247 zdtm: move file_locks test-cases to the common list
In this case they will be executed in other name-spaces.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:35:08 +04:00
Andrey Vagin
d6ae662374 cr-dump: call stat for /proc/pid/fd/X directly
This patch can be committed instead of:
[PATCH 1/6] cr-dump: move parasite_drain_fds_seized out of dump_task_files
[PATCH 2/6] cr-dump: fix dumping file locks in a mount namespace

readlink is not required here and a file can be unavailable,
if a process is in another mnt namespace

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:34:27 +04:00
Cyrill Gorcunov
8587f7dec1 zdtm: sched_prio -- Add missing headers
On glibc-2.16 I'm getting

 | sched_prio00.c: In function ‘main’:
 | sched_prio00.c:48:3: error: implicit declaration of function ‘setpriority’ [-Werror=implicit-function-declaration]
 | sched_prio00.c:48:19: error: ‘PRIO_PROCESS’ undeclared (first use in this function)
 | sched_prio00.c:48:19: note: each undeclared identifier is reported only once for each function it appears in
 | sched_prio00.c:60:3: error: implicit declaration of function ‘getpriority’ [-Werror=implicit-function-declaration]

fix it adding headers needed.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:32:18 +04:00
Pavel Emelyanov
475bb1e775 rst: Evaluate per-task clone mask early
When we've read all pstree-items and their ids we
can get the desired clone-flags early and avoid all
these dances with flag calculations in fork_with_pid
and company.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-19 01:16:19 +04:00
Pavel Emelyanov
10b338c5db fdt: Move shared-fdt structure preparation into separate fn
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-19 00:30:42 +04:00
Pavel Emelyanov
6045ca0e31 rst: Cehck for objects sharing before attaching helpers to tree
Helpers don't have any IDs on board and thus checks for "is
my X shared with parent" will be wrong.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-19 00:04:04 +04:00
Pavel Emelyanov
7ee4c484ae dump: Fix dump_zombies declaration
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 23:34:30 +04:00
Pavel Emelyanov
792bf0c494 cr: Fix namespaces restore from older images
In old images we had no clue whether the root task is to be
created in new namespaces. Remember using the --namespaces
option for explicitl specification of this fact.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 13:25:26 +04:00
Pavel Emelyanov
ac845bd1d8 cr: Obsolete the --namespaces option
It's no longer required to use this option -- two currently
supported cases (tasks on host and tasks in containers) can
be detected automatically. Keep this option for future.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 13:25:16 +04:00
Pavel Emelyanov
a46831aee9 cr: Detect namespaces presence automatically
Introduce the current_ns_mask variable, that collects info about
which namespaces tasks being dumped and to be restored live in.

For simlicity all tasks are supposed to live in one set of spaces.
This should be fixed eventually.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 13:25:10 +04:00
Pavel Emelyanov
2f22c68849 dump: Collect tasks' IDs early
It's required to know whether the root task lives in
namespaces very very early (e.g. -- to lock the network
properly). Thus we have to collect task IDs right at
the time we collect the tasks themselves.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 13:25:06 +04:00
Pavel Emelyanov
1a60975622 img: Save crtools process IDs in inventory
On restore we'll need to know whether the root task should be
cloned in new set of namespaces. It's natural to do it by
comparing root ids with some "other-world" IDs.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 13:25:02 +04:00
Pavel Emelyanov
15999f6b2f ids: Split routine that dumps task's IDs
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 13:24:55 +04:00
Pavel Emelyanov
2105e18eee core: Save tasks' namespaces IDs in the ids image
The recent kernels allow to get namespaces IDs by reading proc-ns links.
Use this to generate IDs for tasks' namespaces (I do generate them, since
IDs provided by kernel look ugly :( ).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 13:18:33 +04:00
Andrey Vagin
47c98c63d7 syscall: add sigqueueinfo, signalfd and pread
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 11:50:51 +04:00
Alexander Kartashov
2d70f89664 protobuf: cast the result of the macro pb_repeated_size to size_t
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 11:41:43 +04:00
Alexander Kartashov
b97e24e3fb cr: introduced the functions decode_pointer() and encode_pointer()
These functions are designated to convert a native pointer
to uint64_t used to store a virtual address in protobuf messages
and vice versa in a machine-independent way.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 11:41:43 +04:00
Alexander Kartashov
bde8beca71 cr: use uint64_t to represent a virtual address
The patch reverts the commit 58064d9b72.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 11:41:42 +04:00
Alexander Kartashov
ac97f9077a parasite-syscall.c: don't infect a VMA above TASK_SIZE
If a task executes a non-userspace code (that sometimes takes place on ARM)
while being seized the subsequent infection with the syscall blob fails
because ptrace fails to write to the VMA the PC is in.

The patch modifies the function get_vma_by_ip() to check the PC of the task
being seized is below the TASK_SIZE boundary. If the check fails
the first suitable VMA is infected.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 11:41:41 +04:00
Alexander Kartashov
bd10da7869 print_hex_l: don't print more than 8 hex digits on a 32-bit machine
This patch prevents compilation warnings about shift overflow on ARM.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 11:41:40 +04:00
Alexander Kartashov
ae89891279 cr: introduced the macro BITS_PER_ULONG
The macro specifies the size of the machine pointer explicitly.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 11:41:39 +04:00
Alexander Kartashov
3bb6d9f4fb cr: use the length modifier %z to print an integer of the type size_t
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 11:41:38 +04:00
Alexander Kartashov
4f7161dd4c file-lock.c: generalized format strings
This patch fixes format strings in newly added code.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 11:41:37 +04:00
Cyrill Gorcunov
6586c4685c fsnotify: Don't fail on old versions where no inotify/fanotify image present
Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-17 19:20:41 +04:00