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:   Mon, 07 Mar 2022 13:21:43 +0800
From:   "Huang, Ying" <ying.huang@...el.com>
To:     Miaohe Lin <linmiaohe@...wei.com>
Cc:     <akpm@...ux-foundation.org>, <mike.kravetz@...cle.com>,
        <shy828301@...il.com>, <willy@...radead.org>, <ziy@...dia.com>,
        <minchan@...nel.org>, <apopple@...dia.com>,
        <ave.hansen@...ux.intel.com>, <o451686892@...il.com>,
        <almasrymina@...gle.com>, <jhubbard@...dia.com>,
        <rcampbell@...dia.com>, <peterx@...hat.com>,
        <naoya.horiguchi@....com>, <mhocko@...e.com>, <riel@...hat.com>,
        <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 15/16] mm/migration: fix possible do_pages_stat_array
 racing with memory offline

Miaohe Lin <linmiaohe@...wei.com> writes:

> When follow_page peeks a page, the page could be reclaimed under heavy
> memory pressure

I don't think that memory pressure and reclaiming will be an issue.

> and thus be offlined while it's still being used by the
> do_pages_stat_array().

"offline" seems a possible problem.

Best Regards,
Huang, Ying

> Use FOLL_GET to hold the page refcnt to fix this
> potential issue.
>
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> ---
>  mm/migrate.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 7b1c0b988234..98a968e6f465 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1788,13 +1788,18 @@ static void do_pages_stat_array(struct mm_struct *mm, unsigned long nr_pages,
>  			goto set_status;
>  
>  		/* FOLL_DUMP to ignore special (like zero) pages */
> -		page = follow_page(vma, addr, FOLL_DUMP);
> +		page = follow_page(vma, addr, FOLL_GET | FOLL_DUMP);
>  
>  		err = PTR_ERR(page);
>  		if (IS_ERR(page))
>  			goto set_status;
>  
> -		err = page ? page_to_nid(page) : -ENOENT;
> +		if (page) {
> +			err = page_to_nid(page);
> +			put_page(page);
> +		} else {
> +			err = -ENOENT;
> +		}
>  set_status:
>  		*status = err;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ