Changes

Jump to navigation Jump to search
484 bytes added ,  13:08, 18 August 2017
no edit summary
Line 1: Line 1:  
The criu utility dumps the state of processes/containers into a set of image files. This article describes the format of them.
 
The criu utility dumps the state of processes/containers into a set of image files. This article describes the format of them.
  −
{{Note| You might also want to checkout our image tool called [[CRIT]]}}
      
== Types of image files ==
 
== Types of image files ==
   −
CRIU images can be in one of formats
+
CRIU images can be in one of the following formats
    
* criu specific images in google protocol buffer format (PB format)
 
* criu specific images in google protocol buffer format (PB format)
Line 13: Line 11:  
== Images in criu-specific format ==
 
== Images in criu-specific format ==
   −
All criu-specific image files begin with 32-bit magic cookie. Images in PB format are followed by zero or more entries of the same type (not size!), each entry is preceded with 32-bit entry size value (not including this 32-bit value itself). Optionally each entry may be followed by extra payload which depends on the entry type.
+
All criu-specific image files begin with 2 32-bit magic cookies. The first cookie is the type of file (see below) the second is the optional sub-type of image. Images in PB format are followed by zero or more entries of the same type (not size!), each entry is preceded with 32-bit entry size value (not including this 32-bit value itself). Optionally each entry may be followed by extra payload which depends on the entry type.
 +
 
 +
Currently there are 3 types of images
 +
 
 +
; Inventory file
 +
: This is the image file describing the set. It doesn't have sub-type magic.
 +
 
 +
; Image file
 +
: Regular image. Most of the text below is about these files.
 +
 
 +
; Auxiliary file
 +
: File that is not image, but criu generates one and it happens to be in protobuf format too. For now we have only stats and irmap cache files of that type. They also have sub-type magic.
    
IOW protocol-buffers image files look like
 
IOW protocol-buffers image files look like
    
<pre>
 
<pre>
IMAGE_FILE ::= MAGIC { ENTRY }
+
IMAGE_FILE ::= MAGIC [MAGIC_2] { ENTRY }
 
ENTRY      ::= SIZE PAYLOAD [ EXTRA ]
 
ENTRY      ::= SIZE PAYLOAD [ EXTRA ]
 
PAYLOAD    ::= "message encoded in ProtocolBuffer format"
 
PAYLOAD    ::= "message encoded in ProtocolBuffer format"
Line 24: Line 33:     
MAGIC      ::= "32 bit integer"
 
MAGIC      ::= "32 bit integer"
 +
MAGIC_2    ::= "32 bit integer"
 
SIZE      ::= "32 bit integer, equals the PAYLOAD length"
 
SIZE      ::= "32 bit integer, equals the PAYLOAD length"
 
</pre>
 
</pre>
Line 31: Line 41:  
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Type !! Size(bytes)
+
! Type !! Size, bytes
 
|-
 
|-
 
| Magic || 4
 
| Magic || 4
Line 54: Line 64:  
; Array image files
 
; Array image files
 
: In these files the amount of entries can be any. You should read the image file up to the EOF to find out the exact number.
 
: In these files the amount of entries can be any. You should read the image file up to the EOF to find out the exact number.
 +
 
; Single-entry image files
 
; Single-entry image files
 
: In these files exactly one entry is stored.
 
: In these files exactly one entry is stored.
Line 69: Line 80:  
  | inventory || single-entry || Top level description of images || - || inventory.proto
 
  | inventory || single-entry || Top level description of images || - || inventory.proto
 
  |-
 
  |-
  | fdinfo || array || Open file descriptors || - || fdinfo.proto
+
  | fdinfo || array || [[Fdinfo-engine|Open file descriptors]] || - || fdinfo.proto
 
  |-
 
  |-
  | reg-files || array || Paths to files opened with <code>open(2)</code> syscall || - || regfile.proto
+
  | reg-files || array || Paths to [[:Category:Files|files]] opened with <code>open(2)</code> syscall || - || regfile.proto
 
  |-
 
  |-
 
  | eventfd || array || Eventfd file information || - || eventfd.proto
 
  | eventfd || array || Eventfd file information || - || eventfd.proto
Line 87: Line 98:  
  | core || single-entry || Core process info and (name, sigmask, itimers, etc.) arch-dependent information (registers, etc.) || - || core.proto
 
  | core || single-entry || Core process info and (name, sigmask, itimers, etc.) arch-dependent information (registers, etc.) || - || core.proto
 
  |-
 
  |-
  | mm || single-entry ||  Address space generic information (segments, exe file, etc.) || - || mm.proto
+
  | mm || single-entry ||  [[Memory dumping and restoring|Address space]] information (VMAs, segments, exe file, etc.) || - || mm.proto
|-
  −
| vmas || array || Virtual mappings (<code>mmap(2)</code>) (merged into above) || - || vma.proto
   
  |-
 
  |-
 
  | pipes || array || Pipes information || - || pipe.proto
 
  | pipes || array || Pipes information || - || pipe.proto
Line 99: Line 108:  
  | fifo-data || array || Contents of FIFOs || same as in pipes-data || pipe-data.proto
 
  | fifo-data || array || Contents of FIFOs || same as in pipes-data || pipe-data.proto
 
  |-
 
  |-
  | pstree || array || Process tree linkage || - || pstree.proto
+
  | pstree || array || Process [[tree after restore|tree linkage]] || - || pstree.proto
 
  |-
 
  |-
 
  | ids || single || IDs of objects (mm, files, sihand, etc.) and namespaces || - || core.proto
 
  | ids || single || IDs of objects (mm, files, sihand, etc.) and namespaces || - || core.proto
Line 105: Line 114:  
  | sigacts || array || Signal handling map || - || sa.proto
 
  | sigacts || array || Signal handling map || - || sa.proto
 
  |-
 
  |-
  | unixsk || array || Unix domain sockets || - || sk-unix.proto
+
  | unixsk || array || [[Unix sockets]] || - || sk-unix.proto
 
  |-
 
  |-
 
  | inetsk || array || PF_INET sockets, both IPv4 and IPv6 || - || sk-inet.proto
 
  | inetsk || array || PF_INET sockets, both IPv4 and IPv6 || - || sk-inet.proto
Line 121: Line 130:  
  | ghost-file || single-entry || Ghost [[invisible files]] || Right after the entry up to the EOF goes the contents of the file || ghost-file.proto
 
  | ghost-file || single-entry || Ghost [[invisible files]] || Right after the entry up to the EOF goes the contents of the file || ghost-file.proto
 
  |-
 
  |-
  | tcp-stream || single-entry || TCP connection state (including data in queues) || <code>entry.inq_len</code> bytes of in-queue data followed by <code>entry.outq_len</code> bytes of out-queue data || tcp-stream.proto
+
  | tcp-stream || single-entry || [[TCP connection]] state (including data in queues) || <code>entry.inq_len</code> bytes of in-queue data followed by <code>entry.outq_len</code> bytes of out-queue data || tcp-stream.proto
 
  |-
 
  |-
  | mountpoints || array || Mountpoints information || - || mnt.proto
+
  | mountpoints || array || [[Mountpoints]] information || - || mnt.proto
 
  |-
 
  |-
 
  | utsns || single-entry || Uname nodename and domainname of a UTS namespace || - || utsns.proto
 
  | utsns || single-entry || Uname nodename and domainname of a UTS namespace || - || utsns.proto
 
  |-
 
  |-
  | tty || array || Information about opened tty-s || - || tty.proto
+
  | tty || array || Information about opened [[TTYs]] || - || tty.proto
 
  |-
 
  |-
  | tty-info || array || Termios and similar stuff about tty-s || - || tty.proto
+
  | tty-info || array || Termios and similar stuff about [[TTYs]] || - || tty.proto
 
  |-
 
  |-
 
  | packetsk || array || Info about PF_PACKET sockets || - || packet-sock.proto
 
  | packetsk || array || Info about PF_PACKET sockets || - || packet-sock.proto
 
  |-
 
  |-
  | netdev || array || Info about network devices || - || netdev.proto
+
  | netdev || array || Info about [[:Category:Network|network]] devices || - || netdev.proto
 
  |}
 
  |}
   −
=== Images with [[memory dumps]] ===
+
=== Images with memory dumps ===
   −
Anonymous memory contents (both private and shared) is stored in two types of images
+
''Main article: [[memory dumps]]''.
 +
 
 +
Anonymous memory contents (both private and shared) is stored in two types of images:
    
; Pagemap files
 
; Pagemap files
 
: These files contain info about which virtual regions are populated with data. The file is a set of protobuf messages.
 
: These files contain info about which virtual regions are populated with data. The file is a set of protobuf messages.
{{Note| Even though, pagemap is an array kind of image(and can be included to the previous type), first pb message is of type pagemap_head and all the following ones are of type pagemap_entry. }}
+
{{Note| Even though pagemap is an array kind of image (and can be included to the previous type), first pb message is of type pagemap_head and all the following ones are of type pagemap_entry.}}
    
; Pages files
 
; Pages files
Line 149: Line 160:  
== Raw images ==
 
== Raw images ==
   −
These images contain data that were collected by criu with the help of some external tools. These are
+
These images contain data that were collected by criu with the help of some external tools.
    
{|class="wikitable sortable"
 
{|class="wikitable sortable"
 
  |-
 
  |-
  ! name
+
  ! Name
  ! tool that understand this format
+
  ! Tool supporting the format
  ! description
+
  ! Description
 
  |-
 
  |-
  | ifaddr || iproute2's ip || Contains info about IP addresses on network devices
+
  | ifaddr || ip from iproute2 || IP addresses on network devices
 
  |-
 
  |-
  | route || iproute2's ip || Contains routing tables
+
  | route || ip from iproute2 || Routing tables
 
  |-
 
  |-
  | tmpfs || tar + gzip || Contains contents of tmpfs filesystem
+
  | tmpfs || tar + gzip || Contents of a tmpfs filesystem
 
  |}
 
  |}
    
== Notes about protobuf ==
 
== Notes about protobuf ==
We have a registered field number(1018) for [https://developers.google.com/protocol-buffers/docs/proto#options custom options] of all kinds. See protobuf/opts.proto for more info.
+
We have a registered field number (1018) for [https://developers.google.com/protocol-buffers/docs/proto#options custom options] of all kinds. See protobuf/opts.proto for more info.
    
== See also ==
 
== See also ==
   −
* [[CRIT]] is the tool that decodes those images and prints them in a human readable format (and does more)
+
* [[CRIT]]: a tool to decode images to a human readable format
 
* [[What's bad with V1 images]]
 
* [[What's bad with V1 images]]
* [[ImageFieldMerging | Image field merging]]
+
* [[Image field merging]]
 +
* [[Memory dumps]]
    
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Images]]
 
[[Category:Images]]
 +
[[Category:Outdated]]

Navigation menu