[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1499275472.2707.44.camel@decadent.org.uk>
Date: Wed, 05 Jul 2017 18:24:32 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: Michal Hocko <mhocko@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Willy Tarreau <w@....eu>, Hugh Dickins <hughd@...gle.com>,
Oleg Nesterov <oleg@...hat.com>,
"Jason A. Donenfeld" <Jason@...c4.com>,
Rik van Riel <riel@...hat.com>,
Larry Woodman <lwoodman@...hat.com>,
"Kirill A. Shutemov" <kirill@...temov.name>,
Tony Luck <tony.luck@...el.com>,
"James E.J. Bottomley" <jejb@...isc-linux.org>,
Helge Diller <deller@....de>,
James Hogan <james.hogan@...tec.com>,
Laura Abbott <labbott@...hat.com>, Greg KH <greg@...ah.com>,
"security@...nel.org" <security@...nel.org>,
Qualys Security Advisory <qsa@...lys.com>,
LKML <linux-kernel@...r.kernel.org>,
Ximin Luo <infinity0@...ian.org>
Subject: Re: [PATCH] mm: larger stack guard gap, between vmas
On Wed, 2017-07-05 at 19:05 +0200, Michal Hocko wrote:
> On Wed 05-07-17 17:58:45, Ben Hutchings wrote:
> [...]
> > diff --git a/mm/mmap.c b/mm/mmap.c
> > index c7906ae1a7a1..f8131a94e56e 100644
> > --- a/mm/mmap.c
> > +++ b/mm/mmap.c
> > @@ -2307,6 +2307,25 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address)
> > }
> > #endif /* CONFIG_STACK_GROWSUP || CONFIG_IA64 */
> >
> > +unsigned long __vm_start_gap(struct vm_area_struct *vma)
> > +{
> > + unsigned long stack_limit =
> > + current->signal->rlim[RLIMIT_STACK].rlim_cur;
> > + unsigned long vm_start;
> > +
> > + if (stack_limit != RLIM_INFINITY &&
> > + vma->vm_end - vma->vm_start < stack_limit)
> > + vm_start = vma->vm_end - PAGE_ALIGN(stack_limit);
>
> This is exactly what I was worried about in my previous email. Say
> somebody sets stack ulimit to 1G or so. Should we reduce the available
> address space that much?
It's not ideal, but why would someone set the stack limit that high
unless it's for an application that will actually use most of that
stack space? Do you think that "increase the stack limit" has been
cargo-culted?
> Say you are 32b and you have an application
> with multiple stacks each doing its MAP_GROWSDOWN.
[...]
So this application is using dietlibc or uclibc? glibc uses fixed-size
mappings for new threads.
I suppose there's a risk that by doing this we would mamke
MAP_GROWSDOWN useful enough that it is more likely to be used for new
thread stacks in future.
Ben.
--
Ben Hutchings
Anthony's Law of Force: Don't force it, get a larger hammer.
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists