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: <20220429003841.cx7uenepca22qbdl@revolver>
Date:   Fri, 29 Apr 2022 00:38:50 +0000
From:   Liam Howlett <liam.howlett@...cle.com>
To:     Guenter Roeck <linux@...ck-us.net>
CC:     "maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Yu Zhao <yuzhao@...gle.com>
Subject: Re: [PATCH v8 23/70] mm/mmap: change do_brk_flags() to expand
 existing VMA and add do_brk_munmap()

* Guenter Roeck <linux@...ck-us.net> [220428 16:19]:
> On Tue, Apr 26, 2022 at 03:06:35PM +0000, Liam Howlett wrote:
> > From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
> > 
> > Avoid allocating a new VMA when it a vma modification can occur.  When a
> > brk() can expand or contract a VMA, then the single store operation will
> > only modify one index of the maple tree instead of causing a node to split
> > or coalesce.  This avoids unnecessary allocations/frees of maple tree
> > nodes and VMAs.
> > 
> > Move some limit & flag verifications out of the do_brk_flags() function to
> > use only relevant checks in the code path of bkr() and vm_brk_flags().
> > 
> > Set the vma to check if it can expand in vm_brk_flags() if extra criteria
> > are met.
> > 
> > Drop userfaultfd from do_brk_flags() path and only use it in
> > vm_brk_flags() path since that is the only place a munmap will happen.
> > 
> > Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
> 
> A build failure seen when building ppc64:corenet64_smp_defconfig also
> biscects to this patch.
> 
> mm/mmap.c: In function 'do_brk_flags':
> mm/mmap.c:2908:17: error: implicit declaration of function
> 	'khugepaged_enter_vma_merge'; did you mean 'khugepaged_enter_vma'?
> 
> It appears that this is later fixed, but it hurts bisectability
> (and prevents me from finding the actual build failure in linux-next
> when trying to build corenet64_smp_defconfig).

Yeah, that khugepaged_enter_vma_merge was renamed in another patch set.
Andrew made the correction but kept the patch as it was.  I think the
suggested change is right.. if you read the commit that introduced
khugepaged_enter_vma(), it seems right at least.

> 
> While looking into the patch, I noticed the following.
> 
> [ ... ]
> 
> > @@ -2773,30 +2888,52 @@ static int do_brk_flags(unsigned long addr, unsigned long len,
> >  	if (security_vm_enough_memory_mm(mm, len >> PAGE_SHIFT))
> >  		return -ENOMEM;
> >  
> >  out:
> >  	perf_event_mmap(vma);
> >  	mm->total_vm += len >> PAGE_SHIFT;
> > @@ -2807,18 +2944,21 @@ static int do_brk_flags(unsigned long addr, unsigned long len,
> >  	validate_mm_mt(mm);
> >  	return 0;
> >  
> > -no_vma_link:
> >  	vm_area_free(vma);
> 
> That really looks wrong. vm_area_free(vma) can not be reached
> after this patch has been applied.

This came up elsewhere too, Thanks.  This shouldn't cause an issue
unless you OOM though.

> 
> Guenter
> 
> > +vma_alloc_fail:
> > +	vm_unacct_memory(len >> PAGE_SHIFT);
> >  	return -ENOMEM;
> >  }
> >  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ