: [CRIU] [PATCH] restorer: Make sure the protection on code/data
mm areas do fit the kernel requirements
Pavel Emelyanov
xemul at parallels.com
Fri Apr 13 10:59:25 EDT 2012
On 04/13/2012 02:34 PM, Cyrill Gorcunov wrote:
> On Fri, Apr 13, 2012 at 01:24:40PM +0400, Pavel Emelyanov wrote:
>>
>> You don't use the flags value after this AT ALL, wtf???
>>
>
> This one should do the trick.
>
> Cyrill
> + sys_mmap((void *)args->mm.mm_start_code, PAGE_SIZE, prot, flags, -1, 0);
> + ret |= sys_prctl_safe(PR_SET_MM, PR_SET_MM_START_CODE, (long)args->mm.mm_start_code, 0);
> + sys_munmap((void *)args->mm.mm_start_code, PAGE_SIZE);
> +
> + sys_mmap((void *)args->mm.mm_end_code, PAGE_SIZE, PROT_EXEC | PROT_READ, flags, -1, 0);
> + ret |= sys_prctl_safe(PR_SET_MM, PR_SET_MM_END_CODE, (long)args->mm.mm_end_code, 0);
> + sys_munmap((void *)args->mm.mm_end_code, PAGE_SIZE);
This is much nicer. Can we tune this a little bit more, i.e. like this
sys_mmap(code_start, code_end - code_start, ...)
sys_prctl(PR_SET_MM_START_CODE)
sys_prctl(PR_SET_MM_END_CODE)
sys_munmap()
i.e. mmap only one mapping per PR_SET_MM, not two?
And yes, talk to HPA in order to relax kernel's part of this.
Thanks,
Pavel
More information about the CRIU
mailing list