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:   Tue, 6 Sep 2022 14:27:48 -0700
From:   John Hubbard <jhubbard@...dia.com>
To:     Yang Shi <shy828301@...il.com>
Cc:     david@...hat.com, peterx@...hat.com,
        kirill.shutemov@...ux.intel.com, jgg@...dia.com, hughd@...gle.com,
        akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: gup: fix the fast GUP race against THP collapse

On 9/6/22 11:50, Yang Shi wrote:
>>> -             if (unlikely(pte_val(pte) != pte_val(*ptep))) {
>>> +             /*
>>> +              * THP collapse conceptually does:
>>> +              *   1. Clear and flush PMD
>>> +              *   2. Check the base page refcount
>>> +              *   3. Copy data to huge page
>>> +              *   4. Clear PTE
>>> +              *   5. Discard the base page
>>> +              *
>>> +              * So fast GUP may race with THP collapse then pin and
>>> +              * return an old page since TLB flush is no longer sufficient
>>> +              * to serialize against fast GUP.
>>> +              *
>>> +              * Check PMD, if it is changed just back off since it
>>> +              * means there may be parallel THP collapse.
>>> +              */
>>
>> As I mentioned in the other thread, it would be a nice touch to move
>> such discussion into the comment header.
> 
> Sure, you mean the comment before gup_pte_range() so that the real
> code stays succinct, right?
Yes.

thanks,

-- 
John Hubbard
NVIDIA

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ