v2: handle errors from setXids and securebits manipulations
handle errors of restoring creds after finishing CR_STATE_RESTORE_CREDS,
because a sigchild handler is already restored in this moment.
Only the current process is killed in a error case.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
"crtools check" crashes on ubuntu 12.10
(00.011275) Error (proc_parse.c:1049): No records of type 6 found in fdinfo file
(00.011281) Error (proc_parse.c:1052): parse_fdinfo: error parsing [flags: 02 ] for 6 : Operation not permitted
*** glibc detected *** /home/vvs/devel/criu/crtools/crtools: double free or corruption (top): 0x000000000068a5a0 **
Signed-off-by: Vasily Averin <vvs@parallels.com>
diff-double-fclose-in-parse_fdinfo
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
1 The comment before MAKEFLAGS assignment (see commit 25e8cb5) talks
about -r (and possibly -R) flags and has nothing to do with
--no-print-directory. Let's remove the last option to not confuse
a reader.
2 The --no-print-directory flag to build and build-crtools shorthands
is redundant, because scripts/Makefile.build has it already. Remove.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We don't use TAGS, AWK or ECHO anywhere in the code (at least according
to git grep). Let's remove this.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This reverts part of commit a519e0c which broke the man page build:
[kir@kirpad Documentation]$ make
" GEN " crtools.1
/bin/sh: GEN : command not found
make: *** [crtools.1] Error 127
So let's reintroduce Q and E in a separate Makefile.inc as it was
before.
Cc: Stanislav Kinsbursky <skinsbursky@openvz.org>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Update to patch "check: Introduce --ms option" (commit: 379abca968850d0fb66f42115178b040b3a1f5bb)
I find this error in my box:
cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -iquote ../../lib/arch/x86/include -I../../lib session03.c ../../lib/libzdtmtst.a -o session03
session03.c:112:7: error: variably modified ‘stack’ at file scope
The reason is :
"#define CLONE_STACK_SIZE PAGE_SIZE" is conflict with "#define PAGE_SIZE (sysconf(_SC_PAGESIZE))" defined in <sys/user.h>.
I think CLONE_STACK_SIZE should be seted 4096 as session02.c.
If this patch is appropriate, please let me know.
Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
According to the commit message in the kernel git, a new trap flag
JOBCTL_TRAP_INTERRUPT is added, which is set on PTRACE_INTERRUPT and
cleared when any trap happens.
Currently we have a race window beetwen PTRACE_CONT and
PTRACE_INTERRUPT. If a process stops before PTRACE_INTERRUPT,
the flag JOBCTL_TRAP_INTERRUPT will be set once again.
https://bugzilla.openvz.org/show_bug.cgi?id=2569
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This reverts commit 396a08eb95133ab61eedce6cc3cd960d27f7efeb.
As Andrew requested he needs the symbols to be generated for
all possible sources in the crtools code.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
For security reason processes can be resumed only when all
credentials are restored. Otherwise someone can attach to a
process, which are not restored credentials yet and execute
some code.
https://bugzilla.openvz.org/show_bug.cgi?id=2561
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Just add new protocol command and call local_xfer->write_hole on
server side. Also tune the mem-snap test to test memory xfer via
page server.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
CID 996195 (#1 of 1): Resource leak (RESOURCE_LEAK)
10. leaked_handle: Handle variable ask going out of scope leaks the handle.
CID 996196 (#3 of 3): Resource leak (RESOURCE_LEAK)
10. leaked_handle: Handle variable sk going out of scope leaks the handle.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Update to commit 78b8abe9a53884686d4f70d1376f85108cbfc857
I find a compile err:
kerndat.c: In function 'kerndat_get_dirty_track':
kerndat.c:78:6: error: ignoring return value of 'read', declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors
make[2]: *** [kerndat.o] Error 1
make[1]: *** [built-in.o] Error 2
make[1]: Leaving directory `/home/clb/crtools'
make: *** [all] Error 2
Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Page server cannot provide one big pipe with pages. Thus,
before this patch, it wrote pages into image in small pieces.
Now the page-xfer API accepts pagemaps and pages separately,
so we can just use thie API.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Split it into two parts -- writing pagemap and writing
pages. This is required for page-server part, sinc it
cannot provide one big pipe with all the pages at once.
Thus it needs to feed pages in portions.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Two args (optional) -- number of snaps (3 defail) and pause
between them (4 defail).
Uses memory toucher from zdtm/.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
One of such things we use right now is the device for anon shmem
mappings backing. In the furure this can be extended to check for
various kernel features.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This is less useful than fixing typos in output messages, but anyway.
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
On error paths we don't explicitly close procfile.
CID 996191 (#5 of 6): Resource leak (RESOURCE_LEAK)
22. leaked_storage: Variable "f" going out of scope leaks the storage it points to.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Don't call close() with degative fd. For consistency
simply use close_safe here. All fds touched are initialized
either to valid fd or to value < 0 which pretty good handled
by close_safe helper.
CID 996212 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
10. negative_returns: "fd" is passed to a parameter that cannot be negative.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Don't pass negative descriptor to install_service_fd
CID 996213 (#1 of 1): Improper use of negative value (NEGATIVE_RETURNS)
7. negative_returns: "new_logfd" is passed to a parameter that cannot be negative.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This guy touches a random page once per second and backs-up
what was touched. At the end it checks whether everything is
OK. It can be used to test how snapshots work -- take several
snapshots with several seconds pauses in betweem and restore
form the last.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This one is a little bit more tricky that dump. On restore we
should open the chain of pagemap-s (by "parent" links). Then for
every pagemap with in_parent set we should go to parent and ask
for the page. Parent, in turn, should properly determine where
the respective page is in his pagemap and position the page.img's
position respectively.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It's quite simple -- get parent's pagemap before dumping memory,
then collect _full_ pagemap of task putting holes into page-pipe
when the page is (soft-dirty-clear && in-parent-map). At the end
reset task's soft-dirty bits.
This requires kernel support from
http://comments.gmane.org/gmane.linux.kernel.mm/98283
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
1. Directory with images may have a "parent" symlink pointing to the
place where the previous snapshot is
2. Each pagemap will have "in_parent" bit, which means, that the
pages for this pagemap entry are not in the respective page.img
but in parent
3. New --leave-running option to use with --snapshot not to kill
tasks after snapshot
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>