mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 12:57:57 +00:00
mm: fix expression to determine which vma-s can be shared
Currently only addresses are compared. It's obviously not enough. * First of all the parent vma must be private. * Both vma-s must have the identical set of MAP_GROWSDOWN and MAP_FILES flags. * Both vma-s must be linked to the same file. https://bugzilla.openvz.org/show_bug.cgi?id=2824 Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
7659c995f5
commit
57d25e7cea
24
cr-restore.c
24
cr-restore.c
@ -234,14 +234,24 @@ static int map_private_vma(pid_t pid, struct vma_area *vma, void *tgt_addr,
|
||||
if (p->vma.start > vma->vma.start)
|
||||
break;
|
||||
|
||||
if (p->vma.end == vma->vma.end &&
|
||||
p->vma.start == vma->vma.start) {
|
||||
pr_info("COW 0x%016"PRIx64"-0x%016"PRIx64" 0x%016"PRIx64" vma\n",
|
||||
vma->vma.start, vma->vma.end, vma->vma.pgoff);
|
||||
paddr = decode_pointer(vma->premmaped_addr);
|
||||
break;
|
||||
}
|
||||
if (!vma_priv(&p->vma))
|
||||
continue;
|
||||
|
||||
if (p->vma.end != vma->vma.end ||
|
||||
p->vma.start != vma->vma.start)
|
||||
continue;
|
||||
|
||||
/* Check flags, which must be identical for both vma-s */
|
||||
if ((vma->vma.flags ^ p->vma.flags) & (MAP_GROWSDOWN | MAP_ANONYMOUS))
|
||||
break;
|
||||
|
||||
if (!(vma->vma.flags & MAP_ANONYMOUS) &&
|
||||
vma->vma.shmid != p->vma.shmid)
|
||||
break;
|
||||
|
||||
pr_info("COW 0x%016"PRIx64"-0x%016"PRIx64" 0x%016"PRIx64" vma\n",
|
||||
vma->vma.start, vma->vma.end, vma->vma.pgoff);
|
||||
paddr = decode_pointer(vma->premmaped_addr);
|
||||
}
|
||||
|
||||
*pvma = p;
|
||||
|
Loading…
x
Reference in New Issue
Block a user