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] [day] [month] [year] [list]
Message-ID: <CAHbLzkpAEZRTmnOnjVHYHGJ7ApjdC8eDh53DAnTHsG185QGOfQ@mail.gmail.com>
Date:   Wed, 18 Aug 2021 21:32:41 -0700
From:   Yang Shi <shy828301@...il.com>
To:     Naoya Horiguchi <naoya.horiguchi@...ux.dev>
Cc:     Linux MM <linux-mm@...ck.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Tony Luck <tony.luck@...el.com>,
        Oscar Salvador <osalvador@...e.de>,
        Muchun Song <songmuchun@...edance.com>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Michal Hocko <mhocko@...e.com>,
        David Hildenbrand <david@...hat.com>,
        Naoya Horiguchi <naoya.horiguchi@....com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] mm/hwpoison: Retry with shake_page() for unhandlable pages

On Wed, Aug 18, 2021 at 5:20 PM Naoya Horiguchi
<naoya.horiguchi@...ux.dev> wrote:
>
> From: Naoya Horiguchi <naoya.horiguchi@....com>
>
> HWPoisonHandlable() sometimes returns false for typical user pages
> due to races with average memory events like transfers over LRU lists.
> This causes failures in hwpoison handling.
>
> There's retry code for such a case but does not work because the retry
> loop reaches the retry limit too quickly before the page settles down to
> handlable state. Let get_any_page() call shake_page() to fix it.
>
> Fixes: 25182f05ffed ("mm,hwpoison: fix race with hugetlb page allocation")
> Reported-by: Tony Luck <tony.luck@...el.com>
> Signed-off-by: Naoya Horiguchi <naoya.horiguchi@....com>
> Cc: stable@...r.kernel.org # 5.13
> ---
> ChangeLog v2:
> - get_any_page() return -EIO when retry limit reached (by Yang Shi)

Thanks for taking this. The fix looks good to me. Reviewed-by: Yang
Shi <shy828301@...il.com>

> ---
>  mm/memory-failure.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git v5.14-rc6/mm/memory-failure.c v5.14-rc6_patched/mm/memory-failure.c
> index eefd823deb67..470400cc7513 100644
> --- v5.14-rc6/mm/memory-failure.c
> +++ v5.14-rc6_patched/mm/memory-failure.c
> @@ -1146,7 +1146,7 @@ static int __get_hwpoison_page(struct page *page)
>          * unexpected races caused by taking a page refcount.
>          */
>         if (!HWPoisonHandlable(head))
> -               return 0;
> +               return -EBUSY;
>
>         if (PageTransHuge(head)) {
>                 /*
> @@ -1199,9 +1199,15 @@ static int get_any_page(struct page *p, unsigned long flags)
>                         }
>                         goto out;
>                 } else if (ret == -EBUSY) {
> -                       /* We raced with freeing huge page to buddy, retry. */
> -                       if (pass++ < 3)
> +                       /*
> +                        * We raced with (possibly temporary) unhandlable
> +                        * page, retry.
> +                        */
> +                       if (pass++ < 3) {
> +                               shake_page(p, 1);
>                                 goto try_again;
> +                       }
> +                       ret = -EIO;
>                         goto out;
>                 }
>         }
> --
> 2.25.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ