Commit 57971f72 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

restorer: Some preliminary work initiated on mmap heuristics

Just to not lose the snippet.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent aaf3291e
......@@ -1229,6 +1229,7 @@ static void restorer_test(pid_t pid)
restorer_fcall_t restorer_fcall;
char path[64];
long prev_vma_end, cur_vma_start;
LIST_HEAD(self_vma_list);
struct vma_area *vma_area;
int fd_vmas, num;
......@@ -1253,7 +1254,6 @@ static void restorer_test(pid_t pid)
num++;
}
free_mappings(&self_vma_list);
close(fd_vmas);
restorer_fcall = restorer;
......@@ -1262,6 +1262,13 @@ static void restorer_test(pid_t pid)
code_len = round_up(code_len, 16);
vma_len = round_up(code_len + RESTORER_STACK_SIZE, PAGE_SIZE);
/*
* Here we need some heuristics -- the VMA which restorer will
* belong to should not be unmapped, so we need to gueess out
* where to put it in.
*/
prev_vma_end = cur_vma_start = 0;
/* VMA we need to run restorer code */
exec_mem = mmap(0, vma_len,
PROT_READ | PROT_WRITE | PROT_EXEC,
......
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