[PATCH] proc_parse: Borrow vmi iif there is file referenced
Cyrill Gorcunov
gorcunov at openvz.org
Wed Mar 5 06:22:37 PST 2014
Otherwise we migh propagate previous vfi status
to vmas which actually don't match.
| (00.005471) 0x2b79227d6000-0x2b79227d8000 (8K) prot 0x5 flags 0x22 off 0 reg vdso ap shmid: 0
| (00.005473) 0x2b79227d8000-0x2b79227da000 (8K) prot 0x3 flags 0x22 off 0 reg vdso ap shmid: 0
| (00.005475) 0x2b79227f1000-0x2b79227f2000 (4K) prot 0x3 flags 0x22 off 0 reg vdso ap shmid: 0
| (00.005476) 0x2b79227f2000-0x2b79227f4000 (8K) prot 0x3 flags 0x22 off 0 reg vdso ap shmid: 0
Reported-by: Pavel Tikhomirov <snorcht at gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
proc_parse.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/proc_parse.c b/proc_parse.c
index 3a7b5ebd21eb..d628e811148f 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -172,6 +172,13 @@ static int vma_get_mapfile(struct vma_area *vma, DIR *mfd,
if (prev_vfi->vma && vfi_equal(vfi, prev_vfi)) {
struct vma_area *prev = prev_vfi->vma;
+ /*
+ * If vfi is equal (!) and negative @vm_file_fd --
+ * we have nothing to borrow for sure.
+ */
+ if (prev->vm_file_fd < 0)
+ return 0;
+
pr_debug("vma %"PRIx64" borrows vfi from previous %"PRIx64"\n",
vma->e->start, prev->e->start);
vma->vm_file_fd = prev->vm_file_fd;
--
1.8.3.1
--Lb0e7rgc7IsuDeGj--
More information about the CRIU
mailing list