2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

mm: mark a vma as stack, if a value of sp is in it

/proc/PID/maps can contains not up to date information about a stack vma.
A kernel marks a VMA as stack, if thread_struct->usersp is in it,
but usersp is updated, when a process calls a syscall.

This problem is occured, when we try to dump/restore a process in a loop.
When a restorer resumes a process, a restorer vma will be marked as stack.

A thread stack should not be marked as stack, because its vma is mapped
w/o MAP_GROWSDOWN.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2012-09-07 18:21:04 +04:00
committed by Pavel Emelyanov
parent 0e0da2de9e
commit 0ae2bad0c6
5 changed files with 26 additions and 6 deletions

14
util.c
View File

@@ -36,6 +36,20 @@
#include "crtools.h"
/* /proc/PID/maps can contain not up to date information about stack */
void mark_stack_vma(unsigned long sp, struct list_head *vma_area_list)
{
struct vma_area *vma_area;
list_for_each_entry(vma_area, vma_area_list, list) {
if (in_vma_area(vma_area, sp)) {
vma_area->vma.status |= VMA_AREA_STACK;
vma_area->vma.flags |= MAP_GROWSDOWN;
return;
}
}
BUG();
}
void pr_vma(unsigned int loglevel, const struct vma_area *vma_area)
{
if (!vma_area)