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: <20121116182005.GA18394@otc-wbsnb-06>
Date:	Fri, 16 Nov 2012 20:20:05 +0200
From:	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To:	David Rientjes <rientjes@...gle.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Andrea Arcangeli <aarcange@...hat.com>, linux-mm@...ck.org,
	Andi Kleen <ak@...ux.intel.com>,
	"H. Peter Anvin" <hpa@...ux.intel.com>,
	linux-kernel@...r.kernel.org,
	"Kirill A. Shutemov" <kirill@...temov.name>
Subject: Re: [PATCH v5 08/11] thp: setup huge zero page on non-write page
 fault

On Thu, Nov 15, 2012 at 01:52:44PM -0800, David Rientjes wrote:
> On Thu, 15 Nov 2012, Kirill A. Shutemov wrote:
> 
> > > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> > > > index f36bc7d..41f05f1 100644
> > > > --- a/mm/huge_memory.c
> > > > +++ b/mm/huge_memory.c
> > > > @@ -726,6 +726,16 @@ int do_huge_pmd_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
> > > >  			return VM_FAULT_OOM;
> > > >  		if (unlikely(khugepaged_enter(vma)))
> > > >  			return VM_FAULT_OOM;
> > > > +		if (!(flags & FAULT_FLAG_WRITE)) {
> > > > +			pgtable_t pgtable;
> > > > +			pgtable = pte_alloc_one(mm, haddr);
> > > > +			if (unlikely(!pgtable))
> > > > +				goto out;
> > > 
> > > No use in retrying, just return VM_FAULT_OOM.
> > 
> > Hm. It's consistent with non-hzp path: if pte_alloc_one() in
> > __do_huge_pmd_anonymous_page() fails __do_huge_pmd_anonymous_page()
> > returns VM_FAULT_OOM which leads to "goto out".
> > 
> 
> If the pte_alloc_one(), which wraps __pte_alloc(), you're adding fails, 
> it's pointless to "goto out" to try __pte_alloc() which we know won't 
> succeed.
> 
> > Should it be fixed too?
> > 
> 
> It's done for maintainablility because although 
> __do_huge_pmd_anonymous_page() will only return VM_FAULT_OOM today when 
> pte_alloc_one() fails, if it were to ever fail in a different way then the 
> caller is already has a graceful failure.

Okay, here's fixlet. Andrew, please squash it to the patch 08/11.

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 1f6c6de..d7ab890 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -793,7 +793,7 @@ int do_huge_pmd_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
 			unsigned long zero_pfn;
 			pgtable = pte_alloc_one(mm, haddr);
 			if (unlikely(!pgtable))
-				goto out;
+				return VM_FAULT_OOM;
 			zero_pfn = get_huge_zero_page();
 			if (unlikely(!zero_pfn)) {
 				pte_free(mm, pgtable);
-- 
 Kirill A. Shutemov

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ