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

5383 Commits

Author SHA1 Message Date
Tycho Andersen
e0b24e21d3 creds: fail to dump when creds in thread group don't match
Since we don't support dumping per-thread creds, let's at least fail to
dump if the creds don't match.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-24 17:38:35 +03:00
Tycho Andersen
f8502fc3d1 ptrace: fix typo in comment
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-24 17:38:34 +03:00
Tycho Andersen
c03df1ba2d add a test for SECCOMP_MODE_STRICT
Note that we don't add the test into the list of tests to run, because it will
fail without the associated kernel patch.

v2: spin lock until seccomp strict is set on the child

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-24 17:38:33 +03:00
Tycho Andersen
0d8aec0c3a seccomp: add initial support for SECCOMP_MODE_STRICT
Unfortunately, SECCOMP_MODE_FILTER is not currently exposed to userspace,
so we can't checkpoint that. In any case, this is what we need to do for
SECCOMP_MODE_STRICT, so let's do it.

This patch works by first disabling seccomp for any processes who are going
to have seccomp filters restored, then restoring the process (including the
seccomp filters), and finally resuming the seccomp filters before detaching
from the process.

v2 changes:

* update for kernel patch v2
* use protobuf enum for seccomp type
* don't parse /proc/pid/status twice

v3 changes:

* get rid of extra CR_STAGE_SECCOMP_SUSPEND stage
* only suspend seccomp in finalize_restore(), just before the unmap
* restore the (same) seccomp state in threads too; also add a note about
  how this is slightly wrong, and that we should at least check for a
  mismatch

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-24 17:38:32 +03:00
Cyrill Gorcunov
bf4243e303 make: Be able to force turning off piegen
For testing purpose we need to disable using of
piegen utility. So lets add PIEGEN make option
thus one can "PIEGEN=no make" to build criu
without piegen at all.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-19 12:22:54 +03:00
Andrey Vagin
2a0c8db72b proc: mount proc with minimal permissions
Eric wants to restrict permissions for proc mounts in a non-root userns
according with proc mounts in the root userns.

Author: Eric W. Biederman <ebiederm@xmission.com>
Date:   Fri May 8 23:49:47 2015 -0500

    mnt: Modify fs_fully_visible to deal with locked ro nodev and atime

    Ignore an existing mount if the locked readonly, nodev or atime
    attributes are less permissive than the desired attributes
    of the new mount.
...

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-19 12:20:15 +03:00
Pavel Emelyanov
350a7a982a Revert "cgroups: Add ability to reuse existing cgroup yard directory"
Reasoning: some systems have /sys/fs/cgroup stuff mounted as read-only
and we have to either remount it rw or create our own set. The former
doesn't look sane as this rw remounting is also done by ststemd, so
let's return back to manual cgyard construction.

This reverts commit 860df95f85.

Conflicts:
	cgroup.c
	include/cr_options.h

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-16 19:15:20 +03:00
Tycho Andersen
081a5b9e77 pie: use the /proc fd for last pid
Instead of keeping around multiple fds that point to various places in
/proc, let's just use /proc and openat() things relative to it.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-16 12:17:37 +03:00
Tycho Andersen
7083fc370d lsm: restore lsm bits per tid instead of per pid
This is a little tricky, since the threads are forked in the restorer blob, we
can't open their attr/curent files to pass into the restorer blob. So, we pass
in an fd for /proc that the restorer blob can use to access the attr/current
files once they exist.

N.B. this is still incorrect in that it restores the same credentials for all
threads in the group; however, it matches the behavior of the current creds
restore code, which also restores the same creds for all threads in the group.

v2: use simple_sprintf() instead of pie_strcat()

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-16 12:17:36 +03:00
Tycho Andersen
ea5f35e26f pie: add printf-like functionality to simple_buf
We'll use this in the next patch for printing paths to LSM files in /proc.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-16 12:17:35 +03:00
Tycho Andersen
a5019ff36b pie/x86_64: syscall clobbers rcx and r11
o_O this is one of those "how has nobody ever hit this" bugs.

According to:

http://stackoverflow.com/questions/2535989/what-are-the-calling-conventions-for-unix-linux-system-calls-on-x86-64

syscall on x86_64 clobbers rcx and r11. We should mark these registers as
clobbered in RUN_CLONE_RESTORE_FN so that gcc avoids using them, e.g.:

...<__export_restore_task>
    ...
    1894: 49 89 db              mov    r11,rbx
    1897: 4c 8d 4c 24 60        lea    r9,[rsp+0x60]
    189c: 48 89 eb              mov    rbx,rbp
    189f: 48 89 44 24 10        mov    QWORD PTR [rsp+0x10],rax
    18a4: 48 8d 44 24 30        lea    rax,[rsp+0x30]
    18a9: 48 89 44 24 18        mov    QWORD PTR [rsp+0x18],rax
    18ae: eb 53                 jmp    1903 <clone_end+0x15>

00000000000018b0 <clone_emul>:
    18b0: 48 8b 74 24 08        mov    rsi,QWORD PTR [rsp+0x8]
    18b5: 48 83 ee 10           sub    rsi,0x10
    18b9: 48 89 ef              mov    rdi,rbp
    18bc: 48 89 7e 08           mov    QWORD PTR [rsi+0x8],rdi
    18c0: 49 8b 7b 20           mov    rdi,QWORD PTR [r11+0x20]
    18c4: 48 89 3e              mov    QWORD PTR [rsi],rdi
    18c7: 48 c7 c7 00 0d 05 00  mov    rdi,0x50d00
    18ce: 48 8b 54 24 18        mov    rdx,QWORD PTR [rsp+0x18]
    18d3: 4d 89 fa              mov    r10,r15
    18d6: b8 38 00 00 00        mov    eax,0x38
    18db: 0f 05                 syscall
    18dd: 48 85 c0              test   rax,rax
    18e0: 74 05                 je     18e7 <thread_run>
    18e2: 48 89 c5              mov    rbp,rax
    18e5: eb 07                 jmp    18ee <clone_end>

00000000000018e7 <thread_run>:
    18e7: 48 31 ed              xor    rbp,rbp
    18ea: 58                    pop    rax
    18eb: 5f                    pop    rdi
    18ec: ff d0                 call   rax

00000000000018ee <clone_end>:
    18ee: 41 83 c5 01           add    r13d,0x1
    18f2: 49 81 c7 00 8c 00 00  add    r15,0x8c00
    18f9: 45 39 6b 14           cmp    DWORD PTR [r11+0x14],r13d

will cause a seg fault because r11 is clobbered.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-16 12:17:34 +03:00
Cyrill Gorcunov
1998fbfa87 pie: relocs -- Fix compilation on ARM
Otherwise getting

 | parasite-syscall.c: In function ‘parasite_infect_seized’:
 | parasite-syscall.c:1222:5: error: ‘elf_relocs’ undeclared (first use in this function)

Simply wrap the @elf_relocs_apply with macros.

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-16 11:40:20 +03:00
Cyrill Gorcunov
c7d646afb3 cgroups: Introduce cgroup management modes
When been playing wich checkpoint/restore of container I found
that we can't reuse existing controller if they were pre-created.
For example currently in PCS7 we're bindmount cgroups which belong
to a container in a form of

 /sys/fs/cgroup/<controller>/<container> ==> /sys/fs/cgroup/<controller>

so that CRIU dumps such configuration fine but on restore
it recreates controllers from the scratch which we would
like to bindmount them and ask CRIU to restore subcgroups
and their parameters.

So I extended --manage-cgroups option to take <mode> arguments.
Detailed description in docs.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-15 21:21:56 +03:00
Cyrill Gorcunov
860df95f85 cgroups: Add ability to reuse existing cgroup yard directory
Currently we always create temporary directory where we restore
cgroups, but this won't work in case if mounting cgroups is forbidden
from inside of a container for some reason (as in OpenVZ kernel).

So one can pass --cgroup-yard option to specify an existing
directory where cgroups are living. By default we assume it
lays in /sys/fs/cgroup.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-15 21:21:54 +03:00
Cyrill Gorcunov
a65bffe323 pie: piegen -- Handle SHN_ABS symbols
For example some linkers generate @__export_parasite_args
as symbol which won't relocate. Handle such case properly.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-15 21:17:36 +03:00
Cyrill Gorcunov
e6a1097265 pie: piegen -- Fix debug messages for relocs on x86-64
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-15 21:17:28 +03:00
Cyrill Gorcunov
732aa040d9 pie: piegen -- Use already computed @sec_hdrs
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-15 21:17:22 +03:00
Cyrill Gorcunov
ea0fd2aa08 pie: piegen -- Make different names for parasite and restorer relocs
Otherwise it's confusing since.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-15 21:15:57 +03:00
Tycho Andersen
aa557c963f piegen: fix build on 64-bit ubuntu
The error I got was:

  CC       pie/piegen/elf-x86-64.o
In file included from pie/piegen/elf-x86-32.c:16:0:
pie/piegen/elf.c: In function ‘handle_elf_x86_32’:
pie/piegen/elf.c:476:3: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘Elf32_Word’ [-Werror=format=]
   pr_debug("Copying section '%s'\n" \
   ^

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-15 21:14:19 +03:00
Laurent Dufour
61c5837f62 timerfd: fix hard definition of TFD_IOC_SET_TICKS
On PPC64, the hard definition of TFD_IOC_SET_TICKS doesn't match the kernel
one.
We should use the _IOW based on to be more flexible here.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-15 21:13:53 +03:00
Tycho Andersen
e7d89a60b6 add openat() to syscall list
We'll need this for use in the restorer blob for restoring LSMs. It looks like
arm already has openat, so I think it's just x86 and ppc that need it. In any
case, please double check this, as I've only tested it on x86.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-11 19:51:40 +03:00
Andrew Vagin
2fbf267bfe test/libcriu: inlude all required headers
Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Acked-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-11 19:50:48 +03:00
Andrey Vagin
4eb0952c0e net: don't call netns_entry__free_unpacked for uninitialized pointer (v2)
If the netns image is absent, the NetnsEntry entry will not be initialized.

Currently restore from old images crashes:

Core was generated by `criu swrk 3'.
Program terminated with signal SIGSEGV, Segmentation fault.
$0  0x0000000000427d80 in netns_entry.free_unpacked ()
(gdb) bt
$0  0x0000000000427d80 in netns_entry.free_unpacked ()
$1  0x0000000000436d07 in prepare_net_ns ()
$2  0x0000000000457c78 in prepare_namespace ()
$3  0x0000000000432917 in restore_task_with_children ()
$4  0x00007fc86acfccfd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

v2: remove debugging code

Cc: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-11 19:50:03 +03:00
Laurent Dufour
f50e0a6e36 ppc64: Fix buggy floating point register handling
The checkpoint and restore of the Power PC floating point registers is
buggy.

The issue is that the signal frame context is defined to store double value
while the protocol buffer is handling unsigned 64bits integer value. A
silent cast done by the compiler was modifying the restored value in our
back.

This fix changes the type used when manipulating the FP registers value to
be consistent between checkpoint and restart.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-11 19:49:19 +03:00
Andrey Vagin
a26f1cd39b mnt: tune the root mount before mounting a root yard
Otherwise the root yard can be propagated into the host mount namespace
and remain there and criu will fail, because it will not be able to
remove the roots yard.

It occures if we give a shared mount as root to "criu restore" and
criu converts it into a slave mount.

Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-11 19:48:42 +03:00
Laurent Dufour
bab3d9693a piegen: prefix piegen's output
Add prefix to the piegen's error and debug output to avoid confusion and
fix few debug lines.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-11 19:47:33 +03:00
Laurent Dufour
93f0d6ce56 piegen: opts variable is global
Since opts is defined as extern in piegen.h, there is no need to pass it as
argument.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-11 19:47:15 +03:00
Laurent Dufour
8c98ede371 piegen: separates generated output from debug
Introduce a new -o argument to piegen to specify generate file name.
Send the debug stream to stdout and force it to /dev/null in the makefile
if V=1 is not specify.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-11 19:46:45 +03:00
Laurent Dufour
e8e13d7f9f piegen: fix handle elf returned value
handle elf should return 0 on success.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-11 19:46:23 +03:00
Cyrill Gorcunov
46270d11fe pie: Use PIE_SIZE helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:37 +03:00
Cyrill Gorcunov
2f16ec33a1 pie: piegen -- Add PIE_SIZE helper
To hide @nr_gotpcrel

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:35 +03:00
Laurent Dufour
e83907ad36 pie: piegen -- Only copy required sections
When building the blob in the generated header file, we may
shrink the output blobk and only copy the sections with the SHF_ALLOC
bit set, the other ones are not needed at runtime.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:31 +03:00
Laurent Dufour
89d6b39cfe ppc64: pie -- Add ppc64le relocation's processing
This cleans the assembly code, removing no more needed trick with the
register 2 (TOC pointer). As a consequence, the __export_restore_task_trampoline()
and __export_unmap_trampoline() are no more needed.

Thus, the changes introduced by the commit de9df91002 ("Per architecture restorer
trampolines") in cr-restore.c are no more used but are not impacting
runtime code anyway.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:30 +03:00
Laurent Dufour
c755e0eb96 ppc64: pie -- Move the TOC in its own section
PowerPC linking requires the TOC to be in its own section
and to be aligned.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:29 +03:00
Cyrill Gorcunov
f03a4672ce pie: piegen -- Slightly rework the building procedure
- Move relocs application into a separate file which get
   compiled as a regular C file in criu (pie/pie-relocs.[ch])
 - Move types used by piegen into pie/piegen/uapi/types.h

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:27 +03:00
Cyrill Gorcunov
ac187856c4 pie: x86 -- Do a real call for applying relocations
At moment both parasite and restorer do not have
any relocs because we support x86-64 only, but
this will be changed soon so do a call and apply
relocations.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:26 +03:00
Cyrill Gorcunov
5258d95eb9 pie: piegen, x86 -- Fix relocs application
We should use provided @nr_relocs instead of ARRAY_SIZE here.
Didn't spot it earlier simply because at moment on x86-64
there is no relocs at all.

Also when we apply relocation they are to be computed from
virtual base of parasite address, not from local memory
map address, so add @vbase parameter. And fix typo on
addend in gotpcrel.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:25 +03:00
Cyrill Gorcunov
c84fa8c506 pie: x86 -- Adjust size of parasite and restorer code
In case of @gotpcrel relocations we need additional
space to carry pointers.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:24 +03:00
Cyrill Gorcunov
fba12ae9ff arch: x86-32 -- Be able to build 32bit CRIU
After this patch one can run ARCH="ia32" make to build
32bit version on CRIU on 64bit host. Note this is only
build procedure which tuned up, the CRIU itself is not
yet ready to make a checkpoint/restore cycle -- a lot
of additional code is needed and here we rather put
stubs simply to make build procedure run.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:22 +03:00
Cyrill Gorcunov
e04f683d85 pie: x86-32 -- Prepare parasite head
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:21 +03:00
Cyrill Gorcunov
b07bbf8152 pie: x86-32 -- Build parasite code without PIC
There is no rip addressing in 32bit code but PIE code
require GOT tables and friend which we better escape
for performance sake. So lets use pc relocations it
should do the trick.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:20 +03:00
Cyrill Gorcunov
816c802176 x86: Add 32bit variant of TASK_SIZE
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:19 +03:00
Cyrill Gorcunov
918f20648c arch: x86-32 syscalls -- Wire in syscalls generation
To support x86-32 mode we will need own syscall table.
Here is it. Note the CRIU itself doesn't support such
mode yet.

Meanwhile put syscall table here just in case if someone
is adding new syscall 32 bit variant should be updated
as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:18 +03:00
Cyrill Gorcunov
41999f40b0 x86: Start using native object relocatable files in parasite code
Since at the moment we're running only x86-64 not 32 bit tasks,
and our code is not carrying any big statically defined structures
we can use relocatable files directly with all relocation applied
during building.

This gonna be changed soon once we start supporting 32 bit tasks.

IOW even currently we need (which is not yet done but it's safe)

 - check for gotpcrel relocations
 - apply relocations with generated elf_apply_relocs helper

Currently overall scheme looks this way

 - our object files are linked together into parasite.built-in.bin.o file
 - then pie/piegen/piegen tool is called which parses this file and generates
   C source code file with bytestream and all information needed to rellocate
   this bytestream into a new place (see elf_apply_relocs helper)

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:16 +03:00
Cyrill Gorcunov
b6668af613 piegen: Implement tool building, v2
Here we simply build piegen tool which gonna be used
to generate parasite code safe to rellocate. The tool
is taking object file as an argument, parses it and
generates C file with rellocations encoded in form
suitable for fast appliance.

Currently only x86-32 x86-64 is supported.

v2 (by ldufour@):
 - Filter PIEGEN

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:53:15 +03:00
Pavel Emelyanov
7a9813346b rst: Sanitize standard arrays remapping
On restore we have several arrays of objects that get remapped
into pie area and their number is also passed. Clean and shorten
the remapping code a bit and bing their naming to common format.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:39:27 +03:00
Andrew Vagin
a668833905 zdtm/cgroup02: remove subgroups in the cleanup hook
systemd executes tests in subgroups:
 9679 ?        Ssl    0:41 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war -
[root@jenkins ~]# cat /proc/9679/cgroup
10:net_cls:/
9:hugetlb:/
8:cpuset:/
7:blkio:/system.slice
6:freezer:/
5:cpu,cpuacct:/system.slice
4:devices:/system.slice/jenkins.service
3:perf_event:/
2:memory:/system.slice
1:name=systemd:/system.slice/jenkins.service

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:38:38 +03:00
Andrew Vagin
45bc46ed8f zdtm: don't ignore hook's errors
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:38:31 +03:00
Adrian Reber
89e7f375fc Provide installation target without documentation
The criu(8) man-page is generated using asciidoc. The problem with
asciidoc is that, due to its dependencies, it is not available on
all distributions or it is undesired to install all asciidoc
dependencies. The install target was unconditionally installing and thus
building the man-page even if not explicitly specified with 'make docs'.
With the new 'install-criu' target everything besides the man-page is
installed and the target 'install-man' is only called by the target
'install'.

Signed-off-by: Adrian Reber <areber@redhat.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Looks-ok-to: Cyril Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:37:34 +03:00
Pavel Emelyanov
25d074ad91 unix: Don't dump external peer w/o name
On restore we will use the peer's name to connect() the
socket back, so if there's no name dump should be aborted.

This situation happens when we create a socketpair(), fork
and dump only one task with one pair end.

Reported-by: Artem Kuzmitskiy <artem.kuzmitskiy@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-06-08 23:36:21 +03:00