2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-27 04:18:27 +00:00

246 Commits

Author SHA1 Message Date
Kir Kolyshkin
51c4569cd9 compel cli: show includes
1. Add "compel includes" command, to be used for parasite *loading*
   code compilation.

2. Add includes to output of "compel cflags", which is used for parasite
   code compilation.

Now, this patch looks big and complex, this is mostly because we want
compel cli to work for both uninstalled (right from the source tree)
and installed cases. The paths to be printed are quite different for
these two cases, so I had to introduce a wrapper for a non-installed
case. The wrapper sets an environment variable, which compel binary
uses as a path to non-installed file. If this env var is not set,
it means compel is installed so no tricks are needed.

Note the wrapper is only provided for the compel-host binary, as compel
(which differs from compel-host in case of cross-compiling) is not
executed from within the source tree.

Because of the wrapper, the original binary had to be renamed, thus the
changes to Makefiles and .gitignore.

travis-ci: success for More polishing for compel cli
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:09:55 +03:00
Kir Kolyshkin
f53189c520 compel cli: print usage to stderr in case of error
This is mainly dictated by the fact that we use stdout
from "compel *flags" in a special way, so it should not
be garbled by the usage info.

Otherwise, for example, the following code in Makefile

	CFLAGS += $(shell compel --badopt cflags)

will lead to the whole usage() output to be added to compiler flags,
which looks really really weird.

travis-ci: success for More polishing for compel cli
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:09:55 +03:00
Kir Kolyshkin
dfee3232e6 compel cli: kill --arch option, add --compat
There is no need to support all possible architectures
for "compel cflags" action. In fact, "compel hgen" can
only support the one it was compiled for (with the only
exception of 32-bit mode for x86).

It looks like if we can use a few #ifdefs, there is
no need to specify --arch anymore, let's drop it!

Still, for the x86 32-bit mode we need to introduce
--compat option. Note that "compel hgen" autodetects
32-bit mode for x86 by looking into ELF header, but
in case of "compel clfags" there are no files to look
into, so we need this --compat specified explicitly.

While at it,
 - Makefile: define CONFIG_AARCH64 if building for ARM64
 - fail to compile on unsupported/unspecified ARCH
 - make "compel --help" output a bit more compact

travis-ci: success for More polishing for compel cli
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:09:55 +03:00
Kir Kolyshkin
a49d44d2b3 compel/src/main.c: rm useless init
1 Since all the fields are now initialized to zeroes,
  we can just say ={};

2 Since this is static, it is initialized to zeroes anyway,
  but from my POV being explicit about it is better.

travis-ci: success for More polishing for compel cli
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:09:54 +03:00
Kir Kolyshkin
4b86502585 compel/Makefile: rm unused .FORCE thing
travis-ci: success for More polishing for compel cli
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:09:54 +03:00
Kir Kolyshkin
1be75af874 compel_syscall(): make ret argument signed
I saw this line in the code

	unsigned long sret = -ENOSYS;

and ended up with this patch. Note syscall(2) man page says return value
is long -- who am I to disagree?

travis-ci: success for More polishing for compel cli
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:09:54 +03:00
Kir Kolyshkin
7d181cda73 compel/test: Makefiles cleanup
1. Remove COMMON_IDIR -- there's no need for it, and it makes
   the build process look more complicated than it is.

2. Use standard CC and CFLAGS defines (so one can use say make CC=clang)

3. Drop the dependency on COMPEL_LIBRARY, as it's supposed to be
   an external file/tool.

4. Add -Wall to CFLAGS.

5. Simplify ARCH setting in infect test.

6. Drop ARCH from rsys test, as it's not used there.

travis-ci: success for More polishing for compel cli
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:09:54 +03:00
Kir Kolyshkin
5254258604 compel --help: fix indentation
travis-ci: success for More polishing for compel cli
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:09:54 +03:00
Dmitry Safonov
4120f64d3d pie: fix clobber registers for int 0x80
I managed to forgot that kernel erases R8...R11 regitster
prior returning to userspace from `int 0x80`:
https://lkml.org/lkml/2009/10/1/164

That was the reason for hang on gcc v6.1 on Jenkins/elsewhere:
https://ci.openvz.org/job/CRIU/job/CRIU-x86_64/branch/criu-dev/

Tested on gcc v6.1 locally, on Travis-CI:
https://travis-ci.org/0x7f454c46/criu/builds/183976899

travis-ci: success for pie: fix clobber registers for int 0x80 (rev2)
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Tested-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:09:54 +03:00
Dmitry Safonov
574fe35699 compel/compat: fixup for head_start addr
Resolves merge conflict with commit 71abfb84e158 ("compel: simplify
usage wrt ids").
Sets start ip for parasite blob according to app mode: native/compat.

travis-ci: success for Rectify 32-bit compatible C/R on x86
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:09:53 +03:00
Dmitry Safonov
1c452384c6 x86/parasite-head: add 32-bit parasite entry
To drop the second parasite blob, create another entry in 64-bit
parasite.
Didn't remove parasite-head-compat.S - it we gonna support native 32-bit
buids, we gonna need it.

travis-ci: success for Rectify 32-bit compatible C/R on x86
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:17 +03:00
Kir Kolyshkin
365b29ae38 compel --help: complete
Now, when many useless options were dropped, it's easy to
provide a complete description of CLI in usage().

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:17 +03:00
Kir Kolyshkin
ab7bf8207c compel hgen: --prefix is required
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:17 +03:00
Kir Kolyshkin
ee07e4252e compel: print errors to stderr
After seeing a bunch of silent build failures, like this:

>   GEN      criu/pie/parasite-native-blob.h
> criu/pie/Makefile:121: recipe for target 'criu/pie/parasite-native-blob.h' failed

I finally took a look at why are they silent, only to discover that
compel prints errors to stdout, and of course its stdout is silenced
in criu/pie/Makefile (unless you run make with V=1, in which case
it prints tons and tons of very useful information). I am so shocked
by this evil plan!

Anyway, let's print errors to stderr like all sane programs do.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:17 +03:00
Kir Kolyshkin
9d6228630b compel hgen: use for ARM, kill gen-offsets.sh
I am not quite sure how that happened, but compel hgen was not used for
ARM/ARM64, instead there's a simple version of it, called
gen-offsets.sh. The main difference is, shell script doesn't handle ELF
relocations, which apparently is not (currently?) needed for ARM.

It's bad to maintain two tools for the same functionality, so this
patch kills gen-offsets.sh and related stuff, making compel hgen
working on ARM. ELF relocations are still not handled, this code
is #ifdef-ed out for now and can be fixed to work on ARM later.

This patch also kills some macros and defines that seem obsoleted
now. For example, compel_relocs_apply() is now called unconditionally,
as it handles the trivial case of 0 relocs just fine.

Now, I checked that the blob headers generated by compel hgen and
gen-offsets.h are similar (i.e. generated blob code and values defined
are the same), but haven't done much above that.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:17 +03:00
Kir Kolyshkin
7cd6ad5e7e compel hgen: drop -u option
This -u option always looked wrong to me, I mean, how the hell a user
is supposed to know where the hell those headers are? It took quite
a while to figure out what to do with it, but the end result is --
this option is not needed at all and can easily be dropped.

For finding paths to includes, there is a -I compiler option,
there's no need to specify something to compel.

In fact, it should know by itself where its own headers are kept
(and emit -I... to cflags if needed), but that's another story
which is to be told when we'll decide to pack compel as a standalone
tool. For now, just add "#include <compel/compel.h>" and be done.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:17 +03:00
Kir Kolyshkin
2a1db9c2c1 compel/test/infect/Makefile: don't add .h to sources
The way the Makefile is written, parasite.h is added
to gcc command line, like this:

  gcc -o spy spy.c libcompel.a parasite.h

Surely this is not what we want, as parasite.h is included to spy.c

The fix is to use "order-only prerequisite", as described by
https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:16 +03:00
Kir Kolyshkin
06953ea4db compel handle_elf(): use continue
This is just to avoid a level of code block nesting/indentation
that can easily be avoided.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:16 +03:00
Kir Kolyshkin
4dd92a5bf6 compel: rm COMPEL_H_PARASITE_* macros
They are no longer needed.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:16 +03:00
Kir Kolyshkin
8ea542f78e compel: simplify usage wrt ids
Currently, some compel internals are exposed to user API
(both C and CLI), making its usage more complicated than
it can be.

In particular, compel user have to specify a number of parameters
(names for various data) on the command line, and when in C code
assign a struc piegen_opt_t fields using the same names, without
using those identifiers anywhere else in the code.

It makes sense to hide this complexity from a user, which is what
this commit does.

First, remove the ability to specify individual names for data,
instead introducing a prefix that is prepended to all the names.
Second, generate a function %PREFIX%_setup_c_header() which does
all the needed assignments.
Third, convert users (criu/pie and compel test) to the new API.

NOTE that this patch breaks ARM, as compel hgen is not used for ARM.
This is to be fixed by a later patch in the series.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:16 +03:00
Kir Kolyshkin
2d15cd077e compel handle-elf.c: better align generated output
This is purely cosmetical, no functional change.

1. Make sure relocs table is well aligned.

2. printf("%#02x", 1) prints 0x01, but for 0 it prints 0,
   not 0x00 as one would expect, so output is somewhat ugly.
   Use "0x%02x" format instead to make it more uniform and
   well aligned.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:16 +03:00
Kir Kolyshkin
bd22ff2aa6 __handle_elf: rm duplicated code
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:16 +03:00
Kir Kolyshkin
66bdd95347 compel --help: describe required parameters
TODO: describe optional ones.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:16 +03:00
Kir Kolyshkin
6b584033c5 compel --help: don't hardcode arch list
Instead of hardcoding list of architectures to usage(), let's
generate it from the data.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:16 +03:00
Kir Kolyshkin
98fddd5026 compel --help: fix
This:
$ ./compel/compel-host --help
./compel/compel-host: option '--help' requires an argument

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:15 +03:00
Kir Kolyshkin
904b6066f6 compel: error out on unknown opt or missing arg
getopt_long() prints an error message and returns '?' in cases
 - an unknown option is given
 - a required option argument is missing

In such cases, we need to show usage and exit with an error.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:15 +03:00
Kir Kolyshkin
9fa2cda2cd compel: tell user what's wrong with usage
In case our command line is not good, it's not enough to just show
usage info -- it is much better to explicitly say what's wrong.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:15 +03:00
Kir Kolyshkin
b73feb98db compel hgen: option -o is required
Without this check, if -o is not given, compel will fail with
the following error:

	Can't open (null)

It's non-trivial to figure out that it means -o is required.

While at it, initialize the corresponding field.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:15 +03:00
Kir Kolyshkin
ac2c9999f4 compel: separate usage() to a function
It will be easier to modify that way.

This also fixes incorrect exit code from compel -h.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:15 +03:00
Kir Kolyshkin
4072e2d2c1 compel: remove unneeded argc check
Checks for a number of arguments are to be done after option parsing.

With this patch, compel -V now works.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:15 +03:00
Kir Kolyshkin
b8474f294b compel handle_elf(): fix strings sect bounds check
Got this when using compel hgen on arm 32-bit:

Error (compel/src/lib/handle-elf-host.c:115): String section header
@0xf66e11ec is out of [0xf66e1174, 0xf66e1264)

Looking at this, it does not make sense. For the reference,
sizeof(Elf_Shdr) is 0x28, so end position is also well within bounds.

Apparently, the check for string section header bounds is wrong
as the last argument of __ptr_struct_oob() is supposed to be a
region size, not the region end address as it is.

This always worked before because the check was too relaxed, and
compel was never used on 32-bit ARM. This time it didn't work
because of a 32-bit overflow, which helped to find this bug.

This is a fix to commit 6402f03 ("compel: separate get_strings_section
from __handle_elf").

Cc: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:15 +03:00
Cyrill Gorcunov
403c96ad17 compel: Add compel_run_at helper
Simply run tracee from specfied IP assuming
it's arelady have trapping instruction in
stream.

It's unsafe low-level function use with caution.

travis-ci: success for compel: A fix and new helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:14 +03:00
Dmitry Safonov
d4c02f2eb1 compel: kill self-unmap in parasite
Why should we have self-unmapping code in parasite?
It looks like, we can drop this code using simple sys_unmap()
injection (like that I did for `criu exec` action and for cases where we
failed to insert parasite by some reason, but still need to unmap remotes).

It's an RFC, so just a suggestion - maybe I miss something you have in
mind - please, describe that/those things.

My motivation is:
- less code, defined commands for PIE, one BUG() less, one jump to PIE less
- I'm making one 64-bit parasite on x86 instead of two 32 and 64 bit.
  It works (branch 32-one-parasite) with long-jump in the beginning to
  64-bit code from 32-bit task.
  On parasite curing it sig-returns from 64-bit parasite to 32-bit task,
  this point we're trapping in CRIU. After that we command parasite to
  unmap itself, so it long-jumps again to parasite 64-bit code, unmaps,
  we caught task after sys_unmap and the task is with 64-bit CS.
  We can't set 32-bit registers after this - kernel checks that
  registers set is the same on PTRACE_SETREGSET:
> > static int ptrace_regset(struct task_struct *task, int req, unsigned int type,
> >                        struct iovec *kiov)
...
> >       if (!regset || (kiov->iov_len % regset->size) != 0)
> >               return -EINVAL;
  So, to return again to 32-bit task I need sigreturn() again or add
  long-jump with 32-bit CS.
  I've disable that for 32-bit testing with (in compel_cure_remote):
-       if (ctl->addr_cmd) {
+       if (ctl->addr_cmd && user_regs_native(&ctl->orig.regs)) {
  And it works. It also works for native tasks, so why should we keep it?

travis-ci: success for compel: kill self-unmap in parasite
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@virtuozzo.com>
Cc: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:14 +03:00
Pavel Emelyanov
483f3e886b compel: Test for remote syscall execution
The library can be used not only to run infection blobs,
but also just to execute syscalls remotely and here's
an example of how to do this.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:14 +03:00
Pavel Emelyanov
dd4d5aedda compel: Simple infection test
And, at the same time, an example of how to work with compel.
Based on titanic preliminary work of Cyrill :)

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:14 +03:00
Pavel Emelyanov
16080b7f6f compel: Hide compel_execute_syscall() from uapi
It uses regs caller doesn't always know and is actually a
core routine under the API compel_syscall() one.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:14 +03:00
Pavel Emelyanov
7dbf89c4d0 compel: Remove size/bsize from blob desc
The size value should be page_size() aligned, which is
inconvenient for callers, and also differs from the bsize
only a little bit, so it's nicer to have the nr_gotpcrel
value which is anyway generated by compel hgen.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:14 +03:00
Pavel Emelyanov
bf24eecdf6 compel: Add helpers for hgen bdesc filling
These names are generated by compel hgen, so there's no
need in making callers know them.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:14 +03:00
Pavel Emelyanov
d6b9f74266 compel: Rename compel_unseize_task into _resume_
To be symmetrical with compel_stop_task() one.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:13 +03:00
Pavel Emelyanov
167d28bd9e compel: Add compel_stop_task() to UAPI headers
The routine itself is in library, just forgot to putt the
declaration into UAPI header.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:13 +03:00
Cyrill Gorcunov
fe0413ef9e compel: plugins -- Merge fds plugin into std
We use fds helpers in std plugin anyway
so just merge it in.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:13 +03:00
Cyrill Gorcunov
a9a7bf7b49 compel: cli -- Fix typo in options parsing
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:13 +03:00
Cyrill Gorcunov
474289f040 compel: Add installation
To ship plugins, libs and dev headers.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:13 +03:00
Cyrill Gorcunov
5a7c137bb7 compel: Prepare to ship common headers into compel
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:13 +03:00
Cyrill Gorcunov
d6798cb3a4 compel: uapi -- Add common symlink
Because we build compel from toplevel directory
inclusion of "common/" doesn't cause any problem
but will in future (especially when our headers
start using it).

Thus add symlink immediately and it will be a notice
for installer that common directory in needed in uapi.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:12 +03:00
Pavel Emelyanov
658206f269 compel: Prepare for several ways to load blob into libcompel
Right now we load blob into libcompel by providing values
from .h file which was generated by "compel hgen" command.

In the future we'd like to provide other ways (e.g. by
pusing mmap()-ed memory with .o file, or by .o file path),
so prepare for such future.

travis-ci: success for compel: Prepare for several ways to load blob into libcompel
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:12 +03:00
Cyrill Gorcunov
0af11b421a compel: Rename 'piegen' action into 'hgen'
Where hgen stands for "header generator".

travis-ci: success for compel: Rename 'piegen' action into 'hgen'
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:12 +03:00
Cyrill Gorcunov
61769b466b compel: Improve infect
- extend handle_sigchld
 - fix garbage return in compel_prepare
 - handle errors in make_sock_for

travis-ci: success for compel: A few fixes and example
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:12 +03:00
Cyrill Gorcunov
50219defcf compel: plugins,fds -- Don't include log.h
It's libcompel's helper. We need to address this problem later.

travis-ci: success for compel: A few fixes and example
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:12 +03:00
Dmitry Safonov
2e39767a41 uapi/compel/criu: move auxv_t, tls_t back to CRIU
We don't need them in libcompel for PIE - only needed for C/R.

Fixes (with compat enabled back):
  CC       criu/arch/x86/sigaction_compat.o
In file included from criu/arch/x86/sigaction_compat.c:1:0:
/home/japdoll/tools/criu/criu/arch/x86/include/asm/restorer.h:15:25: error: unknown type name ‘tls_t’
 extern void restore_tls(tls_t *ptls);
                         ^~~~~

travis-ci: success for Compel/compat cleanups
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:12 +03:00