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

24 Commits

Author SHA1 Message Date
Andrey Vagin
de71c48079 syscall: add memfd_create() (v3)
v2: Follow the kerndat style that "features" are described
just by global boolean variables.

v3: give NULL as a name to get EFAULT if memfd_create is supported
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-23 19:57:10 +04:00
Sophie Blee-Goldman
e606c2141e Dump capabilities from the parasite
Needed for future user namespace support. Capabilities will have to be
dumped from the parasite, ie from inside the namespace since there is no
obvious way to 'translate' capabilities from the global namespace (unlike
with uids and gids, where the id mappings can be used for translation).

[ additional explanation from Andrew Vagin:

"capabilities" are not translated between namespaces. They can exist
only in one userns, where a process lives. If a process is created in a
new userns, it gets a full set of capabilities in this userns, and
loses all caps in a parent userns.

So if capabilities are not shown in /proc/pid/stat, we have no way to
get it except of using parasite code. ]

Signed-off-by: Sophie Blee-Goldman <ableegoldman@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-15 23:10:44 +04:00
Sophie Blee-Goldman
4940776620 Move function definition
Moves the definition of kerndat_init() to below the definition
of get_last_cap(). Needed for reading capabilities in a future patch.

Signed-off-by: Sophie Blee-Goldman <ableegoldman@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-15 23:09:51 +04:00
Andrey Vagin
33a50cfdc8 mount: detect the newinstance option for devpts (v2)
The devpts instance was mounted w/o the newinstance option if,
the device number is equal to the root /dev/pts.

I think this condition is strong enough to not mount devpts in a
temporary place.

v2: move the host.bla-bla-bla in kerndat.c
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-08 15:32:35 +04:00
Pavel Emelyanov
a90613cf9d mem: Fix zero_page_pfn type
It is compared to u64, so should be such as well

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-31 00:08:47 +04:00
Pavel Emelyanov
f9c8e3a2cd pagemap: Factor out pfn retrieving for vdso and zero page
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-30 23:34:53 +04:00
Pavel Emelyanov
ab4341a22b kerndat: Close pagemap fd after getting zero page pfn
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-30 14:34:27 +04:00
Andrey Vagin
af510ae01a mm: don't dump the zero page
If someone reads untouched page, the kernel maps the zero page
to this address. This page will not have the SOFT_DIRTY bit and it must
not be dumped.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-30 14:31:39 +04:00
Pavel Emelyanov
04fde2e178 mem: Don't track memory changes if --track-mem is not specified
We have a big mistake in how we track for ptes to be SOFT_DIRTY -- no
need in these checks if the --track-mem is not given.

While fixing this, remember proper checks for the kernel memory tracker.

Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reported-by: Tim Schürmann <info@tim-schuermann.de>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-16 22:07:44 +04:00
Pavel Emelyanov
14a7aff288 rst: Read sys.last_cap only once in kerndat
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-12 00:03:25 +04:00
Pavel Emelyanov
f0a8643736 kerndat: Initialize necessary kerndats on restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-11 17:38:57 +04:00
Pavel Emelyanov
461a466722 kerndat: Don't fail it tcp_*mem sysctls are missing
This can hppen if criu is run in container.

Reported-by: Frederico Araujo <araujof@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-11 17:26:34 +04:00
Cyrill Gorcunov
664659a0ad inet: tcp -- Find size of max memory allowed to restore TCP data
The maximal size which may be used in the kernel for sending TCP data
on restore is varies depending on how many memory installed on the
system, moreover the memory allocated for "read queue" is bigger than
used for "write queue". Thus when we checkpointed a big slab of data
we need to figure out which size is allowed for sending data on restore.

For this we read /proc/sys/net/ipv4/tcp_[wmem|rmem] on restore and calculate
the size needed, then we simply chop data to segements and send it
in a loop.

Typical output on restore is something like

 | (00.013001)  30110: TCP queue memory limits are 2097152:3145728

https://bugzilla.openvz.org/show_bug.cgi?id=2751

[xemul: moved stuff to kerndat.c]

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-04 16:18:24 +04:00
Cyrill Gorcunov
9556ffb112 kerndat: Produce sane error messgaes
I've just occasionally tried to run criu on old openvz
kernel and the error message was looking somehow strange
to me

| Error (kerndat.c:39): Can't stat piggie: No such file or directory

Lets produce some more detailed error text.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-09 15:37:35 +04:00
Pavel Emelyanov
52de6313a8 kerndat: Sanitize pagemap entry read err check
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-02 09:52:22 +04:00
Pavel Emelyanov
0b5170c0fc mem: Remove pagemap2 mentions
This file was created for backward compatibility with
not-yet-patched kernel. Now we can remove it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-02 09:51:33 +04:00
Pavel Emelyanov
0f96026192 mem: Lower messages severity for inability to reset dirty tracker
The _actual_ need for this is checked in other place.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-02 09:15:50 +04:00
Cyrill Gorcunov
58cb8b2769 pagemap: Move PME_ constants to the header
This constants are system wide, so move them to mem.h
header for reuse sake.

[ xemul: It was kerndat.h in the patch ]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-23 12:50:43 +04:00
Pavel Emelyanov
61c6360c1d mem: Update soft-dirty detection to work on -mm tree
The soft-dirty API has changed slightly -- now the bit in
question _is_ in pagemap file (not pagemap2) but to see it
we have to reset soft-dirty for anyone first.

Teach the kerndat soft-dirty checker this fact. The actual
pagemap reading code already knows select pagemap/pagemap2
file itself.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-17 16:13:49 +04:00
Libo Chen
076ad01e4c kerndat: munmap when stat call fail
Avoid memleak in err case

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-04 22:03:08 +04:00
Pavel Emelyanov
a3872dbead mem: Treat /proc/pid/pagemap2 file as optional
It will appear not earlier than in 3.10.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-23 23:22:25 +04:00
Libo Chen
9f9ed0c69e kerndat:fix compile err
Update to commit 78b8abe9a53884686d4f70d1376f85108cbfc857
I find a compile err:

kerndat.c: In function 'kerndat_get_dirty_track':
kerndat.c:78:6: error: ignoring return value of 'read', declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors
make[2]: *** [kerndat.o] Error 1
make[1]: *** [built-in.o] Error 2
make[1]: Leaving directory `/home/clb/crtools'
make: *** [all] Error 2

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 21:51:27 +04:00
Pavel Emelyanov
199dba2361 soft-dirty: Check that kernel reports soft-dirty bits
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 13:24:32 +04:00
Pavel Emelyanov
5b343b40eb kerndat: Introduce the storage of kernel run-time info
One of such things we use right now is the device for anon shmem
mappings backing. In the furure this can be extended to check for
various kernel features.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 13:02:09 +04:00