Commit b43c29bb authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

parasite: unprotect VMA-s if one of DUMPPAGES operations failed

PARASITE_CMD_DUMPPAGES is called many times and the parasite args
contains an array with vmas at this time, so VMAs can be unprotected in
error case
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent d020ebb3
......@@ -22,6 +22,12 @@ static int tsock = -1;
static struct rt_sigframe *sigframe;
/*
* PARASITE_CMD_DUMPPAGES is called many times and the parasite args contains
* an array of VMAs at this time, so VMAs can be unprotected in any moment
*/
static struct parasite_dump_pages_args *mprotect_args = NULL;
#ifndef SPLICE_F_GIFT
#define SPLICE_F_GIFT 0x08
#endif
......@@ -42,6 +48,11 @@ static int mprotect_vmas(struct parasite_dump_pages_args *args)
}
}
if (args->add_prot)
mprotect_args = args;
else
mprotect_args = NULL;
return ret;
}
......@@ -435,6 +446,11 @@ static int fini()
{
unsigned long new_sp;
if (mprotect_args) {
mprotect_args->add_prot = 0;
mprotect_vmas(mprotect_args);
}
new_sp = (long)sigframe + SIGFRAME_OFFSET;
pr_debug("%ld: new_sp=%lx ip %lx\n", sys_gettid(),
new_sp, RT_SIGFRAME_REGIP(sigframe));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment