2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 21:07:43 +00:00

1830 Commits

Author SHA1 Message Date
Andrey Vagin
148497e45d mount: add support of devpts
The devpts fs should be mounted and its content is restored,
when crtools restores terminals.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 19:59:14 +04:00
Andrey Vagin
04b8a62377 zdtm.sh: $pid has been renamed to $PID, but one was skipped
Reported-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 19:53:41 +04:00
Andrey Vagin
58e22f31fc mount: Add support of tmpfs (v3)
When dumping a tmpfs mount we need to take its contents with us.
So, use tar for it and put it into the image dir.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 19:51:22 +04:00
Andrey Vagin
b0d7cc9724 mount: Add suport of empty binfmt_misc (v3)
Binfmt is global fs. We could check for its inhabitants intersect on
source and destination, but for the 1st time it's enough just to check
this one being empty.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 19:47:20 +04:00
Andrey Vagin
af15b75b70 mount: Initial open/close mountpoint-s implementation
The routines are supposed to provide a DIR * for a givem mountpoint. Currently
it aborts when a mountpoint is overmounted, but this should be fixed eventually.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 19:45:18 +04:00
Pavel Emelyanov
7422176427 pscketsk: Add loss and timestamp sockoptions
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 19:23:31 +04:00
Pavel Emelyanov
d29feb9103 packetsk: Add support for auxdata, origdev and vnethdr bits
These are boolean in reality.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 18:13:02 +04:00
Pavel Emelyanov
242fd55a57 protobuf: Support showing bool datatype
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 18:12:22 +04:00
Pavel Emelyanov
3ef8d138ab packetsk: Support PACKET_RESERVE option
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 17:38:15 +04:00
Pavel Emelyanov
1259a9ad80 packetsk: Support PACKET_VERSION sockoption
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 17:34:40 +04:00
Pavel Emelyanov
216a3a6521 sk: Add level to socket option dump/restore helpers
Packet socket need SOL_PACKET one.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 17:25:11 +04:00
Andrey Vagin
6949a848d3 mount: Add abstraction layer for dumping file systems (v2)
We need to dump content of some fs like binfmt_misc, tmpfs, ... To facilitate
this the existing list of filesystems is turned into an array of structures
with dump and restore callbacks. Each FS may declare them they need.

v2: rework encode/decode_fstype not to do it twice.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 16:27:30 +04:00
Andrey Vagin
0b5425b634 mount: add support of devtmpfs
It's global, so it doesn't require any actions, they should be only mounted.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 16:27:24 +04:00
Andrey Vagin
d0fd98c9fc show: don't show RAW images in show_all
If an image isn't specified, crtool shows content of all images.
Now crtools aborts in this case due to BUG_ON(1) in show methods
for raw images. I sugget to skip such images.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 16:22:32 +04:00
Pavel Emelyanov
579a5cd211 zdtm: Test for packet sockets
Create and bind. Nothing more.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 16:18:54 +04:00
Pavel Emelyanov
fc7071d05e net: Packet sockets basic support
Support only basic packet socket functionality -- create and bind.
This should be enough to start testing dhclient inside container.
Other stuff (filter, mmaps, fanouts, etc.) will come later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 16:17:41 +04:00
Pavel Emelyanov
b91445701b img: Introduce generic routine for collecting image entries
On restore we typically read an image and put the entries into
some hash/list/whatever to work on them later. It's handy to have
a generic routine for doing so.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 13:16:46 +04:00
Kinsbursky Stanislav
00a1a4d4b7 makefile: build pie after protobuf
Now pie targets depends on protobuf targets.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Reported-by: Andrew Vagin <avagin@parallels.com>
Tested-by: Andrew Vagin <avagin@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Looks-good-to: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-08 17:06:38 +04:00
Pavel Emelyanov
c0d83d9e9f show: Add 'hinting' ability
The crtools produces not only dump in its internal format (i.e. -- pb),
but also may call other tools to create files with some state (e.g.
ip tool dumps route and ifaddr info, tmpfs will be tar-ed, iptables
utility will produce the iptables-save file, etc.).

The show functionality cannot read these images, but we can guess what
can be in the file provided by its magic.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-08 15:03:15 +04:00
Andrey Vagin
ba0d5fb226 dump: handle overmounted devices (v2)
"init" in LXC opens /dev/null and then mounts devtmpfs in /dev,
so crtools can not resolve the path to the origin /dev/null.

crtools with the option --evasive-devices will check the origin
device and a new device are the same and if it's true, crtools will
dump a new path.

v2: add a description for the option

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:33:49 +04:00
Stanislav Kinsbursky
8de0434788 restore: don't BUG_ON() if inet address image size is wrong
This aptch replaces BUG_ON's by return of error code.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:27:38 +04:00
Pavel Emelyanov
47266dd031 pb: Move pb callback types to .c file
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:25:09 +04:00
Pavel Emelyanov
657a544fb7 pb: Rewrite object showing to use pb-descs
The pb_show things are no longer macros.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:22:02 +04:00
Pavel Emelyanov
b1b0a39a58 pb: Rewrite object reading to use pb-descs
The pb_read thing is no longer a macros. This will allow to
factor out objects collecting on restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:22:00 +04:00
Pavel Emelyanov
2398c55e41 pb: Rewrite object writing to use pb-descs
The pb_write thing is no longer a macros.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:21:59 +04:00
Pavel Emelyanov
9e84bd1083 pb: Introduce pb message types and cr-descriptors
The protobuf-c generate plain routines for entries manipulations, but
we want to have some "generic" way of working with messages. Collect them
all in an array of descriptors (similar to image files descriptions) and
do full typechecking while this.

Such thing will allow to simplfy code later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:21:58 +04:00
Andrey Vagin
8bff4c7fca restore: consolidate restoring of a root task in one blob
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-06 18:37:13 +04:00
Andrey Vagin
703a322cc0 restore: mount_proc return a result instead of exit
In addition it fixes error handling.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-06 18:36:59 +04:00
Andrey Vagin
91ea3b922b namespace: return -1 if one of ns can't be initilized
[xemul: Added explicit braces into ifs]

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-06 18:36:35 +04:00
Andrey Vagin
4c88cafe43 restore: fix clean up in PIDNS
When processes are restored in PIDNS, the controll process (crtools)
don't know a real pid of processes, but it knows a pid of init.

crtools can kill init and all other processes will be killed too.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-06 18:31:39 +04:00
Andrey Vagin
a5dff04d6a socket_listen: interrupt a parent if a child exited
When a child exited, SIGCHLD is sent to parent,
if SIGCHLD has handler without SA_RESTART, the current
syscall will be interrupted.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-06 18:30:45 +04:00
Cyrill Gorcunov
c60661051d doc: Update -n option
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-06 18:30:02 +04:00
Cyrill Gorcunov
25b35f13b6 help: Add mnt and net options into the list
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-06 18:29:53 +04:00
Cyrill Gorcunov
e4d5ad236b files-reg: Drop redundant double semicolon
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-06 18:28:27 +04:00
Cyrill Gorcunov
750324af65 mount: Cleanup readlinkat calling
- Use sizeof instead of PATH_MAX constant
 - Place EOS exactly after read data end

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-06 18:28:12 +04:00
Pavel Emelyanov
f345fc8f10 parasite: Don't pull opts through the stack
Revert and tune 9eda83b7. Andrey reminded me that we have
global instance of cr_options.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 16:25:52 +04:00
Andrey Vagin
bd4e5d2f9d restore: prepare shared objects after initializing namespaces
On this stage crtools unlink old socket files, create ghost files and etc,
so we should be in a correct namespace.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 16:08:06 +04:00
Andrey Vagin
420325dca6 restore: add an option for changing a root file system (v2)
The option is -r|--pivot-root and an argument is a path to new root.
A root task will make pivot_root. LXC CT does that, so we need that
for restoring.

v2: s/pivot-root/root/

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 16:07:43 +04:00
Andrey Vagin
3cb5969b25 pstee: fix memory corrupation
The pstree_item for helpers is allocated without rst_info.
Before this patch prepare_fd_pid was executed for such items and
touched rst_info.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 15:54:54 +04:00
Pavel Emelyanov
ce25c67b90 zdtm: Wire signalfd00 in
The kernel patch is in 3.5 branch, so we can make this test
run automatically.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 12:49:51 +04:00
Pavel Emelyanov
f289ac2c1a zdtm: Signalfd testing
It's not in zdtm.sh yet, since kernel patch is not yet
committed. When kernel is updated, the zdtm.sh will be too.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 12:28:16 +04:00
Pavel Emelyanov
da2d59a2e7 signalfd: Checking code
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 12:27:45 +04:00
Pavel Emelyanov
da409cc641 signalfd: Dumping and restoring
Only the fact of the fd presence, its flags and fown and the sigmask.
The sigpending state is tightly coupled with the task's sigpending
state which is not yet supported.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 12:26:35 +04:00
Pavel Emelyanov
8097a8dc09 signalfd: Add proc fdinfo parsing facility
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 12:25:18 +04:00
Pavel Emelyanov
0401664144 signalfd: Add protobuf descriptions
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 12:24:27 +04:00
Pavel Emelyanov
92e739e9b6 mount: Reset mountinfos when mntns recreated
The list of mounts is used by inotify to restore a watch with open-by-handle. The problem
is that after the clean_mnt_ns is done the mntinfo list is no longer relevant.

Fix it by freeing the old one and initializing the new with the read-from-image stuff.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 09:54:22 +04:00
Pavel Emelyanov
d8a6ecc630 zdtm: Netns basic test
Only checks for lo, one simple ifaddr and two routes are handled. Sanity
test and nothing more.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 08:32:06 +04:00
Pavel Emelyanov
a6439860cd net: Routes dump and restore
Same here -- run ip tool and that's it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 08:31:46 +04:00
Pavel Emelyanov
fc1eb96783 netns: Ifaddrs dump and restore
Just run the ip addr save and ip addr restore respectively.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 08:26:43 +04:00
Pavel Emelyanov
0b9b1bd91a netns: Introduce a routine that runs ip tool for dump/restore
The thing is that the ip utililty is very likely to have support
for ifaddrs and routes dumping and restore (rtnl messages are
symmetrical wrt dump/restore and this can be easily dump in there).

Thus, the best we can do it just use this tool for that and carry
the "raw" images with ifaddrs and routes dump.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 08:21:19 +04:00