From 8f0e200e666440d0377382b3632e76fa5e2d220b Mon Sep 17 00:00:00 2001 From: Artem Trushkin Date: Sun, 24 Mar 2024 17:16:58 +0700 Subject: [PATCH] mem: fix some VMAs being incorrectly mapped wtih PROT_WRITE A memory interval is a half-open interval, so the condition when pr->pe->vaddr == vma->e->end should not be interpreted as an intersection and should cause vma to be marked with VMA_NO_PROT_WRITE. Fixes: #2364 Signed-off-by: Artem Trushkin --- criu/mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/criu/mem.c b/criu/mem.c index 0236c5e1e..5f0d57eb6 100644 --- a/criu/mem.c +++ b/criu/mem.c @@ -1057,7 +1057,7 @@ static int premap_priv_vmas(struct pstree_item *t, struct vm_area_list *vmas, vo do { if (pr->pe->vaddr + pr->pe->nr_pages * PAGE_SIZE <= vma->e->start) continue; - if (pr->pe->vaddr > vma->e->end) + if (pr->pe->vaddr >= vma->e->end) vma->e->status |= VMA_NO_PROT_WRITE; break; } while (pr->advance(pr));