The build on powerPC has been broken when doing some code cleanup
recently.
This patch fixes these regressions.
Fixes: f8a1a1d8d95e ("parasite-syscall: get rid of code_syscall{,size} globals")
Fixes: 69d88241584e ("sigframe: move setup_sas & make it inliner")
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
I think, we may safely remove this exports, as:
- code_syscall is used only in one function, which now will have
it as a parameter;
- code_syscall_size must be equall to BUILTIN_SYSCALL_SIZE under
BUILD_BUG_ON, so BUILTIN_SYSCALL_SIZE may be used instead.
(see ptrace(2) - align restriction to PTRACE_PEEKUSER).
This will reduce arch-depended code coupling a little.
(and I also interested in this because of I need __parasite_execute_syscall
to execute 32-bit syscall code on x86_64, which I prefer to leave without
some CONFIG_X86_64 as it's generic code)
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
To preload netfilter modules, criu runs "iptables -L" and "ip6tables -L"
before starting to dump or restore a process tree.
On systems with many entries, the above commands without the -n option
take a long time because of lengthy DNS lookups.
Signed-off-by: Saied Kazemi <saied@google.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
If an error occured during freezer_wait_processes we are
freeing processes_to_wait_pids array but same time
take freezer_detach on error path to execute, which
lead in nil dereference in best case.
Simply zap dangling pointer and make sure it exist
in freezer_detach.
Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Since commit 22396f7690 ("restore: construct sigframe in crtools")
sigframe is unused in restore_thread_common, as restore gpregs/fpu regs
now does construct_sigframe.
Impact: cleanup
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
These tests do some work while being C/R-ed, so it make sense to
let them do some progress before doing so.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
We can generate footer dynamically and
provide criu.8 version the same as
the program has.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
We may enter with @root_item = NULL in case of error
handling, so simply bail out.
Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The commit 16e673c2f6a0 ("cr-check: Inspect errno on syscall
failures") reverts the way the returned the error returned by kcmp is
checked. As a consequence 'criu check' is always failing with the
following message:
Error (cr-check.c:165): System call kcmp is not supported: No such process
This patch ensure is reported only if syscall(SYS_kcmp) returns
ENOSYS.
Fixes: 16e673c2f6a0 ("cr-check: Inspect errno on syscall failures")
Looks-good-to: Filipe Brandenburger <filbranden@google.com>
Cc: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
We're using general syscall-codes.h in criu itself
so make sure the headers we include do not override
system headers definitions.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Since getpriority() can legitimately return the value -1, it is necessary
to clear the external variable errno prior to the call, then check
it afterward to determine if -1 is an error or a legitimate value.
Cc: Filipe Brandenburger <filbranden@google.com>
Fixes: 16e673c2f6a0 ("cr-check: Inspect errno on syscall failures")
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
We define own SYS_memfd_create in case if it's missing
in libc, but we need it for user-namespace restore.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This patch changes the way the per architecture syscall-codes.h is
generated to define __NR* and SYS_* constants only if there are not
already defined.
This way this file could be included in the C files calling syscall()
to ensure the SYS_* constant is defined even if the C library is too
old.
The file syscall-codes.h should be included after the C library header
files.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
We don't need it since we use syscall() libc wrapper.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
After replacing sys_kcmp with syscall() and sys_prctl with prctl(), the
API is changed to return -1 and set errno on failure (instead of
returning the negative value of the error code directly on return.)
Commit 8ceab588a5 ("crtools: no more linked with builtin syscall")
replaced calls to sys_kcmp and sys_prctl, but did not update the checks
for ret to check for -1 and errno, so update them here.
Also make the comparisons for the return value explicit checks for a
negative value (expected -1) instead of just failing on a non-zero value
with the implicit comparison.
Add %m to report what errno was set to on failed syscalls, to make it
easier to troubleshoot a check failure.
Tested that now `criu check --ms` stopped reporting the misleading:
prctl: One needs CAP_SYS_RESOURCE capability to perform testing.
Instead, now it reports:
Error (cr-check.c:165): System call kcmp is not supported: No such process
Warn (cr-check.c:195): Skipping unssuported PR_SET_MM_MAP: Invalid argument
prctl: PR_SET_MM is not supported: Invalid argument
And those messages include the error message that explains why the
syscall failed.
Reported-by: Saied Kazemi <saied@google.com>
Fixes: 8ceab588a5 ("crtools: no more linked with builtin syscall")
Cc: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This is to deal with distros like Arch which take /usr merge to the
extreme and set their $PATH to something like /usr/local/bin:/usr/bin
(no /usr/sbin, no /{s,}bin), which breaks our rather inflexible nsroot
population logic.
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Now, we execute this test in a test mount namespace, which contains only
test mounts.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
We have two formats for devices and we had to use proper
helpers for them and compare values of a one format.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
irmap_revalidate() sets a cursor to the next element or null,
then we try to dereference cursor->next in the for statemant.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
.gitid, and some of the build directories from setup.py need to be cleaned
on 'clean'.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Remember to set tmp2 when allocating the new path so that we can free it
later. Also, don't leak tmp2 in the error case.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
It may happen that a process has completed but its files in /proc/PID/
are still open by another process (see remap_dead_pid test from zdtm
suite, for example).
If the PID number has been given to some newer thread since then, this
can be problematic. If that thread is the main thread of some process,
it seems to be handled OK on restore. However, if it is a secondary
thread, restore fails with an error like:
pie: Error (pie/restorer.c:439): Thread pid mismatch 4404/4403
This is because open_remap_dead_process() adds a helper with PID 4403 to
restore /proc/4403/* and that clashes with the thread's PID.
It seems reasonable to detect such things at the checkpoint stage and
refuse to dump, rather than to fail during restore.
v.3:
* Loop over dead_pids[] first: the array is likely to be empty.
Note that it is still needed to iterate over the threads explicitly
because pstree contains no items for the threads at that point.
v.2:
* Check for conflicts after all tasks have been dumped. One cannot rely
on any particular order of tasks being dumped.
Signed-off-by: Evgenii Shatokhin <eshatokhin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
When we bind-mount something into a shared mount,
a new mount will be shared too.
By default /tmp is a shared mount, so when we get a "clean mount",
it will be always shared. On restore we don't need this side effect,
so let's do bind-mount in a private mount.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v2: add a comment before calling BUG_ON(mi->master_id)
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
When a mount is propagated, the result mount is always shared.
If we want to get a private mount, we need to convert it.
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Currently we kdev and odev together and try to compare them without
converting to the one type.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
CRIU processes save *.gcda and *.gcno files near source files,
so when we restore tests into another mount namespace,
we need to have access to sources from this namespace.
Cc: Sergey Bronnikov <sergeyb@openvz.org>
Reported-by: Sergey Bronnikov <sergeyb@openvz.org>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
By default it generates archive name same
as a tag name, but Pavel requested to match
old scheme and strip off "v" prefix.
Reported-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v2: print test name + flavor info for each test too.
v3: pass dry_run via CR_CT_TEST_INFO
Output looks like this now:
=== Run 1/242 ----------------
Skipping zdtm/transition/thread-bomb (manual run only)
Skipping zdtm/transition/file_aio (manual run only)
======================= Run zdtm/transition/maps007 in h =======================
====================== Run zdtm/transition/maps007 in ns =======================
====================== Run zdtm/transition/maps007 in uns ======================
=== Run 4/242 ----------------
Skipping zdtm/transition/epoll (manual run only)
==================== Run zdtm/transition/pipe_shared00 in h ====================
=================== Run zdtm/transition/pipe_shared00 in ns ====================
=================== Run zdtm/transition/pipe_shared00 in uns ===================
=== Run 6/242 ----------------
======================== Run zdtm/transition/fork in h =========================
======================== Run zdtm/transition/fork in ns ========================
======================= Run zdtm/transition/fork in uns ========================
=== Run 7/242 ----------------
Skipping zdtm/transition/ptrace (manual run only)
Skipping zdtm/transition/socket_loop00 (manual run only)
======================== Run zdtm/transition/ipc in ns =========================
=== Run 10/242 ----------------
Skipping zdtm/transition/netlink00 (manual run only)
===================== Run zdtm/transition/socket-tcp6 in h =====================
=== Run 12/242 ----------------
...
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
For the caller there should be only one pidfile -- the one
that should be fired with TERM signal on stop. All the other
stuff is test's internal business.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>