Commit graph

5615 commits

Author SHA1 Message Date
Pavel Emelyanov
7ca6cc1eb2 mnt: Clean roots yard from criu process
So here it is. If root task dies on restore the roots yard
dir remains unrmdired :( Since we already know its name, we
can remove one from criu. By the time we get to this place
the sub mount namespace(s) are already dead and yard dir
is empty. But umounting should be done by tasks after
successfull restore, so keep depopulation there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:57:35 +03:00
Pavel Emelyanov
3e7c92ed02 mnt: Renames around roots yard
Same thing as in previous patch -- we have too many generic
clean_ and fini_ prefixes over the code. And we need more (see
next patch), so let's specify what exactly we clean or fini.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:57:21 +03:00
Pavel Emelyanov
a180a75c7a mnt: Uninline clean_mnt_ns
Just to get rid of clean_something name. We have too
many cleaners out there already :\

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:57:06 +03:00
Pavel Emelyanov
c5c65fe17a mnt: Create roots in criu context
In case root task restore failure we'll have to remove the
roots yard dir from criu, so we have to create one by
criu to at least have the dit name.

It's OK to do it in criu, since the yards is created in
the opts.root which is the same for any mnt ns we deal
with on restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:56:51 +03:00
Pavel Emelyanov
e3f5ba3c37 ns: Prepare namespaces before tasks
There's already two things we do in criu namespaces before
forking the init task (start unsd and keep netnsfd for back
reference). Next patches will introduce the 3rd action for
mount namespaces, so have a special pre-call for all this
stuff.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:56:26 +03:00
Pavel Emelyanov
9b3189fed1 util: Add make_yard helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 11:32:18 +03:00
Pavel Emelyanov
c5054f959d mnt: Factor out external check in validate_mounts
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 11:32:10 +03:00
Pavel Emelyanov
4e0276340a mnt: Rename collect_shared and remove unused for_dump argument
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 11:32:02 +03:00
Pavel Emelyanov
3dc209e216 sk: Print socket protocol when searching
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-25 18:31:22 +03:00
Andrew Vagin
cbf2c22d37 zdtm: show errors from dump logs
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-25 18:17:31 +03:00
Andrew Vagin
1a9f0b852b net: handle old or new images where a number of sysctls is differ
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-24 13:14:32 +03:00
Cyrill Gorcunov
e8e675bdd6 seize: Add missing newline
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-24 13:11:18 +03:00
Pavel Emelyanov
addd7f686a cgroup: Print cgroup values being restored
We have many complains about errors restoring cgroup props, so
print the exact values we restore _before_ doing this, not only
after successful restore :)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-24 13:11:11 +03:00
Andrew Vagin
bb45f832bf A superblock can be remounted only from the root userns.
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-23 18:02:33 +03:00
Andrew Vagin
7ae72c651f lib: don't use uninitialized value "m"
*** CID 150397:  Memory - illegal accesses  (UNINIT)
/lib/criu.c: 696 in criu_local_add_irmap_path()
690
691             return 0;
692
693     err:
694             if (my_path)
695                     free(my_path);
>>> >>>     CID 150397:  Memory - illegal accesses  (UNINIT)
>>> >>>     Using uninitialized value "m".
696             if (m)
697                     free(m);
698
699             return -ENOMEM;
700     }
701

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-23 15:40:22 +03:00
Andrew Vagin
aab2d1e8fa zdtm: check read-only tempfs mount
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-23 15:34:39 +03:00
Andrew Vagin
84cc1e12ac mount: don't merge mnt and sb flags if only one contains MS_RDONLY
Reported-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Tested-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-23 15:34:38 +03:00
Pavel Emelyanov
9353051ba7 ns: Check ns type with type field
Actually make use of the ns->type field and remove all getpid()'s
and other strange/inconsistent checks.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:15:28 +03:00
Pavel Emelyanov
22b7256612 ns: Introduce ns type
We (may) have 3 types of namespace objects in criu -- criu's one,
root task's one and others. All of them sometimes make sense and
we differentiate them in a weird way -- by checking the ns->pid
field against getpid() or by comparing with root_item's.

The proposal is to mark ns_id objects explicitly with type field.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:14:07 +03:00
Pavel Emelyanov
1c34b284f3 mnt: Move read_mntns_img into populate routine
We don't need the read tree earlier.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:13:48 +03:00
Pavel Emelyanov
2847089378 mnt: Reshuffle MntEntries reading code
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:13:25 +03:00
Pavel Emelyanov
c1a25fc1bd mnt: Add mi->root resolving helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:13:21 +03:00
Pavel Emelyanov
259374f6b1 mnt: Add mi->mountpoint resolving helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:13:09 +03:00
Pavel Emelyanov
d7696a42b3 files: Enlighten the rollback link-remap routine
When we don't do unlink no need to lookup for ns root-fd

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:12:41 +03:00
Tycho Andersen
85ebf0a83b usernsd: also pass pid of process that made the req
We'll use this in the next patch to correctly write sysctls.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:01:01 +03:00
Tycho Andersen
72ff44d0dc usernsd: move MAX_MSG_SIZE to namespaces.h
We'll use this size in the next patch to avoid having to do some dynamic
allocation.

v2: call it MAX_UNSFD_MSG_SIZE instead
v3: fix all uses of MAX_MSG_SIZE :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:57:40 +03:00
Andrew Vagin
459fb8b7da zdtm: don't run file_locks* tests simultaneously
/proc/locks can contains the same locks twice, if someone
releases a lock when we are reading this file.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:56:38 +03:00
Andrey Vagin
0ee52669ac zdtm: check read-only bind mounts
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:55:40 +03:00
Andrey Vagin
5cff834ae7 mount: handle old images where sb and mnt options were not separated (v3)
Currently we have only one common flag. It is MS_READONLY and it's
interpreted as a super block flag to not change old behaviour.

v2: add a comment
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:55:36 +03:00
Andrey Vagin
1174a2ad0f mount: handle mnt_flags and sb_flags separatly (v4)
They both can container the MS_READONLY flag. And in one case it will be
read-only bind-mount and in another case it will be read-only
super-block.

v2: set mnt and sb for one call of mount() when it's posiable
v3: return a comment which was deleted by mistake
v4: Fix the sentense about restoring mnt flags
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:55:17 +03:00
Andrey Vagin
b7d393ff63 proc_parse: search the uid/gid options only for sb opts
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:53:24 +03:00
Pavel Emelyanov
e9bb16265b img: Add text for known flags
Currently there are open flags on reg-files and vma
flags and prot.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:52:14 +03:00
Pavel Emelyanov
32d61ed6d4 crit: Add ability to en-/de-code flags as text
Some flags have known text description, e.g. flags on a file
or flags on vma. Add ability to show these flags in decoded
form (and encode them back into binary).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:52:04 +03:00
Pavel Emelyanov
d2b914dc11 core: Mark clear_tid_address as (criu).hex
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:51:46 +03:00
Pavel Emelyanov
d2f8f481c7 crit: Introduce 'info' action
This should print some information about image file itself, e.g.
statistical information. Right now print magic and the number of
object written in the file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:51:39 +03:00
Marcos Lilljedahl
e3f900f954 Remove multiple command validation as cpuinfo requires it
"criu cpuinfo [dump | check]" can't be used through the command line as this validation kicks in.
Other commands will fail due to required arguments so I believe it's not necessary anymore.

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:50:05 +03:00
Tycho Andersen
4f2e4ab3be irmap: add --irmap-scan-path option
This option allows users to specify their own irmap paths to scan in the event
that they don't have a path in one of the hard coded hints.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:46:12 +03:00
Andrey Vagin
d3be641acd cgroups: get controllers from /proc/self/cgroups (v2)
Some controllers can be disabled in kernel options. In this case they
are shown in /proc/cgroups, but they could not be mounted.

All enabled controllers can be collected from /proc/self/cgroup.

https://github.com/xemul/criu/issues/28

v2: ',' is used to separate controllers

Cc: Tycho Andersen <tycho.andersen@canonical.com>
Reported-by: Ross Boucher <boucher@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-16 15:46:10 +03:00
Cyrill Gorcunov
5db3f4c337 mount: Add LOG_PREFIX
It's very convenient to grep the log for mount related operations only.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-16 15:41:20 +03:00
Cyrill Gorcunov
6632b2a4fc criu: Require @fd argument for "swrk" mode
Otherwise we hit nil dereference.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-16 15:40:31 +03:00
Cyrill Gorcunov
fe946bf4eb crtools: Fix potential nil dereference
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-16 15:40:12 +03:00
Andrew Vagin
355ae31fa3 page-xfer: wait when a connection will be closed from a client side
In this case a time wait bucket will be created on a client side,
where a port is allocated dinamically.

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-16 15:39:27 +03:00
Andrey Vagin
fa66faec4d zdtm/different_creds: return smth from main()
Reported-by: Mr. Travis
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-10 15:05:58 +03:00
Laurent Dufour
f9d1bb507e test/ppc64: introduce VSX registers test
This test, specific to the ppc64 architecture, is checking that the content
of the VSX registers is correctly checkpointed and restored.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-10 14:10:29 +03:00
Laurent Dufour
196727d7f9 test: remove powerpc architecture fix
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-10 14:10:28 +03:00
Laurent Dufour
7b5c88f35f zdtm: fpu, mmx and sse tests are x86 specific.
The following tests are failing when run on ppc64 and are designed for
x86 architecture.

Moving them to the x86's test list.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-10 14:10:27 +03:00
Laurent Dufour
09023677c0 ppc64: Fix checkpoint --leave-running
The commit ba74350954 which introduces support for Altivec and VSX
support was breaking the checkpoint --leave-running.

The root cause is that the address of the Altivec and VSX registers in the
signal frame should be computed for the stack in the context of the
checkpointed process.

This patch fixes this issue through the sigreturn_prep_fpu_frame which is
designed to update the signal frame based on the remote address.

Fixes: ba74350954 ("ppc64: Add Altivec and VSX support")
Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Tested-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-10 14:09:14 +03:00
Andrew Vagin
a99d47e032 zdtm: use pthread_create to create a thread
If you call clone directly you are responsible for setting up the TLS area yourself.

$ abrt-cli ls  | grep different_creds | wc -l
39
$ gdb -c /var/spool/abrt/ccpp-2015-07-24-10\:21\:14-8014/coredump  different_creds
 Core was generated by `./different_creds --pidfile=different_creds.pid --outfile=different_creds.out'.
 Program terminated with signal SIGILL, Illegal instruction.
 #0  0x00007f86e2d8c7d9 in _dl_x86_64_restore_sse () from /lib64/ld-linux-x86-64.so.2
 Missing separate debuginfos, use: dnf debuginfo-install glibc-2.21-7.fc22.x86_64 libattr-2.4.47-9.fc22.x86_64 libcap-2.24-7.fc22.x86_64
 (gdb) bt
 #0  0x00007f86e2d8c7d9 in _dl_x86_64_restore_sse () from /lib64/ld-linux-x86-64.so.2
 #1  0x00007f86e2d84add in _dl_fixup () from /lib64/ld-linux-x86-64.so.2
 #2  0x00007f86e2d8bbc0 in _dl_runtime_resolve () from /lib64/ld-linux-x86-64.so.2
 #3  0x0000000000402da3 in sys_futex (val3=0, uaddr2=0x0, timeout=0x0, val=0, op=0, uaddr=0x6063f0 <sig_received>) at lock.h:29
 #4  futex_wait_while (f=0x6063f0 <sig_received>, v=0) at lock.h:121
 #5  test_waitsig () at test.c:367
 #6  0x0000000000401c4b in main (argc=<optimized out>, argv=0x7ffce16432f8) at different_creds.c:82

Reported-by: Mr Jenkins
Cc: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-10 14:08:11 +03:00
Laurent Dufour
46f9285e81 ppc64/vdso: fixing debug trace
There was a \n missing.

CC: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-10 14:07:24 +03:00
Laurent Dufour
7f01d691c7 vdso: Rework vdso processing files
There were multiple copy of the same code spread over the different
architectures handling the vDSO.

This patch is merging the duplicated code in arch/*/vdso-pie.c and
arch/*/include/asm/vdso.h in the common files and let only the architecture
specific part in the arch/*/* files.

The file are now organized this way:

include/asm-generic/vdso.h
	contains basic definition which could be overwritten by
	architectures.

arch/*/include/asm/vdso.h
	contains per architecture definitions.
	It may includes include/asm-generic/vdso.h

pie/util-vdso.c
include/util-vdso.h
	These files contains code and definitions common to both criu and
	the parasite code.
	The file include/util-vdso.h includes arch/*/include/asm/vdso.h.

pie/parsite-vdso.c
include/parasite-vdso.h
	contains code and definition specific to the parasite code handling
	the vDSO.
	The file include/parasite-vdso.h includes include/util-vdso.h.

arch/*/vdso-pie.c
	contains the architecture specific code installing the vDSO
	trampoline.

vdso.c
include/vdso.h
	contains code and definition specific to the criu code handling the
	vDSO.
	The file include/vdso.h includes include/util-vdso.h.

CC: Christopher Covington <cov@codeaurora.org>
CC: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-10 14:07:22 +03:00