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]
Date:   Fri, 20 Oct 2017 03:48:53 +0000
From:   Naoya Horiguchi <n-horiguchi@...jp.nec.com>
To:     "Huang, Ying" <ying.huang@...el.com>,
        Andrew Morton <akpm@...ux-foundation.org>
CC:     Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Michal Hocko <mhocko@...e.com>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        David Rientjes <rientjes@...gle.com>,
        Arnd Bergmann <arnd@...db.de>, Hugh Dickins <hughd@...gle.com>,
        Jérôme Glisse <jglisse@...hat.com>,
        Daniel Colascione <dancol@...gle.com>,
        Zi Yan <zi.yan@...rutgers.edu>
Subject: Re: [PATCH -mm -V2] mm, pagemap: Fix soft dirty marking for PMD
 migration entry



On 10/20/2017 12:10 AM, Huang, Ying wrote:
> From: Huang Ying <ying.huang@...el.com>
> 
> Now, when the page table is walked in the implementation of
> /proc/<pid>/pagemap, pmd_soft_dirty() is used for both the PMD huge
> page map and the PMD migration entries.  That is wrong,
> pmd_swp_soft_dirty() should be used for the PMD migration entries
> instead because the different page table entry flag is used.
> Otherwise, the soft dirty information in /proc/<pid>/pagemap may be
> wrong.
> 
> Cc: Michal Hocko <mhocko@...e.com>
> Cc: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
> Cc: David Rientjes <rientjes@...gle.com>
> Cc: Arnd Bergmann <arnd@...db.de>
> Cc: Hugh Dickins <hughd@...gle.com>
> Cc: "Jérôme Glisse" <jglisse@...hat.com>
> Cc: Daniel Colascione <dancol@...gle.com>
> Cc: Zi Yan <zi.yan@...rutgers.edu>
> Cc: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
> Signed-off-by: "Huang, Ying" <ying.huang@...el.com>
> Fixes: 84c3fc4e9c56 ("mm: thp: check pmd migration entry in common path")
> ---
>  fs/proc/task_mmu.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index 2593a0c609d7..01aad772f8db 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -1311,13 +1311,15 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
>  		pmd_t pmd = *pmdp;
>  		struct page *page = NULL;
>  
> -		if ((vma->vm_flags & VM_SOFTDIRTY) || pmd_soft_dirty(pmd))
> +		if (vma->vm_flags & VM_SOFTDIRTY)
>  			flags |= PM_SOFT_DIRTY;

right, checking bits in pmd must be done after pmd_present is confirmed.

Acked-by: Naoya Horiguchi <n-horiguchi@...jp.nec.com>

Thanks,
Naoya Horiguchi

>  
>  		if (pmd_present(pmd)) {
>  			page = pmd_page(pmd);
>  
>  			flags |= PM_PRESENT;
> +			if (pmd_soft_dirty(pmd))
> +				flags |= PM_SOFT_DIRTY;
>  			if (pm->show_pfn)
>  				frame = pmd_pfn(pmd) +
>  					((addr & ~PMD_MASK) >> PAGE_SHIFT);
> @@ -1329,6 +1331,8 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
>  			frame = swp_type(entry) |
>  				(swp_offset(entry) << MAX_SWAPFILES_SHIFT);
>  			flags |= PM_SWAP;
> +			if (pmd_swp_soft_dirty(pmd))
> +				flags |= PM_SOFT_DIRTY;
>  			VM_BUG_ON(!is_pmd_migration_entry(pmd));
>  			page = migration_entry_to_page(entry);
>  		}
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ