To make compiler happy with -Wstrict-prototypes option.
No func change.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The structure will become private to compel, so only
keep one as an opaque pointer for parasite API.s
In particular, use item.pid instead of ctl.pid.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
When constructing sigframe for parasite, we my use ctl's blkset,
not the CoreEntry's one. This simplifies further patching.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
I discovered that the scripts/ suffix is added to __nmk_dir despite
the fact it already contains it, ending in obviously wrong filenames
like scripts/nmk/scripts/scripts/msg.mk. As those files are non-existent,
make tried to recreate every .mk file, spawninga child to execute 'true'
command, like this (part of "make -dr" output):
> Considering target file '../scripts/nmk/scripts/scripts/include.mk'.
> File '../scripts/nmk/scripts/scripts/include.mk' does not exist.
> Finished prerequisites of target file
> '../scripts/nmk/scripts/scripts/include.mk'.
> Must remake target '../scripts/nmk/scripts/scripts/include.mk'.
> Putting child 0x564ec1768740 (../scripts/nmk/scripts/scripts/include.mk)
> PID 21633 on the chain.
> Live child 0x564ec1768740 (../scripts/nmk/scripts/scripts/include.mk)
> PID 21633
> Reaping winning child 0x564ec1768740 PID 21633
> Removing child 0x564ec1768740 PID 21633 from chain.
The fix was to remove the extra scripts/, but once I did it, I found
out problem #2: these targets, being defined in contents that is often
included in the beginning of Makefiles, hijacks the default make
target (the first one in the Makefile), breaking the usual and
expected make behavior, and forcing to use .DEFAULT_GOAL.
Finally, I don't know why these targets are there, i.e. what purpose
do they serve. Maybe it was done to exclude any implicit rules to
re-make those files, but there are no such rules as far as I can see.
So, in order to address problem #2, I have removed these targets.
I don't see any harm in doing that; let me know if it breaks anything.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
1. As __nmk_dir already ends with a slash, there's no need
for an extra one.
2. No need to include macro.mk into criu/Makefile -- nothing it defines
is used from there.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Convert stat()'s st_dev to kdev bacause mount infos need it.
Like in fetch_rt_stat() function.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Anon shmem changes tracking has known bugs.
So don't use it by default. Enable it only when
CRIU_TRACK_SHMEM env variable is defined.
Now we can run transition/shmem test in CI because it works:
python test/zdtm.py run -t zdtm/transition/shmem --pre 3
Cc: Andrei Vagin <avagin@virtuozzo.com>
Cc: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
We only really need this call to find where we can dive
into the victim to make a single (!) syscall. So no need
in such a complication, just have get_exec_start() call
that finds such vaddr.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
This makes the API cleaner -- now we tell to parasite_dump_pages_seized
only two things -- whether it's pre-dump or not and, if not, whether this
is lazy dump.
And make it do all the other decisions himself.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
This adds a way to re-enable justification and hyphenation for
the man page (which in enabled by default in troff but then
Docbook explicitly disables it). The man page looks better this way.
The reason why hyphenation for man pages is disabled by Docbook is
"The problem is that groff is not particularly smart about how it
does hyphenation; it can end up hyphenating a lot of things that you
don't want hyphenated".
The reason why justification for man pages is disabled by Docbook is
"justified text looks good only when it is also hyphenated.
Without hyphenation, excessive amounts of space often end up
getting between words, in order to "pad" lines out to align
on the right margin".
I carefully checked the resuling man page using both terminal output
on 80 columns and the PS/PDF generated. In both cases hyphenation
looks normal, i.e. I don't see any unwanted cases of extra hyphenation.
Same for justification.
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This is an attempt to cleanup the man page. I am very sorry this comes
in this one big patch. Here are the changes:
1. Use *BOLD* for literals, 'ITALIC' for arguments (variable
substituions)
2. Do not use <> for arguments, as they are already marked so (italic)
3. Remove details about "criu exec" and remote syscalls execution;
add note that it's obsoleted by Compel.
4. Some descriptions are shrunk, some made longer, many are rephrased.
5. Formatting: use second-level lists (*value*:::) where appropriate
(mostly instead of bulleted lists of values).
6. Properly show comma-separated lists of arguments (with second pair
of [] and ...
7. Proper use of terms 'option' and 'argument' (*--option* 'argument').
8. Other fixes to formatting and English (such as missing a/the articles).
...
98. Change author to be "the CRIU team".
99. Update copyright years, copyright holder is Parallels Holdings.
[v2: rebase]
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
I was not able to find a way to make a target in sub-makefile
(such as "cd Documentation && make pdf") without this hack.
If there's a better way, please let me know
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Threads must share fs struct. Without this path each thread has it's own fs
struct.
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
After this the mount.c is no longer the fattest .c in the tree:
- before
3947 criu/mount.c
3179 criu/cr-restore.c
2622 criu/proc_parse.c
2095 criu/tty.c
- after
3179 criu/cr-restore.c
3170 criu/mount.c
2623 criu/proc_parse.c
2095 criu/tty.c
One "not move" thing is -- since fstype array is static to the
filesystems.c and mount.c needs to access fstype[1] for auto
mounts, the fstype_auto() call is added.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
When m and pa are mounted in the same directory, rpath is initialized
to empty string (rpath[0] points to '\0'). In this case snprintf() at
the bottom of function makes path have '/' at the end.
In further, function validate_shared(), which uses the result, calls
find_shared_peer() and fails to find a peer.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
To mimic the environment that systemd is in when it causes the problem, we
preserve a prefix cgroup path across checkpoint and restore which the tasks
live below, and then we open a fd to this path. Without
--cgroup-root /prefix on dump, this test fails:
(00.030429) 32: Error (criu/files-reg.c:1487): File home/ubuntu/criu/test/zdtm/static/cgroup02.test/zdtmtst/prefix has bad mode 040600 (expect 040777)
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
In commit 07d259f365f2 ("cgroup: support --cgroup-root on dump too")
criu starts to understand --cgroup-root option on dump, but our
cgroup02 test in cgroup02.desc file sets these opt to /newroot
unintentionaly, as on dump we don't have /newroot dump fails:
https://ci.openvz.org/job/CRIU/job/CRIU-x86_64/branch/criu-dev/989
======================== Run zdtm/static/cgroup02 in h
=========================
Start test
Test is SUID
./cgroup02 --pidfile=cgroup02.pid --outfile=cgroup02.out
--dirname=cgroup02.test
Run criu dump
=[log]=> dump/zdtm/static/cgroup02/30/1/dump.log
------------------------ grep Error ------------------------
(00.023103) Error (criu/cgroup.c:620): cg: failed walking
/proc/self/fd/10/newroot for empty cgroups: No such file or directory
(00.023129) Error (criu/cr-dump.c:1359): Dump core (pid: 30) failed with
-1
(00.023944) Error (criu/cr-dump.c:1675): Dumping FAILED.
------------------------ ERROR OVER ------------------------
So fix this by using restore-only ropts instead of opts.
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The field fs_type field of fd_parms is already long
Additionally the glibc man page says "Using unsigned int for such variables suffices on most systems." referring the minimum width of variables holding fs_type
There are already fs_types who sets the highest bit (CIFS, BTRFS HPFS...) which interfere with the error check in dump_one_reg_file_cond (fs_type < 0) through the cast into signed int and after this into long
Fixes error while dumping programs on a btrfs partition
Signed-off-by: Markus Knetschke <markus.knetschke@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
I suspect this snuck in when I was build testing code. Anyway, it shouldn't
be here :)
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Currently we remap task_entries but it can be used from a sigchld hanler.
We need to block sigchld to remap task_entries and unlock it
when a restorer sigchld handler is set.
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
ksigfillset is the same for all architectures and
here is no reasons to duplicate the same code many times.
In addition, this patch addes ksigemptyset and ksigaddset.
They will be used in the next patch.
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
In the case where we don't rewrite anything, dirnew is never set, so we
shouldn't reset anything, because we didn't do any work.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
C standard specifies that the first enum element is 0 and the next ones
are +1 to a previous element (C90, "3.5.2.2 Enumeration
specifiers").
Therefore, there is no need to explicitly specify element values.
The explicit initializers were added in the first commit introducing
this enum (commit 46e8aee).
While at it, let's also add a comma after the last element, for any
future patch adding more elements to look better.
No functional change.
Cc: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The problem here is again caused by systemd :). Every process lives in some
child cgroup and not the root one, so we end up with a bunch of stuff like:
/init.scope
/system.slice/...
/user.slice/...
and nothing in the root cgroup. However, systemd opens
/sys/fs/cgroup/systemd, changes the perms, and keeps a fd around.
Unfortuantely, we don't track the perms on the "real root" cgroup here,
because nothing is at that level, so when we restore, our cgroup perms
changing code doesn't catch this perms change, and we get:
(00.361723) 1: Error (criu/files-reg.c:1487): File sys/fs/cgroup/systemd has bad mode 040755 (expect 040775)
To fix this, let's just support the --cgroup-root argument on dump too, and
rewrite the cgroup paths we dump accordingly.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
From 5f6b24723b Mon Sep 17 00:00:00 2001
From: "Tuan T. Pham" <tuan@vt.edu>
Date: Thu, 8 Sep 2016 03:42:12 -0400
Subject: [PATCH] Add script to install required packages to compile in Debian
In order to setup an environment to compile and to test CRIU
from source, we need to have required packages in Debian
environment.[^0] This script and its package list will help
setting it up.
contrib/debian/dev-packages.lst:
* List of required packages for Debian development environment
scripts/install-debian-pkgs.sh:
* A simple bash script instaling the required Debian packages
[0]: https://criu.org/Installation
Signed-off-by: Tuan T. Pham <tuan@vt.edu>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v2: don't try to write "" to devices.allow, just skip it since we write 'a'
to devices.deny everywhere anyway.
v3: leave cgroup prop name as "devices.list" so it is caught in the later
tests for special-ness. also, don't write the last devices entry twice.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
C standard specifies that the first enum element is 0 and the next ones
are +1 to a previous element (C90, "3.5.2.2 Enumeration specifiers").
Therefore, there is no need to explicitly specify element values.
The explicit initializers were added in commit 5676383 (scripts:
Add ACT_MAX limit and make @action_names being const) but I do not
see the need for them in there either.
No functional change.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>