2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-26 20:07:28 +00:00

246 Commits

Author SHA1 Message Date
Kir Kolyshkin
bc93f12abd compel hgen: fix for 32-bit ARM
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>
2017-04-02 18:12:10 +03:00
Kir Kolyshkin
f62818d9ad compel: no -r for ARM ldflags
Commit d9486bd720 ("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>
2017-04-02 18:12:10 +03:00
Kir Kolyshkin
8b99809a4e compel: make plugins .a archives
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>
2017-04-02 18:12:10 +03:00
Kir Kolyshkin
f3a1dc5cc9 compel/plugins/Makefile: clean up
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>
2017-04-02 18:12:10 +03:00
Stanislav Kinsburskiy
6d8f8399ef compel: wrap rt_sigframe with parentheses
It can be passed as link to real object.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:12:10 +03:00
Stanislav Kinsburskiy
9301c5d613 compel: return ptrace area helpers back to uapi
These helpers are valuable and can be used outside.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:12:10 +03:00
Kir Kolyshkin
a6ed6964a2 compel ppc64 infect.c: fix clang compilation
This is generated by clang-3.8:
> compel/arch/ppc64/src/lib/infect.c:31:20: error: unused function
> '__check_code_syscall' [-Werror,-Wunused-function]
> static inline void __check_code_syscall(void)
>                    ^

The fix is the same as in commit 3ea2fd7.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:09:34 +03:00
Cyrill Gorcunov
6e4d05853d compel: infect -- Don't forget to fetch sas early
When infecting victim we construct sigframe to
be able to self-rectore it in case if something
goes wrong. But in case is a targer been using
alternative stack for signal handling it will
be missed in sigframe since we don't fetch it.

Thus add fetching sas on infection stage and
put it into signal frame early.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:09:34 +03:00
Pavel Emelyanov
36ebce8d9c compel: Test for FDs stealing
An example, that steals stderr descriptor from victim task.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:09 +03:00
Pavel Emelyanov
a5752133c7 compel: Add recv fd helper
The same for libcompel.so user.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:09 +03:00
Pavel Emelyanov
6794c8c2a9 compel: Add fds plugin (v2)
This is just export by reasonable name of the existing
code, that sends and receives FDs via compel RPC socket.

v2:
 Rebase on recent criu-dev
 Fix parallel build

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:09 +03:00
Dmitry Safonov
b502d7fd6b compel: pass regs by pointer in get_task_regs()
CID 73371 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter regs of type user_regs_struct_t
(size 224 bytes) by value.

Suggesting to do this until compel is released and API is cut in stone.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:09 +03:00
Dmitry Safonov
72557edb15 compel/ksigset: fix ksigaddset() UB and flushing mask
Found by Coverity error:
> CID 172193 (#1 of 1): Bad bit shift operation (BAD_SHIFT)
> 1. large_shift: In expression 1 << sig % 64, left shifting
> by more than 31 bits has undefined behavior. The shift amount,
> sig % 64, is as much as 63.

That is:
1. yes, UB
2. while adding a signal to mask, this has flushed all other
   signals from mask.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:09 +03:00
Kir Kolyshkin
eebfeb925b compel plugins uapi: rename includes
The statement like

	#include <compel/plugins/plugin-std.h>

looks a bit tautological. I think the single "plugins" word is enough:

	#include <compel/plugins/std.h>

Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:09 +03:00
Kir Kolyshkin
485a47babc compel/plugins: simplify #includes
First, for building compel plugins, we already have
"-I compel/include/uapi" in ccflags and asflags, so there is
no need to add "-iquote include/uapi".

Second, let's refer to compel plugin uapi includes in a uniform way,
choosing the same way the external code does, i.e. #include <compel/...>.

Third, in a few cases simplify #include statements by including
compel/plugins/plugin-std.h instead of a number of plugins/std/*.h files.

Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:09 +03:00
Kir Kolyshkin
9067c5c18f compel/plugin-std.h: include log.h
This header should have everything we have in std/

Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:09 +03:00
Kir Kolyshkin
ef849f2df8 compel Makefiles: simplify headers [un]install
* install

'cp' can copy recursively, create directories, and even
dereference symlinks.  Everything we have in uapi/ is to be installed.

NOTE we can't use -r for compel includes, as there is some extra stuff
in there we don't want to take with us (in particular, plugins/
and 'compel -> .' symlinks).

* uninstall

rm -rf everything under compel includedir

While at it, fix some minor things here and there.

Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:08 +03:00
Kir Kolyshkin
31eab3e36d compel: nuke compel_main()
It is not used anywhere, so unless someone has any plans, let's kill it.

Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:08 +03:00
Kir Kolyshkin
aa39838c32 compel: fix uninstall
A slash after a directory was missing in a number of places, that
resulted in "make uninstall" leaving a number of files behind.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:08 +03:00
Kir Kolyshkin
85b04c8bfd Makefiles: nuke $(SRC_DIR)
As all builds are done from top source dir, there is no need
to have SRC_DIR.

Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:08 +03:00
Kir Kolyshkin
8b745876da compel std: rename printing functions
Let's rename the printing functions so their names look more like
the standard ones.

1. putc/puts with a file descriptor.

__std_putc -> std_dputc
__std_puts -> std_dputs

There are no standard putc/puts that accept fd as an argument,
but the libc convention is to use d prefix for such. Therefore:

NOTE we keep the order of the arguments intact, to be in line
with the rest of the functions.

2. *printf

__std_printk -> std_vdprintf
__std_printf -> std_dprintf

The reason is, these are the names of libc functions with similar
functionality/arguments.

Cc: Dmitry Safonov <dsafonov@virtuozzo.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:06 +03:00
Kir Kolyshkin
026968f63a compel std_printf: annotate with printf
This function works like printf, and it helps the compiler
to know that, so it can check whether arguments fit the
format string.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:06 +03:00
Kir Kolyshkin
6b5b2996d4 compel_print_on_level(): annotate with printf
This function works like printf, and it helps the compiler
to know that, so it can check whether arguments fit the
format string.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:06 +03:00
Kir Kolyshkin
b1245247e2 compel/uapi: add prefix to log levels
These are part of compel UAPI so should be prefixed with COMPEL_
in order to not pollute the namespace. While at it, move from
set of defines to an enum, which looks a bit cleaner.

Also, kill LOG_UNDEF as it's not used anywhere.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:06 +03:00
Kir Kolyshkin
c1d4832d80 compel/include/log.h: whitespace cleanup
Those macros look twice as long as they should be on my 80-columns
terminal. As there is nothing here to justify such width, go ahead
and remove the extra tabs, keeping the code within 80 cols.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:06 +03:00
Cyrill Gorcunov
51b10d6864 compel: arch, x86 -- Add support of FPU restore in ia32 compat mode
To support ia32 compat mode on x86-64 we need to things

 - extend fpu_state_t type to carry ia32 specifics
 - fill up additional members in fpu_state_ia32_t type
   before calling sigreturn (this also requires the
   uc_mcontext::fpstate won't be aligned on 32 bytes)

Because we touches base types in compel the criu
has been updated accordingly.

Acked-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:06 +03:00
Cyrill Gorcunov
88014eb029 compel: arch, x86 -- Don't require compat frame alignment
Acked-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:06 +03:00
Cyrill Gorcunov
b729c187d5 compel: arch,x86 -- Drop native ia32 pieces
It was never functional neither we plan to support
native ia32 mode, so drop these incomplete code
pieces out.

 - Presumably we will need TASK_SIZE for compat
   mode so I provide TASK_SIZE_IA32 for this sake

 - 32 bit syscalls are remaining for a while

Acked-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:05 +03:00
Pavel Emelyanov
909590a355 Remove criu exec code
It's now obsoleted by compel library.
Maybe-TODO: Add compel tool exec action?

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:05 +03:00
Kir Kolyshkin
f233b86a02 compel: Move memcpy/memcpy/etc stuff in
This is the difference between two commits

	criu-dev/b0f6f293/Unify own memcpy/memset/memcmp
	  master/0367a1fe/Drop prefix from own memcpy/memset/memcmp

that makes criu-dev after rebase on master with latter commit
be the same as it was with former commit before rebase.

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 09:36:05 +03:00
Kir Kolyshkin
735ffc1d7e Sanitize TASK_ values
First, TASK_* defines provided by compel should be prefixed
with COMPEL_. The complication is, same constants are also used
by CRIU, some are even writted into images (meaning we should
not change their values).

One way to solve this would be to untie compel values from CRIU ones,
using some mapping between the two sets when needed (i.e. in calls to
compel_wait_task() and compel_resume_task()).

Fortunately, we can avoid implementing this mapping by separating
the ranges used by compel and criu. With this patch, compel is using
values in range 0x01..0x7f, and criu is reusing those, plus adding
more values in range 0x80..0xff for its own purposes.

Note tha the values that are used inside images are not changed
(as, luckily, they were all used by compel).

travis-ci: success for compel uapi cleanups (rev2)
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 09:36:05 +03:00
Kir Kolyshkin
99e27b1dbc compel/include/uapi/infect.h: no circular inclusion
infect.h includes compel.h, and compel.h includes infect.h.
Surely, due to include guards it will be sorted out, but
we'd rather just include what we need.

travis-ci: success for compel uapi cleanups
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-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 09:36:05 +03:00
Kir Kolyshkin
c18aa3e7fb compel: add compel_ prefix to cpu_has_feature
travis-ci: success for compel uapi cleanups
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-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 09:36:05 +03:00
Kir Kolyshkin
adaa7979be compel: split sanitize ptrace.h
We have ptrace defines and functions that are part of UAPI,
and we have some internal stuff not to be exposed. Split
ptrace.h into two files accordingly.

While at it, do some cleanups:
 - add ptrace_ prefix to some functions and macros
 - remove (duplicated) PTRACE_* defines from .c files
 - rename ptrace_seccomp(), remove its duplicate
 - remove unused ptrace defines
 - remove unneeded (ptrace-related) includes

travis-ci: success for compel uapi cleanups
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-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 09:36:04 +03:00
Andrey Ryabinin
706c05529f Makefile: add AddressSanitizer to CFLAGS
This allows to build criu with AddressSanitizer enabled:

	make ASAN=1 -j<N>

travis-ci: success for series starting with [1/6] compel/infect: fix out-of-bounds parasite memcpy()
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-03-15 09:36:04 +03:00
Dmitry Safonov
3114634698 compel/infect: don't copy gotpcrel with parasite's blob
We don't need gotpcrel inside parasite's blob:
we handle relocations over remote map in compel library,
reading them from parasite's blob header.

travis-ci: success for series starting with [1/6] compel/infect: fix out-of-bounds parasite memcpy()
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-03-15 09:36:04 +03:00
Dmitry Safonov
beed319550 compel/infect: fix out-of-bounds parasite memcpy()
We need to copy only parasite, do copy page-aligned size,
which will copy part of CRIU binary, that follows parasite
blob. That will cross red-zones and fire asan error.

travis-ci: success for series starting with [1/6] compel/infect: fix out-of-bounds parasite memcpy()
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-03-15 09:36:04 +03:00
Kirill Tkhai
95817e952e compel: Define __sys_err-s for scm stuff
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 09:36:03 +03:00
Dmitry Safonov
cbde93e12e compel/x86: clang-3.4 isn't a friend to numbers in macro
It's a workaround to clang-3.4, which doesn't handle numbers
in asm macros rightly:
https://llvm.org/bugs/show_bug.cgi?id=21500

Which resulted in:
  CC       compel/arch/x86/plugins/std/parasite-head.o
<instantiation>:3:2: error: too few operands for instruction
 pushq
 ^
compel/arch/x86/plugins/std/parasite-head.S:26:2: note: while in macro instantiation
 PARASITE_ENTRY
 ^

Fixes: https://travis-ci.org/0x7f454c46/criu/jobs/186099057

travis-ci: success for 32-bit tests fixes
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:58 +03:00
Dmitry Safonov
be783a3768 compel/x86: hang in 32-bit mode on sw-break for compat tasks
Otherwise we'll try to set 32-bit register set to 64-bit task,
which is not possible with ptrace - it uses register set size,
according to processes mode. So we should set 32-bit regset
only to tasks those are in 32-bit mode already.
Please, see inline comment in the patch for more info.

travis-ci: success for 32-bit tests fixes
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
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:09:58 +03:00
Dmitry Safonov
dd6736bd24 compel/x86/compat: pack ucontext_ia32
As I've united k_rtsigset_t between native and compat ucontext's,
it's 8-bytes aligned now. We don't care about align of this as
we fill it always with memcpy()/memset(0).
So after those changes, ucontext_ia32 has received new padding
between uc_mcontext and uc_sigmask (4 bytes to align to 8-byte sized
sigmask). Because of this, mask of blocked signals was restored
with shift (wrongly).
Fixes: signalfd00, file_attr tests.

travis-ci: success for 32-bit tests fixes
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:58 +03:00
Kir Kolyshkin
2e9ae92784 compel cli: make -p optional
Yet another nail in the coffin of compel cli usage complexity.

Since commit cd1c9d9 ("compel: simplify usage wrt ids") landed,
it became obvious that the newly introduced -p option can be
made optional. First, prefix value is not very important;
second, it can be easily generated from the input (or output)
file name.

This is what this commit does, also trying to check that
the resulting prefix is adeqate for using in C code. In case
it is not (say, file names used are 1.po 1.h), an error
is printed, suggesting to use --prefix.

The commit also makes use of this functionality by removing
-p option from compel/test/infect and criu/pie Makefiles.

While at it, let's also remove -l 4 and the kludge of hiding it.
If the output generated by this is ever needed, one can easily
run "compel hgen -l4 ..." manually.

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:57 +03:00
Kir Kolyshkin
ad2e322204 compel cli: add libs command, use it
Add "compel libs" that prints the list of libraries needed
to link the parasite loader.

Make compel/test/ and criu/ to use it.

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:57 +03:00
Kir Kolyshkin
7ad7ee4d6c compel cli: add plugins cmd, use it
A compel user should not be aware of compel internals, including
the paths to various files. This commit introduces a command to
get the plugin files (well, currently just one plugin, "std").

Example for uninstalled compel:
 $ cd compel/test/infect/
 $ ../../../compel/compel-host plugins
 ../../../compel/plugins/std.built-in

Example for installed compel:
 $ compel plugins
 /usr/libexec/compel/std.built-in.o

The commit also makes use of this command by compel/test/infect
and criu/pie.

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:57 +03:00
Kir Kolyshkin
616c6d172a compel/test/infect/Makefile: fix a dependency
Commit 8173ea2 ("compel/test/infect/Makefile: don't add .h to sources")
was a bad one as it removed dependency between parasite.h and spy binary.

Fix it.

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:57 +03:00
Kir Kolyshkin
d4ddc01654 compel/Makefile: install to bin not sbin
compel tool doesn't need to be run as root, so it makes no sense
to install it to SBINDIR. Fix to use BINDIR.

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:56 +03:00
Kir Kolyshkin
9f41af0325 compel cli: add linker script to ldflags / use it
This commit adds -T path/to/linker_script to the output
of "compel ldflags", so compel user does not have to specify
one manually.

This commit also makes use of this functionality in criu/pie
and compel/test.

NOTE this commit also drops the linker script dependency
in criu/pie/Makefile, meaning if it will be changed that
won't cause a rebuild. I hope it's not a big issue, and it is
sort of inevitable as compel is becoming a separate tool.

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:56 +03:00
Kir Kolyshkin
ea0cc75ab3 compel: make include/uapi/asm symlink permanent
Similar to the previous commit, there is absolutely no need
to create/remove this symlink from Makefiles, as it can be
made a constant one. Add the symlink to sources and save
a few lines in Makefiles.

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:56 +03:00
Kir Kolyshkin
e0fcf550c6 compel: make include/uapi symlink permanent
There is absolutely no need to create/remove this symlink
from Makefiles, as it is constant. Just add the symlink to
sources and save a few lines in Makefiles.

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
545bac9b62 Makefiles: rm -I compel/plugins... from cflags
I have noticed compel/plugins/include[/uapi] is not needed,
not entirely sure why (added symlinks?) but everything
compiles just fine without it.

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