2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00
Commit Graph

11124 Commits

Author SHA1 Message Date
Cyrill Gorcunov
3e45e04050 util: Add fopen_fmt helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 02:24:27 +04:00
Cyrill Gorcunov
7cf9246a8d restorer: Write failing tid
In error logging sake.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 02:10:39 +04:00
Cyrill Gorcunov
70938a3d61 restore: Make sure setting last-pid successed
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 02:10:29 +04:00
Cyrill Gorcunov
5c7fae1449 show: Fix useless sigaction mask dereference which lead to sigsev
struct sa_entry was converted to native format so
no need for dereference here.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-20 19:52:19 +04:00
Cyrill Gorcunov
8e5dc8a198 crtools: Allow to not specify a pid if to show a file contents
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-20 19:47:06 +04:00
Cyrill Gorcunov
344ccb365c crtools: Make sure pid is specified in command line
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-20 19:26:37 +04:00
Cyrill Gorcunov
7b1ea1470f Drop kernel/ directory
The kernel patches are carried in a separate
repo anyway, so a second place for patches
might be confusing.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-20 16:56:04 +04:00
Cyrill Gorcunov
681ef94fc0 ptrace: Drop unneeded #includes
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 23:25:08 +04:00
Cyrill Gorcunov
350225a2ae log: Drop unneeded #includes
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 23:22:31 +04:00
Cyrill Gorcunov
62e9851a84 cr-show: Drop unneeded #includes
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 23:20:51 +04:00
Cyrill Gorcunov
ff954f655f dump: Drop unneeded #includes
This as well forces to move ptrace
definitions into ptrace.h, otherwise
freshly fetched kernel headers become
conflict with existing ptrace constants.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 23:18:17 +04:00
Cyrill Gorcunov
6e6a820bcf crtools: Drop unneeded headers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 22:29:30 +04:00
Cyrill Gorcunov
92efe1921a types: Drop user_regs_struct_t for x86-32
We don't support x86-32 yet so no need to
carry this declaration, it's only confusing.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 22:20:42 +04:00
Cyrill Gorcunov
2e3c4e3692 Move everything related to ptrace into ptrace.[ch]
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 21:57:59 +04:00
Cyrill Gorcunov
83fd63d3fe Add missing extern to function prototypes
Regardless that we link all things in one executable
better declare them so from the very beggining.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 21:46:03 +04:00
Cyrill Gorcunov
32ac78a499 util: Drop ptrace seize helpers declaration from the header
Already defined in seize.h

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 21:19:28 +04:00
Cyrill Gorcunov
8a90464cc9 Drop some duplicated #include
And rearrange the rest.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 21:05:37 +04:00
Cyrill Gorcunov
d6eab944e3 Move logging functions to log.c
Instead of keeping all unrelated to
C/R procedure helpers in util.c move
logging related helpers to log.c.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 18:52:50 +04:00
Cyrill Gorcunov
3023837da9 crtools: Return negative number on error
In a sake of consistency.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 18:23:14 +04:00
Cyrill Gorcunov
dc883fe49f util: Drop unused inline_memcpy
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 16:13:04 +04:00
Cyrill Gorcunov
08faefd6bb crtools: Use safe strncpy in get_image_path
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:37:05 +04:00
Cyrill Gorcunov
6485fbd25f parasite: Make max size for path being PATH_MAX
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:34:37 +04:00
Cyrill Gorcunov
6adce279e8 make: Force rebuild is headers changed
Not a clean solution yet.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:33:30 +04:00
Cyrill Gorcunov
12ea815642 restore: We should check for error returned in get_image_path
This as well implies we change paths to PATH_MAX size.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:32:27 +04:00
Cyrill Gorcunov
03a5e05a65 Rename 'name' member of cr_fd_desc to 'path'
It might contain working directory path as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:31:14 +04:00
Cyrill Gorcunov
bcba2f734a crtools: Update help message
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:26:51 +04:00
Cyrill Gorcunov
f65c75c78a crtools: Move global image_dir to the top of the file
Better to have global vars gathered.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 14:58:50 +04:00
Andrey Vagin
b84babe630 get_image_path: calculate size of string correctly
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-16 16:26:48 +04:00
Andrey Vagin
4ba93d0806 pipe: initialize fields in pipe_info properly.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-16 16:26:42 +04:00
Andrey Vagin
c84d194343 zdtm: update list of passed tests (v2)
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-16 15:24:38 +04:00
Cyrill Gorcunov
739ca109c6 crtools: Fix getcwd return value test
getcwd returns NULL on error, fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-13 15:07:06 +04:00
Cyrill Gorcunov
c1350f9ab1 Make error codes returned being a negative value
We have a mess in our return codes:
some functions return negative values,
while others -- positive.

Sanitize the return codes and make error
condition to return negative values.

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-13 15:03:33 +04:00
Cyrill Gorcunov
093e4f35c3 kernel: Update kernel patches
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-13 12:39:15 +04:00
Cyrill Gorcunov
950e788b1c Dump: Add missing ending new lines to pr_perror
pr_perror is not the same as perror and requires
new line at then end.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-10 12:49:55 +04:00
Andrey Vagin
57e8e3e8b2 restore: A child should not return to parent code.
Otherwise it may begin to restore a parent objects...

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 20:37:41 +04:00
Andrey Vagin
85b991c251 pipe: Don't redefine the variable ret
For this reason a function may return success in case of error.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 20:37:32 +04:00
Andrey Vagin
92a694cf14 pipe: re-execute splice if not all data have been transferred.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 20:37:11 +04:00
Andrey Vagin
dd444aac9b pipe: avoid intersection of pipe descriptors.
1. pipe() returns two descriptors with numbers (r: x, w: y).
We may want to restore it as (r: y, w: x).
2. Close a extra end, before try to restore a target end.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 20:36:51 +04:00
Cyrill Gorcunov
6840bcc4d4 restore: Move struct pipe_list_entry at top of file
Stage structures in one place.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 15:39:08 +04:00
Cyrill Gorcunov
bf9a873866 restore: Drop bogus comment
Even u64 address might consume not greater
than 20 bytes of string so 128 is enough and
safe here.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 15:14:16 +04:00
Andrey Vagin
335639dc7c crtools: kill all dumped processes by default
If a process continue to run, it may change a state of filesystem.

@gorcunov:
 - Drop -k option, it's not needed anymore.
 - Allow -c option (continue execution of a
   process after being dumped) in dumping procedure.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 12:37:08 +04:00
Cyrill Gorcunov
6701296f5a dump: Be ready for absence of output from /proc/pid/children
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 11:45:55 +04:00
Andrey Vagin
afe52e4254 zdtm: add script to execute test cases
If you execute this script without arguments, it will execute
all test cases, which should pass.

Or the first argument may be a path to the test case.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 11:38:38 +04:00
Cyrill Gorcunov
870803fb5f image: Shrink signal entry structure
Since we use pure syscalls there is no
need to keep intermediate layer for signals.

Moreover mask entry moved at the end of the structure
so we will easily expand it if it'll be ever needed.

Note it breaks backward compatibility with older image
but since it's development stage it should be safe.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
2011-12-08 19:36:26 +04:00
Andrey Vagin
650318f4b2 crtools: add options to specified a log file
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-08 18:55:13 +04:00
Andrey Vagin
ecc2776fc9 pipe: fix deadlock
Probably all of you know about "lock inversion". There was a similar
problem on restoring pipes.

One process try to restore pipe1 and waits when another process attached
to it.  In this time another process restores pipe2 and waits too.

I know two solves.
1. Open all pipes -> attach to them -> close unnecessary ends.
This method has a problem, if only one end belongs to the process.  In
this cases another end occupies a descriptor, which may be needed to
another pipe.

2. Restore pipes in the same order. This patch does that.
A sorted list of pipe entries are constructed.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-08 17:17:04 +04:00
Andrey Vagin
c53972cdc0 pipe: change calculation of pipes users
This patch removed stange logic about minusers.
Now we calculate foreign users only.

The main idea of this patch, that we bind a pipe ends to correct
descriptos immediately.

When a process X creates a pipe, we have two cases:
1. Both ends belongs to this process. It's simple, we bind both ends
   to their descriptors and we go further.
2. Only one end of a pipe belongs to this process. In this case we are
   waiting all foreign users and we go futher.
In second case we should wait, because a end which doesn't belong to
this process occupies a file descriptor, which may be used by another
pipe.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-08 17:17:00 +04:00
Andrey Vagin
4c479da259 Dump and restore current work directory (v2)
CWD is saved as file descriptor with number -1.

v2: use dump_regular_file

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-07 17:16:41 +04:00
Andrey Vagin
d261cf7958 Use absolute path for image files
Now I try to restore CWD and a relative path will be invalid.

Add new options -D to set image files directory.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-07 17:16:37 +04:00
Andrey Vagin
a5439d5fed zdtm: add new test case for "pipe inversion"
Probably all of you know about "lock inversion". We have a similar
problem on restoring pipes.

This test case creates two process and two pipes.
process 1:
	11: pipe1 (w)
	12: pipe2 (r)
process 2:
	11: pipe2 (r)
	12: pipe1 (w)

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-06 23:41:36 +04:00