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: <20170208120421.GE5578@node.shutemov.name>
Date:   Wed, 8 Feb 2017 15:04:21 +0300
From:   "Kirill A. Shutemov" <kirill@...temov.name>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Mel Gorman <mgorman@...hsingularity.net>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mprotect: drop overprotective lock_pte_protection()

On Tue, Feb 07, 2017 at 01:44:54PM -0800, Andrew Morton wrote:
> On Tue,  7 Feb 2017 17:33:47 +0300 "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com> wrote:
> 
> > lock_pte_protection() uses pmd_lock() to make sure that we have stable
> > PTE page table before walking pte range.
> > 
> > That's not necessary. We only need to make sure that PTE page table is
> > established. It cannot vanish under us as long as we hold mmap_sem at
> > least for read.
> > 
> > And we already have helper for that -- pmd_trans_unstable().
> 
> http://ozlabs.org/~akpm/mmots/broken-out/mm-mprotect-use-pmd_trans_unstable-instead-of-taking-the-pmd_lock.patch
> already did this?

Right. Except, it doesn't drop unneeded pmd_trans_unstable(pmd) check after
__split_huge_pmd().

Could you fold this part of my patch into Andrea's?

diff --git a/mm/mprotect.c b/mm/mprotect.c
index f9c07f54dd62..e919e4613eab 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -177,8 +149,6 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
 		if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) {
 			if (next - addr != HPAGE_PMD_SIZE) {
 				__split_huge_pmd(vma, pmd, addr, false, NULL);
-				if (pmd_trans_unstable(pmd))
-					continue;
 			} else {
 				int nr_ptes = change_huge_pmd(vma, pmd, addr,
 						newprot, prot_numa);
-- 
 Kirill A. Shutemov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ