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: <20210323154053.GF6486@xz-x1>
Date:   Tue, 23 Mar 2021 11:40:53 -0400
From:   Peter Xu <peterx@...hat.com>
To:     Miaohe Lin <linmiaohe@...wei.com>
Cc:     "Kirill A . Shutemov" <kirill@...temov.name>,
        Jerome Glisse <jglisse@...hat.com>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Matthew Wilcox <willy@...radead.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Axel Rasmussen <axelrasmussen@...gle.com>,
        Hugh Dickins <hughd@...gle.com>,
        Nadav Amit <nadav.amit@...il.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Mike Rapoport <rppt@...ux.vnet.ibm.com>,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 02/23] mm: Clear vmf->pte after pte_unmap_same() returns

On Tue, Mar 23, 2021 at 10:34:45AM +0800, Miaohe Lin wrote:
> Hi:
> On 2021/3/23 8:48, Peter Xu wrote:
> > pte_unmap_same() will always unmap the pte pointer.  After the unmap, vmf->pte
> > will not be valid any more.  We should clear it.
> > 
> > It was safe only because no one is accessing vmf->pte after pte_unmap_same()
> > returns, since the only caller of pte_unmap_same() (so far) is do_swap_page(),
> > where vmf->pte will in most cases be overwritten very soon.
> > 
> > pte_unmap_same() will be used in other places in follow up patches, so that
> > vmf->pte will not always be re-written.  This patch enables us to call
> > functions like finish_fault() because that'll conditionally unmap the pte by
> > checking vmf->pte first.  Or, alloc_set_pte() will make sure to allocate a new
> > pte even after calling pte_unmap_same().
> > 
> > Since we'll need to modify vmf->pte, directly pass in vmf into pte_unmap_same()
> > and then we can also avoid the long parameter list.
> > 
> > Signed-off-by: Peter Xu <peterx@...hat.com>
> 
> Good cleanup! Thanks.
> Reviewed-by: Miaohe Lin <linmiaohe@...wei.com>

Just a note that this is not a pure cleanup - the latter patches may start to
depend on the clearing of vmf->pte in their logic.

Thanks for the quick review!

-- 
Peter Xu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ