Changes

Jump to navigation Jump to search
160 bytes added ,  08:42, 25 April 2018
m
Line 19: Line 19:  
In trap mode parasite simply executes one command and yields cpu trap instruction which CRIU intercepts. This is like one command at a time mode.
 
In trap mode parasite simply executes one command and yields cpu trap instruction which CRIU intercepts. This is like one command at a time mode.
   −
In daemon mode (as name implies) parasite behaves like a unix daemon - it opens a unix socket and start listening for commands on it. Once command received it get handled and daemon returns result back via socket packet, then it continue listening for the next command and etc. All currently known commands are assembled as <code>PARASITE_CMD_…</code> enum in <code>parasite.h</code> header.
+
In daemon mode (as name implies) parasite behaves like a unix daemon - it opens a unix socket and start listening for commands on it. Once a command is received, it is handled and the daemon returns the result back via a socket packet. The daemon continues listening for the subsequent commands to execute. All currently known commands are assembled as <code>PARASITE_CMD_…</code> enum in <code>parasite.h</code> header.
    
== Parasite internal structure ==
 
== Parasite internal structure ==
Line 45: Line 45:  
== Curing dumpee from parasite code ==
 
== Curing dumpee from parasite code ==
   −
Once everything is done and we no longer need parasite we are removing it from the dumpee address space in several steps:
+
Once everything is done and we no longer need parasite it is removed from the dumpee's address space by performing the following steps:
   −
# CRIU start tracing the syscalls parasite is executing with help of <code>ptrace</code>
+
# CRIU starts tracing the syscalls parasite is executing with help of <code>ptrace</code>
# Send <code>PARASITE_CMD_FINI</code> to parasite via control socket
+
# CRIU sends <code>PARASITE_CMD_FINI</code> to the parasite via the control socket
# Parasite receives it, then closes control socket and executes <code>rt_sigreturn()</code> system call
+
# Parasite receives the command, then closes control socket and executes <code>rt_sigreturn()</code> system call
# CRIU intercept exit from this syscall and unmaps parasite memory area, thus victim become into the state it was before parasite injection
+
# CRIU intercepts exit from this syscall and unmaps parasite memory area, thus reverting the dumpee back to the state it was in before parasite injection
 +
 
 +
== See also ==
 +
* [[Code blobs]]
 +
* [[Compel]]
    
[[Category: Under the hood]]
 
[[Category: Under the hood]]
 +
[[Category: Editor help needed]]
2

edits

Navigation menu