lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51F67777.6060609@parallels.com>
Date:	Mon, 29 Jul 2013 18:08:55 +0400
From:	Pavel Emelyanov <xemul@...allels.com>
To:	Cyrill Gorcunov <gorcunov@...il.com>
CC:	Linux MM <linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>,
	Andy Lutomirski <luto@...capital.net>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Matt Mackall <mpm@...enic.com>,
	Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>,
	Marcelo Tosatti <mtosatti@...hat.com>,
	KOSAKI Motohiro <kosaki.motohiro@...il.com>,
	Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH] mm: Save soft-dirty bits on file pages

On 07/27/2013 12:18 AM, Cyrill Gorcunov wrote:
> Andy reported that if file page get reclaimed we loose soft-dirty bit
> if it was there, so save _PAGE_BIT_SOFT_DIRTY bit when page address
> get encoded into pte entry. Thus when #pf happens on such non-present
> pte we can restore it back.
> 
> Reported-by: Andy Lutomirski <luto@...capital.net>
> Signed-off-by: Cyrill Gorcunov <gorcunov@...nvz.org>
> Cc: Pavel Emelyanov <xemul@...allels.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Matt Mackall <mpm@...enic.com>
> Cc: Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
> Cc: Marcelo Tosatti <mtosatti@...hat.com>
> Cc: KOSAKI Motohiro <kosaki.motohiro@...il.com>
> Cc: Stephen Rothwell <sfr@...b.auug.org.au>
> ---

> @@ -57,17 +57,25 @@ static int install_file_pte(struct mm_st
>  		unsigned long addr, unsigned long pgoff, pgprot_t prot)
>  {
>  	int err = -ENOMEM;
> -	pte_t *pte;
> +	pte_t *pte, ptfile;
>  	spinlock_t *ptl;
>  
>  	pte = get_locked_pte(mm, addr, &ptl);
>  	if (!pte)
>  		goto out;
>  
> -	if (!pte_none(*pte))
> +	ptfile = pgoff_to_pte(pgoff);
> +
> +	if (!pte_none(*pte)) {
> +#ifdef CONFIG_MEM_SOFT_DIRTY
> +		if (pte_present(*pte) &&
> +		    pte_soft_dirty(*pte))

I think there's no need in wrapping every such if () inside #ifdef CONFIG_...,
since the pte_soft_dirty() routine itself would be 0 for non-soft-dirty case
and compiler would optimize this code out.

> +			pte_file_mksoft_dirty(ptfile);
> +#endif
>  		zap_pte(mm, vma, addr, pte);
> +	}
>  
> -	set_pte_at(mm, addr, pte, pgoff_to_pte(pgoff));
> +	set_pte_at(mm, addr, pte, ptfile);
>  	/*
>  	 * We don't need to run update_mmu_cache() here because the "file pte"
>  	 * being installed by install_file_pte() is not a real pte - it's a
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ