The restorer context is the last stage of the [[Checkpoint/Restore|restore]] process. It differs from the regular CRIU's (process) context like the [[parasite code]] does -- it doesn't have any libraries, it is PIE-compiled and can olny work on fixed amount of memory. In this context CRIU restores
+
The restorer context is the last stage of the [[Checkpoint/Restore|restore]] process. It differs from the regular CRIU's (process) context like the [[parasite code]] does -- it doesn't have any libraries, it is PIE-compiled and can only work on fixed amount of memory. In this context CRIU restores
# memory
# memory
Line 21:
Line 21:
== What is restored there and why ==
== What is restored there and why ==
+
+
So, memory is restored here for the reasons described above. Note, that here CRIU does two things only
+
+
# Move anonymous VMAs to proper places
+
# Map new file VMAs
+
+
The anonymous memory is mmaped and filled with data earlier, in restorer it's only mremap()-ed into proper addressed. The files mapping are just mmap()-ed, as data in them sits in files :)
+
+
Timers are restore here, since CRIU processes can wait for each other for some time while restoring and not to lose timer ticks there, we delay timers arming this the last moment.
+
+
Credentials are restored here to allow CRIU perform privileged operations such as fork-with-pid or chroot().
+
+
Threads are restored here for simplicity. If we restored them before, we'd have to "park" them while we change the memory layout. Instead of doing this, we first toss the memory around, then create threads.