There is a little difference between ccflags-y and CFLAGS, except the
local/global visibility: nmk adds $(CFLAGS) to nmk-asflags and assembles
using them, but without ccflags-y.
The other possible way would be adding asflags-y with CFLAGS_PIE, but
I'm not convinced - let's update CFLAGS for the time being.
Signed-off-by: Dmitry Safonov <dima@arista.com>
Rather than chain[chain] != STN_UNDEF.
Seems like, on !ARM32 vdso there are more symbols and less chance to hit
this "feature".
Fixes parsing of __vdso_clock_gettime symbol on v5.1 arm kernel.
Signed-off-by: Dmitry Safonov <dima@arista.com>
The patch "util-vdso: Check chain for STN_UNDEF" fixed an issue about
not discovering present symbols on vdso. While it's a good and a proper
fix, as the result __kernel_vsyscall started being patched.
Which in result broke zdtm trampoline test on ia32.
So, let's omit patching vsyscall while #512 issue is not fixed.
We might actually refrain patching it for long time as it doesn't access
vvar, so there is little sense in doing patching.
Signed-off-by: Dmitry Safonov <dima@arista.com>
After patching code - we need to flush CPU cache, it's done with
__builtin___clear_cache(). As we don't link to libgcc, provide a helper
that wraps ARM-specific syscall.
Fixes:
LINK criu/pie/restorer.built-in.o
ld: ./criu/arch/arm/vdso-pie.o: in function `insert_trampoline':
/root/criu/criu/arch/arm/vdso-pie.c:32: undefined reference to `__clear_cache'
Signed-off-by: Dmitry Safonov <dima@arista.com>
We're building PIEs in arm format rather than in thumb.
Copy helpers from libgcc, provide a proper define and
link them into blobs.
Also substitute tabs by spaces, how it should have been
in pie/Makefile - tabs are for recipes.
Fixes:
LINK criu/pie/parasite.built-in.o
criu/pie/pie.lib.a(util-vdso.o): In function `elf_hash':
/criu/criu/pie/util-vdso.c:61: undefined reference to `__aeabi_uidivmod'
/criu/scripts/nmk/scripts/build.mk:209: recipe for target 'criu/pie/parasite.built-in.o' failed
Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
criu/pie/parasite-vdso.c: In function 'remap_rt_vdso':
criu/pie/parasite-vdso.c:144:17: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
if (sys_munmap((void *)vma_vdso->start, vma_entry_len(vma_vdso))) {
^
criu/pie/parasite-vdso.c:154:17: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
if (sys_munmap((void *)vma_vvar->start, vma_entry_len(vma_vvar))) {
^
cc1: all warnings being treated as errors
Signed-off-by: Dmitry Safonov <dima@arista.com>
During restore any VMA that's a subject to ASLR should be moved at the
same address as was on a checkpoint. Previously, ports to non-x86
architectures had problems with VDSO mremap(). On those platforms kernel
needs "landing" for return to userspace in some cases.
Usually, vdso provides this landing and finishes restoring of registers.
That's `int80_landing_pad` on ia32. On arm64/arm32 it's sigtrap for
SA_RESTORER - to proceed after signal processing.
That's why kernel needs to track the position of landing.
On modern kernels for platform we support it's already done - however,
for older kernels some patches needs to be backported for C/R.
Provide the checks for mremap() of special VMAs: that CRIU has suitable
kernel to work on and if we'll have some new platforms - that kernel
tracks the position of landing.
Signed-off-by: Dmitry Safonov <dima@arista.com>
In the __main__ module, __builtins__ is the built-in module builtins.
In any other module, __builtins__ is an alias for the dictionary of
the builtins module itself. [1]
Thus, hasattr(__builtins__, "basestring") would only work in __main__
module. Since pb2dict is part of pycriu and is intended to be called
by modules other than __main__, we can assume that __builtins__ would
always be a dictionary (not a module).
In Python 2, basestring is a superclass for str and unicode. [2]
However, the assignment statement creates a variable basestring in the
local scope of the function is_string() which, in Python 2, causes a
failure with UnboundLocalError. In order to mitigate this issue the
local variable name has been changed to string_types.
Fixes#708
[1] https://docs.python.org/2/reference/executionmodel.html#builtins-and-restricted-execution
[2] https://docs.python.org/2/library/functions.html#basestring
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
Since gcc version 9.1 was added the restriction that the clobber list
of an inline assembly should not contain the stack pointer register.
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=9d1cdb749a1
In commit 901f5d4 have been fixed most of the build failures related to
this gcc restriction. In this patch is resolved a build error that
occurs only on aarch64.
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
Right now we use fcntl(F_GETFD) to check whether a target descriptor
is used and then we call dup2(). Actually, we can do this for one system
call.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Dumping shmem segments causing stats "pages written" counter to mismatch
the real pages* sizes. This is due to ipcns' dumping happens in another
process and the relevant shmem dumping counters remain in its address space.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
After dump command -- verify that the amount of bytes counted in
stats-dump matches the real sizes of pages-*.img files.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Shmem pages are written in the same set of images as regular
pages are, but stats for those are not collected. Fix this, but
keep the counts separate to have more info.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Since commit b5dff62e we skipped updating dump stats for pages
that overflowed the page-pipe and thus got flushed in "chunk"
mode.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
The final release of asciidoc was on Sep 29, 2017 and the development
is continued under asciidoctor.
With commit 0493724 (Documentation: Allow to use asciidoctor for
formatting man pages) was added support for this tool by introducing
USE_ASCIIDOCTOR.
However, using asciidoctor by default might be a better option. With
this change CRIU will use asciidoctor if installed. Otherwise, it will
fallback to asciidoc.
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
From the python-six module is used only six.string_types in the
is_string() function. An alternative solution is to use
basestring with additional if statement for Python 3 compatibility.
This change avoids the dependency on the six module.
However, this module is required by junit_xml and it is not listed
as a dependency in the CentOS 7 package python2-junit_xml.
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
criu-3.12/criu/image.c:103: leaked_storage: Variable "img" going out of
scope leaks the storage it points to.
Signed-off-by: Adrian Reber <areber@redhat.com>
criu-3.12/criu/util.c:505: var_deref_model: Passing null pointer "dir"
to "dirfd", which dereferences it. (The dereference is assumed on the
basis of the 'nonnull' parameter attribute.)
Signed-off-by: Adrian Reber <areber@redhat.com>
criu-3.12/criu/sk-unix.c:1893: leaked_handle: Handle variable "sk" going
out of scope leaks the handle.
Signed-off-by: Adrian Reber <areber@redhat.com>
criu-3.12/criu/proc_parse.c:2280: leaked_storage: Variable "dir" going
out of scope leaks the storage it points to.
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
criu-3.12/criu/pagemap.c:694: var_deref_model: Passing "pr" to
"free_pagemaps", which dereferences null "pr->pmes"
Signed-off-by: Adrian Reber <areber@redhat.com>
criu-3.12/criu/mem.c:597:3: warning: Value stored to 'ret' is never read
criu-3.12/criu/mem.c:632: leaked_storage: Variable "img" going out of
scope leaks the storage it points to.
Signed-off-by: Adrian Reber <areber@redhat.com>
criu-3.12/lib/c/criu.c:255: leaked_storage: Variable "rpc" going out of
scope leaks the storage it points to.
Signed-off-by: Adrian Reber <areber@redhat.com>
This fixes a coverity buffer overflow warning:
criu-3.12/criu/log.c:344: overrun-local: Overrunning array of 1024 bytes
at byte offset 1031 by dereferencing pointer "early_log_buffer +
early_log_buf_off + log_size". [Note: The source code implementation of
the function has been overridden by a builtin model.]
Signed-off-by: Adrian Reber <areber@redhat.com>
criu-3.12/criu/files-reg.c:1574: dereference: Dereferencing "rmi", which
is known to be "NULL".
criu-3.12/criu/files-reg.c:1582: dereference: Dereferencing "tmi", which
is known to be "NULL".
Signed-off-by: Adrian Reber <areber@redhat.com>
criu-3.12/criu/files.c:1250: leaked_storage: Variable "dir" going out of
scope leaks the storage it points to.
Signed-off-by: Adrian Reber <areber@redhat.com>
criu-3.12/criu/cr-service.c:933:7: warning: Access to field 'keep_open'
results in a dereference of a null pointer (loaded from variable 'msg')
Signed-off-by: Adrian Reber <areber@redhat.com>
criu-3.12/criu/cr-service.c:1305: fixed_size_dest: You might overrun the
108-character fixed-size string "server_addr.sun_path" by copying
"opts.addr" without checking the length.
Signed-off-by: Adrian Reber <areber@redhat.com>
criu-3.12/criu/autofs.c:114: leaked_storage: Variable "path" going out
of scope leaks the storage it points to.
criu-3.12/criu/autofs.c:254: leaked_storage: Variable "opts" going out
of scope leaks the storage it points to.
criu-3.12/criu/autofs.c:719: leaked_storage: Variable "path" going out
of scope leaks the storage it points to.
criu-3.12/criu/autofs.c:980: leaked_storage: Variable "img" going out of
scope leaks the storage it points to.
Signed-off-by: Adrian Reber <areber@redhat.com>
for Intel Apollo Lake SOC, its cpuinfo and fpu features:
cpu: x86_family 6 x86_vendor_id GenuineIntel x86_model_id Intel(R) Celeron(R) CPU J3455 @ 1.50GHz
cpu: fpu: xfeatures_mask 0x11 xsave_size 1088 xsave_size_max 1088 xsaves_size 704
cpu: fpu: x87 floating point registers xstate_offsets 0 / 0 xstate_sizes 160 / 160
this CPU doesn't have AVX registers, YMM feature.
when CRIU runs on this CPU, it will report dump error:
Dumping GP/FPU registers for 4888
Error (criu/arch/x86/crtools.c:362): x86: Corruption in XFEATURE_YMM area (expected 64 but 0 obtained)
Error (criu/cr-dump.c:1278): Can't infect (pid: 4888) with parasite
that's because x86/crtools.c will still valid YMM xsave frame, thus fail to dump.
bypass unsupported feature, to make CRIU runs this kinds of CPUs.
Cc: Chen Hu <hu1.chen@intel.com>
Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>