From 83c209ef07ac054f14bddf65c5fb933c7b0c6f06 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Tue, 8 Nov 2011 13:54:01 +0400 Subject: [PATCH] Move vma prot setup into parsing helper To shrink restorer code. Signed-off-by: Cyrill Gorcunov --- restorer.c | 3 --- util.c | 12 +++++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/restorer.c b/restorer.c index 6b462b804..55d72e166 100644 --- a/restorer.c +++ b/restorer.c @@ -217,9 +217,6 @@ self_len_end: if (!(vma_entry.status & VMA_AREA_REGULAR)) continue; - if (vma_entry.status & VMA_AREA_STACK) - vma_entry.prot |= PROT_GROWSDOWN; - #if 0 vma_entry.fd = -1UL; /* for a while */ vma_entry.pgoff = 0; diff --git a/util.c b/util.c index c9ee45213..4e82774d7 100644 --- a/util.c +++ b/util.c @@ -329,16 +329,18 @@ int parse_maps(pid_t pid, struct list_head *vma_area_list, bool use_map_files) vma_area->vma.status = 0; - if (strstr(big_buffer, "[stack]")) + if (strstr(big_buffer, "[stack]")) { vma_area->vma.status |= VMA_AREA_REGULAR | VMA_AREA_STACK; - else if (strstr(big_buffer, "[vsyscall]")) + vma_area->vma.prot |= PROT_GROWSDOWN; + } else if (strstr(big_buffer, "[vsyscall]")) { vma_area->vma.status |= VMA_AREA_VSYSCALL; - else if (strstr(big_buffer, "[vdso]")) + } else if (strstr(big_buffer, "[vdso]")) { vma_area->vma.status |= VMA_AREA_VDSO; - else if (strstr(big_buffer, "[heap]")) + } else if (strstr(big_buffer, "[heap]")) { vma_area->vma.status |= VMA_AREA_REGULAR | VMA_AREA_HEAP; - else + } else { vma_area->vma.status = VMA_AREA_REGULAR; + } /* * Some mapping hints for restore, we save this on