[CRIU] [PATCH] check: Make sure dirty tracking not used on unpatched kernel

Pavel Emelyanov xemul at parallels.com
Thu Jan 30 09:57:06 PST 2014


On 01/30/2014 09:40 PM, Cyrill Gorcunov wrote:
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  kerndat.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/kerndat.c b/kerndat.c
> index 27acf0cc2ed1..04c937f1814f 100644
> --- a/kerndat.c
> +++ b/kerndat.c
> @@ -88,6 +88,18 @@ int kerndat_get_dirty_track(void)
>  
>  	map[0] = '\0';
>  
> +	/*
> +	 * It's known some kernel versions may have a dirty
> +	 * page tracking bug which clears soft dirty bit if
> +	 * mprotect code is unpatched. So in such case don't
> +	 * allow to use dirty page tracking.
> +	 */
> +	if (mprotect(map, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC)) {

O_o Why mprotect failure results in disabled tracker? And how does it
correlate with soft-dirty BUG()?

Anyway -- I'm not applying the patch, since the fix is going to be in
stables soon.

> +		pr_perror("Alter prot err!");
> +		munmap(map, PAGE_SIZE);
> +		return -1;
> +	}
> +
>  	lseek(pm2, (unsigned long)map / PAGE_SIZE * sizeof(u64), SEEK_SET);
>  	ret = read(pm2, &pmap, sizeof(pmap));
>  	if (ret < 0)
> 




More information about the CRIU mailing list