2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

1696 Commits

Author SHA1 Message Date
Cyrill Gorcunov
962af52932 fsnotify: Add dumping of fanotify objects
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:50 +04:00
Cyrill Gorcunov
d5927a47f1 proc-parse: Add parsing of fanotify objects
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:49 +04:00
Cyrill Gorcunov
f385d32da5 image: fanotify -- Add scaffold code for fanotify objects
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:32 +04:00
Cyrill Gorcunov
78259da381 fsnotify: Add is_fanotify_link helper
Will need it to dump fanotify objects.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:30 +04:00
Cyrill Gorcunov
f58ab92cfe mount: Add lookup_mnt_id and lookup_mnt_sdev helpers
We will need to lookup mount points by mount id
and device for fanotify restore.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:28 +04:00
Cyrill Gorcunov
b724096f0f fsnotify: Rename inotify files to fsnotify
We will be handling both inotify and fanotify
objects here thus to make less confusion rename
the files to fsnotify.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:26 +04:00
Andrey Vagin
b1abc3b21c restore: don't desable tcp repair mode twice
TCP repair mode should be disabled after unlocking connections.
Disabling of repair mode drops SO_REUSEADDR, so it should be restored.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 18:47:19 +04:00
Cyrill Gorcunov
c406ccc06f log: Make pr_err_once to use pr_err
No need for core duplication.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:26:07 +04:00
Cyrill Gorcunov
7dccef3ad4 log: Beautify log.h
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:25:59 +04:00
Alexander Kartashov
9f92cf5acd image.h: moved the macro AT_VECTOR_SIZE to the file asm/types.h
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:19:37 +04:00
Alexander Kartashov
b84059a608 multiarch: removed target architecture checks from the following files:
* include/image.h,
* include/syscall-types.h,
* include/restorer.h,
* parasite-syscall.c,
* cr-dump.c,
* cr-show.c,
* pie/parasite.c.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 13:48:07 +04:00
Andrey Vagin
979eb2a179 restore: restore pocesses which share one fdtable (v5)
Currenly crtools supports a case when a child shared a fd table
with parent.

Here is only two interesting things.
* Service descriptors should be cloned for each process
  who shared one fd table.
* One task should restore files and other tasks should sleep in this
* time.

v2: * allocate fdt_lock from shared memory
    * don't wait a child, if it doesn't share fdtable
v3: * don't move ids on the pstree image
v4: * save ids in a separate image
    * save fdinfo per id instead of pid
v5: fix alignment of service_fd_id

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-12 00:54:46 +04:00
Andrey Vagin
d50c786c7e files: dump fdinfo per files_id instead of pid
A few processes can share one fdtable.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-12 00:54:44 +04:00
Andrey Vagin
bb25ed38c8 files: close_old_fds before forking children (v2)
A few processes can share one fd table. Each process has own set of
service file descriptors and a process knows nothing about servic fds
of another processes. So if two process share one fd table,
close_old_fds will close servic descriptors of another process.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-12 00:54:42 +04:00
Andrey Vagin
3c8bd5ccd1 pstree: allocate fdt shared data
fdt shared data contains PID of process, which will restore file
descriptors and a futex for synchronization.

A process with mimimal pid restores file descriptors.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-12 00:54:41 +04:00
Andrey Vagin
20b5ed916f crtools: put kobj-ids into separate image file (v2)
It is read together with pstree items for checking what kind of
resources should be shared. Core is too big for reading it in
this place.

v2: fix check_core

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-12 00:54:39 +04:00
Andrey Vagin
4ea6214391 crtools: add ability to create and close a service fd (v3)
A service fd should be created, otherwise get_service_fd returns -1.

This patch removes this functionality from other subsystems and
allows to clone service descriptors.

v2: rename open_service_fd to install_service_fd
v3: two patches were merged for bisecting

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-12 00:54:37 +04:00
Andrey Vagin
e6106956af util: clone service descriptors, if fd tables are shared for tasks (v3)
It looks like a namespace for service descriptors.
It will be used for restoring tasks with shared fd tables.
Service descriptors should be own for each process.

v2: clone_service_fd doesn't know about sub-systems like log, proc, etc
v3: Don't try to find a free name-space.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-12 00:54:36 +04:00
Andrey Vagin
07a8647466 lock: add futex_inc_and_wake and futex_wait_while_lt (v2)
v2: fix descriptions

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-11 14:50:44 +04:00
Andrey Vagin
0fc129a121 files: pass a file descriptor on an fdinfo image instead of cr_fdset
Currently fdinfo dumps for each task, so CR_FD_FDINFO is in cr_fdset.
A few tasks can share one fd table and the set of descriptors will be
dumped once and a image name will contain files_id instead of pid.
In this case CR_FD_FDINFO will go away from cr_fdset.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-11 14:47:09 +04:00
Pavel Emelyanov
748be83181 cr: Support rlimits
Dump the with "new" prlimit syscall that works on arbitrary pid.

Restore is done in restorer _after_ mappings mixup and _before_
caps drop to make it set any max value.

The RLIM_INFINITY is handled explicitly to help future 64<->32
bits migration.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-10 20:08:38 +04:00
Pavel Emelyanov
d703f8260e fs: Support umask dump/restore
This one is bound to task's fs info (with cwd and root)
thus put it in the fs.img file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-10 12:48:31 +03:00
Pavel Emelyanov
f787f922e2 dump: Pass CoreEntry into thread-dumping routine
The number of arguments used to carry data via them is too
big already. Just fill the required core fields inside.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-09 18:32:56 +03:00
Pavel Emelyanov
e129ae26c4 dump: Pass whole struct pid into thread dumping routine
And do "get real pid, report virtual one" inside.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-09 18:27:54 +03:00
Alexander Kartashov
3481b9aa60 FPU: introduced the support for multiple FPU architectures.
* The routine sigreturn_prep_xsave_frame() is renamed to sigreturn_prep_fpu_frame().

* Moved the routines sigreturn_prep_fpu_frame(), show_rt_xsave_frame(), and
  valid_xsave_frame() to the file crtools.c.

* Introduced the structure fpu_state_t to pass the FPU state to the restorer
  in a machine-independent way.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-09 19:01:44 +04:00
Alexander Kartashov
e1e2346880 cr: Introduce stubs for tls dump/restore
Leave them empty for x86, will be used on ARM.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-09 19:01:22 +04:00
Alexander Kartashov
7b7a08dde5 auxv: save and restore AUXV's in a machine-independent way.
The size of an auxv is the machine pointer but a 64-bit integer is reserved
in a MmEntry protobuf message to store an auxv. Moreover the number of auxv's
varies from one architecture to another. So the following is proposed
to alleviate the issue.

* Introduced the type auxv_t representing a machine-pointer sized integer.

* The size of auxv array is extracted from a MmEntry message instead of using
  the value of the macro AT_VECTOR_SIZE.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-09 17:40:33 +04:00
Alexander Kartashov
c074dc5810 include/restorer.h: moved machine-dependent sigframe structs to the file arch/x86/include/asm/restorer.h.
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-09 17:34:12 +04:00
Alexander Kartashov
91504f5282 include/restorer.h: moved machine-independent sigframe structs to the file include/sigframe.h.
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-09 17:33:59 +04:00
Alexander Kartashov
f032e67ae3 parasite-syscall.c: moved the routine syscall_seized() into the file arch/x86/crtools.c.
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-09 17:26:46 +04:00
Alexander Kartashov
6f61488f21 x86: moved x86-specific files into the directory arch/x86.
* The following files goes into the directory arch/x86/include/asm unmodified:
  - include/atomic.h,
  - include/linkage.h,
  - include/memcpy_64.h,
  - include/types.h,
  - include/bitops.h,
  - pie/parasite-head-x86-64.S,
  - include/processor-flags.h,
  - include/syscall-x86-64.def.

* Changed include directives in the source files that include the headers
  listed above.

* Modified build scripts to reflect the source moves.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-09 17:02:47 +04:00
Cyrill Gorcunov
830d92b0f0 headers: Unify include guards (in comments) and a few fixes
- fix names in comments
 - add empty lines where needed
 - fix rbtree.h
 - fix syscall-types.h

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-25 22:40:24 +04:00
Cyrill Gorcunov
439637fb07 parasite-syscall: Drop redundant \Space in parasite_ctl structure
No func changes

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-25 22:39:55 +04:00
Pavel Emelyanov
b4c2160449 hdrs: Fixup reinclusion preprocessor constants
Make them look like __CR_<smth>_H__ with

sed -e '1,2s/#\(ifndef\|define\) _\?_\?\(CR_\)\?/#\1 __CR_/' -e '1,2s/_H_\?_\?.*$/_H__/'

on every header file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-24 15:36:14 +04:00
Andrey Vagin
6a25678243 restore: remove an unused field from task_restore_core_args
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-21 18:58:32 +04:00
Andrey Vagin
9cd9a93e79 restore: unify handling of thread args of leaders and other threads
Currently we have an array for thread_args, but leader's thread_args
is a part of task_args.
Here is two problems. The array has a space for leader's thread args,
but it is unused. Code which fills thread args is duplicated two
times. This patch fixed both problem. It replaces thread_args on a
pointer from task_args and deletes code, which fills leaders
thread_args.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-21 18:58:23 +04:00
Cyrill Gorcunov
9fee76bd31 restore: Reserve space in restorer for FPU frame
For code simplicity we reserve the maximum size which
might be needed to form an FPU frame (ie for both
xsave and fxsave operations).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-21 17:35:42 +04:00
Cyrill Gorcunov
10f22fe9ee restore: Change rt_sigcontext::fpstate to void *
It will be carrying xsave or fxsave frame.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-21 17:35:41 +04:00
Cyrill Gorcunov
cf2e6c54c9 cpu: Add code to fetch/test cpuinfo data
This patch add ability to test /proc/cpuinfo data
we're interested in at the moment.

The code provides the following functionality

 - cpu_init, to parse cpuinfo and check if the
   host cpu we're running on is suitable enough
   for FPU checkpoint/restore. If FPU present then
   there must be at least fxsave capability present

 - cpu_set_feature/cpu_has_feature helpers which
   provides to test certain bits and set them where
   needed (we need to set bits when parse cpuinfo)

Note, we reserve space for all cpuinfo bits known
by the kernel at moment, while use only three FPU
related bits for a while. This is done because we might
need to use or find out other features in future.

After all it's just 40 bytes of memory needed to keep
all possible bits.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-21 17:35:34 +04:00
Cyrill Gorcunov
666f4ebbe9 fpu: Add fpu.h header
We will need these structures for restore FPU
state via sigframe, as as we decode data provided
by ptrace.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-21 17:35:33 +04:00
Pavel Emelyanov
4ced9531e6 files: Open-code MAKE_GEN_ID macro into its single caller
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-18 21:29:48 +03:00
Pavel Emelyanov
1e538cf02b dump: Drop unused image file perm change before sending it to parasite
Since we send _fd_ it's pointless to call chmod on image file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-18 21:01:53 +03:00
Pavel Emelyanov
4bb4ece76e exec: Initial skeleton
Reserve the cmdline option for this and link empty file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-17 22:56:06 +03:00
Pavel Emelyanov
45fdee04fb parasite: Split infecting routine into parts
The fist part prepares ctl to controll the seized task.
The 2nd one mmaps shareb buffer for data exchange.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-17 22:53:23 +03:00
Pavel Emelyanov
3b404e3776 parasite: Introduce generic syscall-calling function
This one calls a syscon on seized task. Existing mmap/munmap
just use one.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-17 22:52:06 +03:00
Pavel Emelyanov
9428f3a9a2 dump: Make collect_mappings non static
Will be used by other code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-17 22:50:06 +03:00
Pavel Emelyanov
4199022be5 parasite: Remove typedef-ed type from parasite header
I'll include it into a place, that knows nothing about
pb types. Use generic pointer instead.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-17 22:49:30 +03:00
Pavel Emelyanov
d721e9d48c criu: Version 0.3 release
This is mostly bugfix and improvements release.
Nonetheless, some new features exists, the most interesting are:

  * proper COW mappings handling
  * full packet sockets support, thus supporting the tcpdump tool
  * the --shell-job option, which makes it possible to dump apps
    launched from one shell and restore them in another

Some features are available with the custome kernel, but the good
news is that now _all_ of the patches we need are in one of the
-next trees or in the -mm one, and thus have good chances to get
merged in 3.8 (or soon after it).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-11 21:22:55 +04:00
Pavel Emelyanov
56e1decf48 show: Factor out skipping of data dump into show_image_data
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-10 18:57:54 +03:00
Pavel Emelyanov
be79f38d6c pstree: Sanitize pstree preparation code
We have 3 calls for that, two called directly from cr-restore,
one -- from one the former. Clean this mess and write short
comments on each stage.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-10 15:50:47 +03:00