From aa9ea9209e0487629a30fe851f01e19b02f6e007 Mon Sep 17 00:00:00 2001 From: Alexander Kartashov Date: Wed, 9 Jan 2013 17:23:48 +0400 Subject: [PATCH] cr: don't touch VM above TASK_SIZE. VM above TASK_SIZE is read-only but some areas are mapped on ARM into the process address space. Signed-off-by: Alexander Kartashov Signed-off-by: Pavel Emelyanov --- arch/x86/include/asm/types.h | 2 ++ parasite-syscall.c | 3 +++ pie/restorer.c | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h index bf33946b5..53b3df804 100644 --- a/arch/x86/include/asm/types.h +++ b/arch/x86/include/asm/types.h @@ -245,4 +245,6 @@ typedef struct { # define MADV_DONTDUMP 16 #endif +#define TASK_SIZE ((1UL << 47) - 1) + #endif /* __CR_ASM_TYPES_H__ */ diff --git a/parasite-syscall.c b/parasite-syscall.c index 26de3ad54..49b47aa63 100644 --- a/parasite-syscall.c +++ b/parasite-syscall.c @@ -591,6 +591,9 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a continue; } + if (vma_area->vma.end > TASK_SIZE) + continue; + ret = parasite_execute(PARASITE_CMD_DUMPPAGES, ctl); if (ret) { pr_err("Dumping pages failed with %d\n", ret); diff --git a/pie/restorer.c b/pie/restorer.c index 337577a33..5769603fd 100644 --- a/pie/restorer.c +++ b/pie/restorer.c @@ -466,6 +466,9 @@ long __export_restore_task(struct task_restore_core_args *args) } } + if (vma_entry->end >= TASK_SIZE) + continue; + if (vma_entry->end > premmapped_end) { if (vma_entry->start < premmapped_end) addr = premmapped_end; @@ -488,6 +491,9 @@ long __export_restore_task(struct task_restore_core_args *args) if (!vma_priv(vma_entry)) continue; + if (vma_entry->end >= TASK_SIZE) + continue; + if (vma_entry->start > vma_entry->shmid) break; @@ -505,6 +511,9 @@ long __export_restore_task(struct task_restore_core_args *args) if (!vma_priv(vma_entry)) continue; + if (vma_entry->start > TASK_SIZE) + continue; + if (vma_entry->start < vma_entry->shmid) break;