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>
To run CRIU with ASan we have to use some non-default options:
- detect_leaks=0 - We have to many leaks for know. Let's disable until fixed.
- disable_coredump=0 - without this ASan library changes RLIMIT_CORE which
break rlmimits00 tests.
- log_path=asan.log - For some reason default output to stderr sometimes
doesn't work in CRIU. So error log will be stored
in asan.log.<pid> file instead.
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>
ASan doesn't play nicely with clone if we use current stack for
child task. ASan puts local variables on the fake stack
to catch use-after-return bug:
https://github.com/google/sanitizers/wiki/AddressSanitizerUseAfterReturn#algorithm
So it's become easy to overflow this fake stack frame in cloned child.
We need a real stack for clone().
To workaround this we add clone_noasan() not-instrumented wrapper for
clone(). Unfortunately we can't use __attrbute__((no_sanitize_addresss))
for this because of bug in GCC > 6:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69863
So the only way is to put this wrapper in separate non-instrumented file.
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>
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>
This adds the reverse of CFLAGS_obj.o with CFLAGS_REMOVE_obj.o.
This allows to prevent certain CFLAGS from being used to
compile files.
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>
Cc: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
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>
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>
Those symlinks were for building 32-bit objects with `-m32` to
link them with 32-bit parasite. Since I have dropped second parasite,
I cleaned Makefile rules for 32-bit parasite, but accidentally left
those symlinks. Drop them now.
travis-ci: success for x86/compat: clean symlinks left from second parasite
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
The functions it provides, send_fds() and receive_fds(), are already
provided by compel/plugins/std.built-in.o (compel/plugins/std/fds.c)
which is linked into both parasite and restorer.
This fixes the following issue (for some reason, reported on ARMv7,
see https://travis-ci.org/kolyshkin/criu/jobs/195367825):
LINK criu/pie/parasite.built-in.o
GEN criu/pie/parasite.built-in.bin.o
criu/pie/pie.lib.a(util-fd.o): In function `send_fds':
/criu/include/common/scm-code.c:56: multiple definition of `send_fds'
criu/pie/parasite.built-in.o:/criu/include/common/scm-code.c:56: first
defined here
criu/pie/pie.lib.a(util-fd.o): In function `recv_fds':
/criu/include/common/scm-code.c:79: multiple definition of `recv_fds'
criu/pie/parasite.built-in.o:/criu/include/common/scm-code.c:79: first
defined here
criu/pie/Makefile:53: recipe for target
'criu/pie/parasite.built-in.bin.o' failed
make[2]: *** [criu/pie/parasite.built-in.bin.o] Error 1
travis-ci: success for criu/pie: kill util-fd.c
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
In a manner similar to one of commit 9303ed3 ("Makefiles: move
-Wa,--noexecstack out of CFLAGS"), let's move this option
from assembler to linker flags (see the abovementioned commit
for reasoning).
This fixes generating dependencies for criu/arch/x86/call32.S when using clang:
DEP criu/arch/x86/call32.d
clang-3.8: error: argument unused during compilation: '-Wa,--noexecstack'
DEP criu/arch/x86/call32.d
clang-3.8: error: argument unused during compilation: '-Wa,--noexecstack'
travis-ci: success for criu/arch/x86/Makefile: move -Wa out of asflags (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>
The kernel does touch only relevant union member on x86_32.
travis-ci: success for zdtm/sigpending/32: check only 12 bytes of _si_fields
Cc: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
It's library plugin to CRIU - it needs to be 64-bit.
travis-ci: success for zdtm/test/rtc: build 64-bit criu-rtc.so
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
For 32-bit fcntl() Glibc function calls sys_fcntl64(), which
needs struct flock64, otherwise the kernel gets a wrong struct.
For 64-bit, it's all the same.
Also unset errno before fcntl() and check return value of the call.
Cc: Qiang Huang <h.huangqiang@huawei.com>
Cc: Begunkov Pavel <asml.silence@gmail.com>
Cc: Pavel Emelyanov <xemul@virtuozzo.com>
travis-ci: success for test/zdtm: use flock64 instead of flock
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Raw sys_mmap() returns address or error like -ENOMEM.
Don't check MAP_FAILED, check that result is aligned by page.
travis-ci: success for x86/compat: fix error-check for compat mmap()
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Initialy, I thought to name it "compat_restore", but after I've dropped
the second 32-bit parasite (which surely made compat code lesser and
easier), our parasite works in 64-bit in 32-bit task and ptrace()
for setting registers in this long-jumped situation will work correctly
only after v4.9 kernel. Maybe it can be work-arounded if needed,
but yet no compatible dump for pre-v4.9 kernels.
Requested-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
As threads restore in parallel, stack32 may be reused concurrently
leading to reusing others thread's data. So, let it lay on stack.
It would still worth making 32-bit stack per-task reusing it in threads
but at this moment introducing such complexity looks like premature
optimization.
It does not affect 64-bit C/R.
Fixes: file_aio, sigaltstack, clone_fs, socket_aio, different_creds, futex
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>
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>
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>
We can be on v4.9 or newer kernel, but have no 32-bit multilib
toolchain, which will result in !CONFIG_COMPAT but
kdat_compat_sigreturn_test() will return true as we have
new arch_prctls in kernel needed for compatible C/R.
Fail compat test in this case.
travis-ci: success for 32-bit tests fixes
Reported-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
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>
In this case it will work for any make commangs. For example:
make COMPAT_TEST=y -C test/zdtm/lib
travis-ci: success for zdtm: handle COMPAT_TEST from Makefile.inc
Cc: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Problem: if we do
touch criu/arch/x86/cpu.c
nothing is being rebuilt.
For detailed analisys, see the previous commit
("criu/Makefile: fix rebuilding criu/pie/pie.lib.a").
Note there are other targets in criu/Makefile where one
might want to add .FORCE to, but it's not needed as they
all depend on another target which itself is marked as .PHONY.
travis-ci: success for Makefiles: fix deps checking
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
As reported by Andrei Vagin:
touch criu/pie/parasite-vdso.c
does not lead to rebuild pie.lib.a and its dependencies.
This happened because the real dependencies of criu/pie/pie.lib.a
are listed in criu/pie/Makefile.library, which is never included
or called with sub-make, because the criu/Makefile says:
criu/pie/pie.lib.a: $(ARCH-LIB)
$(Q) $(MAKE) $(call build-as,Makefile.library,criu/pie) all
essentially saying we only need to call a sub-make with Makefile.library
if the target is absent, or $(ARCH-LIB) is newer than the target.
A workaround is to use .FORCE so that the Makefile.library is always
called and so the dependencies are checked.
Note the above is also true for any target that involves calling
a sub-make -- it should either be used with .FORCE or otherwise
depend on a phony target. I haven't checked all the CRIU makefiles
but suspect there might be more cases like this one.
travis-ci: success for Makefiles: fix deps checking
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Reported-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
travis-ci: success for .gitignore: Add compel and common asm symlinks
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
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>
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>
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>
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>
Since commit 656710e the list of prerequisites are the same
as the list of objects, so we can use $^ to avoid repetition.
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>
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>
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>
Instead of hardcoding the path to compel uapi includes,
call compel tool to get one.
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>
Build of criu binary depends on many other things that needs to be built
before it. Let's clean these deps a bit by using criu-deps variable.
This also removes wrong "$(VERSION_HEADER): include/common/asm"
dependency -- one can certainly succeed in generating
criu/include/version.h file without creating include/common/asm
symlink fist!
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>
Working on CRIU Makefilest feels like walking on a minefield.
This is not an attempt to demine it, but to make some mines
a bit easier to notice.
OK, this is what we're trying to do here:
1. Drop the $(SRC_DIR)/ prefix from the target: as this is a top-level
Makefile, we can just use paths relative to top-level source dir.
2. Drop the $(SRC_DIR) from the symlink, use relative one. Relative
symlinks are always better -- say, if a source directory is
moved, everything will still work.
3. The "compel/include/asm: compel/arch/$(ARCH)/src/lib/include"
dependency is useless. Yes, the left side is created as a symlink
to the right side, but that doesn't mean that "make" should
compare the timestamps of both to decide whether to remake
the target.
4. The "$(COMPEL_VERSION_HEADER): compel/include/asm" dependency
is wrong, the compel/include/asm symlink is not needed for
$(COMPEL_VERSION_HEADER) generation. Remove it.
5. Move compel/plugins/std.built-in.o prerequisite from the rule
to compel-plugins variable, and 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>
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>
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>
As of commit 3c16dc5 ("compel: plugins -- Merge fds plugin into std")
fds plugin is no more. Remove this leftover.
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>
We call compel-host binary from a number of places, so
let's add COMPEL_BIN variable and 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>