[CRIU] [PATCH] restorer: Calculate self-stack size with guard pages

Cyrill Gorcunov gorcunov at openvz.org
Mon Jul 23 06:36:45 EDT 2012


Otherwise we might not unmap the whole stack leaving
a guard page in restoree memory map. Not a big deal
but anyway.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 restorer.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/restorer.c b/restorer.c
index abaf531..95a7922 100644
--- a/restorer.c
+++ b/restorer.c
@@ -301,6 +301,13 @@ long __export_restore_task(struct task_restore_core_args *args)
 		if (!vma_entry_is(vma_entry, VMA_AREA_REGULAR))
 			continue;
 
+		/*
+		 * The kernel doesn't show stack guard pages on
+		 * proc output, so add pages here by hands.
+		 */
+		if (vma_entry_is(vma_entry, VMA_AREA_STACK))
+			vma_entry->start -= PAGE_SIZE;
+
 		if (sys_munmap((void *)vma_entry->start, vma_entry_len(vma_entry))) {
 			write_num_n(__LINE__);
 			goto core_restore_end;
-- 
1.7.7.6



More information about the CRIU mailing list