Skip to content

Commit f6952b6

Browse files
committed
mtcp_restart.c: Check if end2 > vvar_area.endAddr
1 parent 574e15f commit f6952b6

2 files changed

Lines changed: 33 additions & 3 deletions

File tree

restart_plugin/dmtcp_restart_plugin.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ void dmtcp_restart_plugin(const string &restartDir,
5353
mtcpArgs.push_back((char*) "--minHighMemStart");
5454
mtcpArgs.push_back((char*) kvmap.at("MANA_MinHighMemStart").c_str());
5555

56+
mtcpArgs.push_back((char*) "--maxHighMemEnd");
57+
mtcpArgs.push_back((char*) kvmap.at("MANA_MaxHighMemEnd").c_str());
58+
5659
if (!restartDir.empty()) {
5760
mtcpArgs.push_back((char *)"--restartdir");
5861
mtcpArgs.push_back((char *)restartDir.c_str());
@@ -65,4 +68,4 @@ void dmtcp_restart_plugin(const string &restartDir,
6568
mtcpArgs.push_back(NULL);
6669
execvp(mtcpArgs[0], &mtcpArgs[0]);
6770
JASSERT(false)(mtcpArgs[0]).Text("execvp failed!");
68-
}
71+
}

restart_plugin/mtcp_restart_plugin.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,12 @@ mtcp_plugin_hook(RestoreInfo *rinfo)
563563
end2 = 0;
564564
}
565565

566+
Area vvar_area;
567+
MTCP_ASSERT(getMappedArea(&vvar_area, "[vvar]") == 1);
568+
// if (end2 > vvar_area.addr) {
569+
// end2 = vvar_area.addr;
570+
// }
571+
566572
// ADJUST THE [start2, end2] AROUND THE LOWER-HALF STACK:
567573
// The lower-half stack is present. We will restore the upper-half
568574
// stack later, while restoring the upper half. We may have an
@@ -643,7 +649,14 @@ mtcp_plugin_hook(RestoreInfo *rinfo)
643649
end2 = 0;
644650
}
645651
}
646-
// FIXME: End of '#if 1'; Remove '# else' branch when the code is stable.
652+
653+
Area vvar_area;
654+
MTCP_ASSERT(getMappedArea(&vvar_area, "[vvar]") == 1);
655+
if (end2 > vvar_area.addr) {
656+
end2 = vvar_area.addr;
657+
}
658+
659+
// FIXME: End of '#if 1'; Remove this '# else' branch when the code is stable
647660
# endif
648661

649662
reserveUpperHalfMemoryRegionsForCkptImgs(start1, end1, start2, end2);
@@ -783,6 +796,12 @@ mtcp_plugin_hook(RestoreInfo *rinfo)
783796
end2 = 0;
784797
}
785798

799+
Area vvar_area;
800+
MTCP_ASSERT(getMappedArea(&vvar_area, "[vvar]") == 1);
801+
// if (end2 > vvar_area.addr) {
802+
// end2 = vvar_area.addr;
803+
// }
804+
786805
// ADJUST THE [start2, end2] AROUND THE LOWER-HALF STACK:
787806
// The lower-half stack is present. We will restore the upper-half
788807
// stack later, while restoring the upper half. We may have an
@@ -853,6 +872,7 @@ mtcp_plugin_hook(RestoreInfo *rinfo)
853872
Area stack_area;
854873
MTCP_ASSERT(getMappedArea(&stack_area, "[stack]") == 1);
855874
end1 = MIN(stack_area.endAddr - 4 * GB, rinfo->minHighMemStart - 4 * GB);
875+
MTCP_ASSERT(getMappedArea(&vvar_area, "[vvar]") == 1);
856876
// maxHighMemEnd reserves 8MB above min high memory region.
857877
// That should include space for stack, argv, env, auxvec.
858878
start2 = rinfo->minHighMemStart;
@@ -863,7 +883,14 @@ mtcp_plugin_hook(RestoreInfo *rinfo)
863883
end2 = 0;
864884
}
865885
}
866-
// FIXME: End of '#if 1'; Remove '# else' branch when the code is stable.
886+
887+
Area vvar_area;
888+
MTCP_ASSERT(getMappedArea(&vvar_area, "[vvar]") == 1);
889+
if (end2 > vvar_area.addr) {
890+
end2 = vvar_area.addr;
891+
}
892+
893+
// FIXME: End of '#if 1'; Remove this '# else' branch when the code is stable
867894
# endif
868895

869896
char full_filename[PATH_MAX];

0 commit comments

Comments
 (0)