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: <87fu43lui1.fsf@yhuang-dev.intel.com>
Date:   Tue, 10 Apr 2018 09:28:54 +0800
From:   "Huang\, Ying" <ying.huang@...el.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
        Michal Hocko <mhocko@...e.com>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Andrei Vagin <avagin@...nvz.org>,
        "Dan Williams" <dan.j.williams@...el.com>,
        Jerome Glisse <jglisse@...hat.com>,
        Daniel Colascione <dancol@...gle.com>,
        Zi Yan <zi.yan@...rutgers.edu>,
        "Naoya Horiguchi" <n-horiguchi@...jp.nec.com>
Subject: Re: [PATCH -mm] mm, pagemap: Fix swap offset value for PMD migration entry

Hi, Andrew,

"Huang, Ying" <ying.huang@...el.com> writes:

> From: Huang Ying <ying.huang@...el.com>
>
> The swap offset reported by /proc/<pid>/pagemap may be not correct for
> PMD migration entry.  If addr passed into pagemap_range() isn't
> aligned with PMD start address, the swap offset reported doesn't
> reflect this.  And in the loop to report information of each sub-page,
> the swap offset isn't increased accordingly as that for PFN.
>
> BTW: migration swap entries have PFN information, do we need to
> restrict whether to show them?
>
> Signed-off-by: "Huang, Ying" <ying.huang@...el.com>
> Cc: Michal Hocko <mhocko@...e.com>
> Cc: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
> Cc: Andrei Vagin <avagin@...nvz.org>
> Cc: Dan Williams <dan.j.williams@...el.com>
> Cc: "Jerome 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>
> ---
>  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 65ae54659833..757e748da613 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -1310,9 +1310,11 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
>  #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
>  		else if (is_swap_pmd(pmd)) {
>  			swp_entry_t entry = pmd_to_swp_entry(pmd);
> +			unsigned long offset = swp_offset(entry);
>  
> +			offset += (addr & ~PMD_MASK) >> PAGE_SHIFT;
>  			frame = swp_type(entry) |
> -				(swp_offset(entry) << MAX_SWAPFILES_SHIFT);
> +				(offset << MAX_SWAPFILES_SHIFT);
>  			flags |= PM_SWAP;
>  			if (pmd_swp_soft_dirty(pmd))
>  				flags |= PM_SOFT_DIRTY;
> @@ -1332,6 +1334,8 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
>  				break;
>  			if (pm->show_pfn && (flags & PM_PRESENT))
>  				frame++;
> +			else if (flags | PM_SWAP)

Oops, I just found a typo here, it should be,

+			else if (flags & PM_SWAP)

Sorry about that.  Do I need to refresh the patch or you will fix it
inline?

Best Regards,
Huang, Ying

> +				frame += (1 << MAX_SWAPFILES_SHIFT);
>  		}
>  		spin_unlock(ptl);
>  		return err;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ