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

2617 Commits

Author SHA1 Message Date
Pavel Emelyanov
3a1c7d1d76 ns: Introduce ns descriptors
These are structs that (now) tie together ns string
and the CLONE_ flag. It's nice to have one (some code
becomes simpler) and will help us with auto-namespaces
detection.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 23:24:01 +04:00
Cyrill Gorcunov
eb8f8c12cd fsnotify: fanotify -- Group objects in image
As Pavel proposed we can refine fanotify image objects
squeezing common part in separate entry. Finally the objects
are grouped as

enum mark_type {
	INODE	= 1;
	MOUNT	= 2;
}

message fanotify_inode_mark_entry {
	required uint64		i_ino		= 1;
	required fh_entry	f_handle	= 2;
}

message fanotify_mount_mark_entry {
	required uint32		mnt_id		= 1;
}

message fanotify_mark_entry {
	required uint32		id		= 1;
	required mark_type	type		= 2;

	required uint32		mflags		= 3;
	required uint32		mask		= 4;
	required uint32		ignored_mask	= 5;
	required uint32		s_dev		= 6;

	optional fanotify_inode_mark_entry ie	= 7;
	optional fanotify_mount_mark_entry me	= 8;
}

This required some tuning in fdinfo parsing and
fsnotify code itself, but result looks good to me.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 23:17:57 +04:00
Pavel Emelyanov
fd72e27d90 inventory: Show this image with standard pb showers
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 23:16:34 +04:00
Cyrill Gorcunov
5730f8173c zdtm: fanotify00 -- Use exit instead of fail until test_daemon call
As Andrew pointed the logically it's more correct to use
err() instead of fail() if test_daemon() has not been
used.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 19:07:04 +04:00
Andrey Vagin
3f3498bccd net: a file descriptor can be zero
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:53:00 +04:00
Andrey Vagin
f2a46c3d00 util: check that stdin are unused before closing
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:52:59 +04:00
Andrey Vagin
e7189054d5 restore: close_old_fds after restoring namespaces
Restore of netns uses the file descriptor on the root netns. This
descriptor is opened before forking.
We can add one more service fd, but I think this approach is better.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:52:57 +04:00
Cyrill Gorcunov
bce18732d7 zdtm: Add fanotify00 test
This one is pretty trivial and need to be extented for
more masks and flags, but fine for now.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:52 +04:00
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
05bb44960f dump: Collect mount information on dump
For fanotify dumping we need to find mount points the path
lay on, moreover we save a mount point device number in the
image, thus collect mount point information on dump stage.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:48 +04:00
Cyrill Gorcunov
ddf773585b fsnotify: Add restore for fanotify
The same way as done for inotify we walk over
all marks hooked on file entry and restore them
with sys_fanotify_mark call.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:46 +04:00
Cyrill Gorcunov
f1f0be2d20 fsnotify: fanotify -- Add collecting of fanotify objects
No real restore yet, but only collecting of file entries
and marks for simplicity.

Ideally, once everything will be ready and tested we will
unitfy generic fsnotify restore engine. But for a while
for debug reason inotify and fanotify kept separated.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:45 +04:00
Cyrill Gorcunov
eb1fc62de9 fsnotify: Rename info_head to inotify_info_head
fanotify and inotify will be gathered to separate lists.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:44 +04:00
Cyrill Gorcunov
a124f7c67d fsnotify: Rename collect_mark to collect_inotify_mark
We will need collect_fanotify_mark helper so unify naming scheme.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:43 +04:00
Cyrill Gorcunov
a5f5b17d56 fsnotify: Rename collect_one_ify to collect_one_inotify
fanotify will have collect_one_fanotify helper, so to unify
naming scheme rename this one.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:42 +04:00
Cyrill Gorcunov
874f513201 fsnotify: Rename desc_ops to inotify_desc_ops
fanotify will have own descriptor so to avoid
confusion rename it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:41 +04:00
Cyrill Gorcunov
e73f99300d fsnotify: Extend fsnotify_file_info to carry fanotify file entries
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:40 +04:00
Cyrill Gorcunov
67ccef7e1b fsnotify: Rename inotify_file_info to fsnotify_file_info
It will carry fanotify file entries as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:39 +04:00
Cyrill Gorcunov
abdadb51b3 fsnotify: Extend fsnotify_mark_info to carry fanotify marks
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:37 +04:00
Cyrill Gorcunov
6472bdf545 fsnotify: Rename inotify_wd_info structure to fsnotify_mark_info
This structure will carry mark of any type.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:36 +04:00
Cyrill Gorcunov
be534b9ecc fsnotify: Move debug printing into get_mark_path
This prints out more details on what is going on.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:35 +04:00
Cyrill Gorcunov
5425da0b61 fanotify: Introduce get_mark_path helper
We will use it for fanotify objects restore, so to
eliminate code duplication make a separate helper.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:34 +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
4629ecd391 protobuf: fsnotify -- Add fanotify entries
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:31 +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
2d4a16c6ad syscall: Add __NR_fanotify_init and __NR_fanotify_mark
Will need them to restore fanotify objects.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:27 +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
456884ea8e zdtm.sh: exit with zero in case of success
A bash script exits with code of a last command,
so zdtm.sh return 1 if TMP_TREE is not initialized.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 17:57:45 +04:00
Andrey Vagin
64706655b6 zdtm: check SO_REUSEADDR is restored
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 18:47: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
Alexander Kartashov
effe3294d9 zdtm: added target architecture checks into FPU tests
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 18:27:52 +04:00
Pavel Emelyanov
6773090014 core: introduced the macro CORE_THREAD_INFO to access the machine-specific part of CoreEntry
This is the merge and a slight rework (no TI_SP macro) of Alexander's patches
about the subj.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 17:19:06 +04:00
Andrey Vagin
8018063933 zdtm.sh: execute all zdtm test case for a defined commit
This functionality can help to test a patch set:
for i in `git rev-list HEAD~15..HEAD`; do
	./test/zdtm.sh -c $i || break;
done

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 15:52:34 +04:00
Andrey Vagin
a19cf2be41 zdtm.sh: use another directory for a temporary crtools tree
It's more convinient for a few reasons
* don't need to recompile sources for each test case
* don't change the current tree

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 15:52:18 +04:00
Andrey Vagin
07f5c3fecf zdtm: compile a test before constructing a new root
A binary is required to get shared library dependencies

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 15:52:05 +04:00
Andrey Vagin
fb14f5d118 zdtm: remove mentions of test_init
test_init was removed a long ago

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 15:52:00 +04:00
Andrey Vagin
e513535b14 zdtm.sh: fix absolute path to crtools
zdtm.sh launched by an absolute path exits with an error due to
an incorrect path to crtools

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 15:51:54 +04:00
Cyrill Gorcunov
24887c6e9c log: Add generic __print_on_level helper
It accepts va_list argument and suitable to
be wrapped with another helpers.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:26:18 +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
58f26c8fdd parasite-syscall.c: moved the function mmap_seized() to the file arch/x86/crtools.c
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:19:43 +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
58064d9b72 cr: use unsigned long type for integers representing a virtual address
This patch is intended to reduce the usage of the macro P() since
integer size mismatches sometimes may be fixed by this type generalization.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:18:59 +04:00
Alexander Kartashov
9209d9eb21 core: introduced the macro CORE_ENTRY__MARCH to represent the target architecture
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:17:04 +04:00
Alexander Kartashov
fa1590bb17 restorer: introduced the macro SIGFRAME_OFFSET
The macro is designated to tune the beginning of a sigframe on different architectures.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:15:16 +04:00
Alexander Kartashov
446f89ddc5 restorer: introduced the macro RT_SIGFRAME_UC to access the user context of a sigframe
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:15:09 +04:00
Alexander Kartashov
46dfd9a001 parasite-syscall.c: introduced the macros REG_RES and REG_IP
The macro REG_RES is to be used to access the syscall return value register
in the struct user_regs_struct_t.

The macro REG_IP is to be used to access the program counter register
in the struct user_regs_struct_t.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:14:05 +04:00
Alexander Kartashov
928f1deea3 parasite-syscall.c: introduced the macro ARCH_SI_TRAP
The macro is introduced to abstract from behavior of breakpoints:
they generate different values of the field siginfo.si_code on different architectures.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:13:33 +04:00