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

72 Commits

Author SHA1 Message Date
Andrey Vagin
4850fd94a8 crtools: move cr_options in a separate header
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 18:17:52 +04:00
Andrey Vagin
1300cf4915 crtools: move all stuff about fdset in a separate header
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:24:48 +04:00
Pavel Emelyanov
0327d5511b fdset: Beautify fdset opening
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-28 05:39:52 +04:00
Andrey Vagin
f995673d99 ipcns: don't use global fdset for dumping namespace
We are going to replace pid on id in names of image files. The id is
uniq for each namespace, so it's more convient, if image files are
opened per namespace.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-01 12:11:20 +04:00
Cyrill Gorcunov
a967e5345f ipc: Zeroify data tail in dump_ipc_sem_set
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-14 14:56:12 +04:00
Cyrill Gorcunov
7ecb00dfca ipc: Zeroify data tail in dump_ipc_msg_queue_messages
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-14 14:56:04 +04:00
Cyrill Gorcunov
df4e243ea0 ipc: Don't access data out of allocated slab
We should zeroify all data actually for security
reason but this aspect will be addressed in further
patches.

Meanwhile at least allocate enought space so pb_write
won't access data which is not allocated for us.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-14 14:55:57 +04:00
Pavel Emelyanov
b18fb09eb9 show: Replace one-line show_foo calls with args array
We have generic do_pb_show() call and tons of show_foo
routines, that just call one with proper args. Compact
the code by putting the args into array and calling
the do_pb_show() in one place.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-24 04:00:32 +04:00
Pavel Emelyanov
84737e2796 build: Generate most of the pb-desc automatically
These contain linkage between number, data type and routines
for pb messages we write/read to/from image files. Most of them
have simple number-type-routines mapping, so introduce a generating
script for that.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 21:47:31 +04:00
Andrey Vagin
0bca286722 ipc_ns: allocate enough memrory for the buffer
==22653== Syscall param read(buf) points to unaddressable byte(s)
==22653==    at 0x50480B0: __read_nocancel (in /usr/lib64/libpthread-2.17.so)
==22653==    by 0x40CF7C: parasite_dump_pages_seized (mem.c:244)
==22653==    by 0x41681D: cr_dump_tasks (cr-dump.c:1533)
==22653==    by 0x40448C: main (crtools.c:309)

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-21 19:06:03 +04:00
Cyrill Gorcunov
30936058a0 ns: Extend ns_desc to carry the length of the ns name
This will be needed for fast parsing of procfs ns references.

[ xemul: Add user_ns_desc here ]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-18 03:36:56 +04:00
Pavel Emelyanov
4c3fe87258 ipcs: Fix mqueue sysctls directory name
Stupid misprint :(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-17 18:45:29 +04:00
Pavel Emelyanov
21c1e71b19 ipc: The mqueue syscls can be missing from kernel
All this sits under config option, so we shouldn't try
to read/write them in this case. What to do if they are
in different on/off state on src/dst kernels is an open
question :\

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-17 17:40:06 +04:00
Pavel Emelyanov
add21b75c9 show: Remove options args from ->show callback
This thing is global, we can address one explicitly.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-08 00:23:42 +04:00
Pavel Emelyanov
cd537beda5 show: Get rid of flags argument from payload handler
We can "guess" one w/o addirional (obfuscating) argument to
the pb showing engine.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-08 00:00:24 +04:00
Pavel Emelyanov
5cae819d8c img: Get rid of open_image_ro helper
O_RSTR flag should be used instead for regular open_image

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-09 19:22:21 +04:00
Andrey Vagin
e08562c277 ipc_ns: free allocated objects at the end
ipc_ns.c:464:3: warning: Memory is never released; potential leak of
memory pointed to by 'values'
                return;
                ^
1 warning generated.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 14:00:28 +04:00
Kinsbursky Stanislav
e0e258c344 ipc: restore IPC objects credentials
This part was lost after update to "sysctl" interface for IPC object ID
specifying (previous, currently obsolete, interface was able to pass proper
credentials with KEY change) .

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-17 16:00:48 +04:00
Kinsbursky Stanislav
dae5f928f7 ipc: do some renaming to make the code looks more pleasant
Signed-off: Stanislav Kinsbursky <skinsbursky@openvz.org>

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-17 16:00:47 +04:00
Alexander Kartashov
3c16edc0bd cr: generalized format strings
This patch replaces the format specifier %ld with PRIx64
in the following places:

* the format string argument of the functions scanf() and printf(),
* in the macros GEN_SYSCTL_*_FUNC.

We need explicit specification of the integer size there.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-16 19:20:08 +04:00
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
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
Stanislav Kinsbursky
c33a62dfcc ipc: fix silly misprint in IPC shm show handler
IPC shared memory data is aligned by 32 bits.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-10 17:19:34 +04:00
Stanislav Kinsbursky
cbcd5f6b02 ipc: update to use sysctl
Old interface with modified IPC syscalls is deprecated is replaced sy sysctls.
This patch updates CRIU to use new interface.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-30 17:47:15 +04:00
Huang Qiang
6d97c09772 ipc_ns: close file immediately when we don't need it
According to Andrew's advice, change the close file logic a bit, to
make the code seems more readable.

Signed-off-by: Huang Qiang <h.huangqiang@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-26 00:08:47 +04:00
Huang Qiang
223dce83c2 fix many unclosed file opened by open_image_ro
Many image files opened by open_image_ro weren't closed before return, fix
them all in this patch.

Signed-off-by: Huang Qiang <h.huangqiang@huawei.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 16:51:50 +04:00
Pavel Emelyanov
850d74c4c5 ipc: Fix uninitialized ptr xfree-ing
CC       ipc_ns.o
  ipc_ns.c: In function ‘dump_ipc_msg’:
  ipc_ns.c:240:2: error: ‘message’ may be used uninitialized in this function [-Werror=uninitialized]
  ipc_ns.c:192:17: note: ‘message’ was declared here
  cc1: all warnings being treated as errors

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-19 20:32:30 +04:00
Stanislav Kinsbursky
e929b43742 ipc: message queues dump update for new kernel API
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-19 20:09:59 +04:00
Pavel Emelyanov
5908c2eb45 code: Fix while ( formatting
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 21:39:36 +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
2d56d1b056 ns: Add ability to save original ns and restoring it back while switcing
This will be required for parasite transport socket creation -- it will
have to be created in a net ns we're putting parasite in and then we'll
have to restore it back to original to go on dumping.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 07:55:05 +04:00
Kinsbursky Stanislav
8c72187be1 protobuf: use generic show function for ipc namespace variables
v2:
1) Debug garbage removed

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:05:07 +04:00
Kinsbursky Stanislav
ba4366d3da protobuf: use generic show function for ipc shared memory
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:04:58 +04:00
Kinsbursky Stanislav
49ea3128db protobuf: use generic show function for ipc messages
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:04:51 +04:00
Kinsbursky Stanislav
26eb254f96 protobuf: use generic show function for ipc semaphores
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:04:41 +04:00
Cyrill Gorcunov
afea21f954 protobuf: Convert IPC entries to PB format v2
v2 (from skinsbursky@)
 - drop redundant header inclusion
 - drop redundant "goto out"
 - drop redundant NULL assignment

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 11:31:39 +04:00
Andrey Vagin
066ec066a0 crtools: remove unused variables (v3)
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-18 19:01:21 +04:00
Pavel Emelyanov
c58abfd03d show: Introduce ->show callback for fdset
Each fdset item now has the callback which will show a contents of a magic-described
image file. Per-task and global show code is reworked to walk the respective fdsets
and calling ->show on each file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-27 12:01:14 +04:00
Pavel Emelyanov
bcf9ee3d1c fdset: Helper for getting fd out of a set
This patch does

s/$fdset->fds[$nr]/fdset_fd($fdset, $nr)/

over the code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-26 22:56:59 +04:00
Cyrill Gorcunov
827cabb480 show: Use pr_msg for showing contents on console
Due to code sharing, especially in IPC area,
the unbinding is done via helper macros and
sysclt engine tuning (new CTL_SHOW action
added).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-02 11:12:59 +04:00
Kinsbursky Stanislav
5990b6bfa6 IPC: message dumping updated due to mainstream STEAL logic changes
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-02-27 19:53:41 +04:00
Kinsbursky Stanislav
4fc8bb0a0e IPC: close image files after use
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-17 15:24:43 +04:00
Kinsbursky Stanislav
f086010abd IPC: restore semaphores sets
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-15 13:33:46 +04:00
Kinsbursky Stanislav
4101487f87 IPC: show semaphores set
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-15 13:33:46 +04:00
Kinsbursky Stanislav
4141296ed7 IPC: dump semaphores set
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-15 13:33:46 +04:00
Kinsbursky Stanislav
90340f75ca IPC: remove prohibition of mapped shared memory segments migration
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-15 13:30:34 +04:00
Kinsbursky Stanislav
9b73ad59e9 IPC: restore message queue
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-14 20:21:30 +04:00
Kinsbursky Stanislav
24c4381644 IPC: show message queue dump content
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-14 20:21:30 +04:00