Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752229AbdGDTD2 (ORCPT ); Tue, 4 Jul 2017 15:03:28 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:54021 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752141AbdGDTD1 (ORCPT ); Tue, 4 Jul 2017 15:03:27 -0400 Date: Tue, 4 Jul 2017 21:03:00 +0200 From: Willy Tarreau To: Linus Torvalds Cc: Michal Hocko , Ben Hutchings , Hugh Dickins , Oleg Nesterov , "Jason A. Donenfeld" , Rik van Riel , Larry Woodman , "Kirill A. Shutemov" , Tony Luck , "James E.J. Bottomley" , Helge Diller , James Hogan , Laura Abbott , Greg KH , "security@kernel.org" , linux-distros@vs.openwall.org, Qualys Security Advisory , LKML , Ximin Luo Subject: Re: [PATCH] mm: larger stack guard gap, between vmas Message-ID: <20170704190300.GJ22013@1wt.eu> References: <20170704084122.GC14722@dhcp22.suse.cz> <20170704093538.GF14722@dhcp22.suse.cz> <20170704094728.GB22013@1wt.eu> <20170704104211.GG14722@dhcp22.suse.cz> <20170704113611.GA4732@decadent.org.uk> <20170704155140.GC22013@1wt.eu> <20170704172247.GA6178@dhcp22.suse.cz> <20170704183927.GH22013@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 852 Lines: 21 On Tue, Jul 04, 2017 at 11:47:37AM -0700, Linus Torvalds wrote: > Let's > say that you are using lots of threads, so that you know your stack > space is limited. What you do is to use MAP_FIXED a lot, and you lay > out your stacks fairly densely (with each other, but also possibly > with other mappings), with that PROT_NONE redzoning mapping in between > the "dense" allocations. > > So when the kernel wants to grow the stack, it finds the PROT_NONE > redzone mapping - but there's possibly other maps right under it, so > the stack_guard_gap still hits other mappings. (...) OK I didn't get that use case, that totally makes sense indeed! So now we use PROT_NONE not as something that must be skipped to find the unmapped area but as a hint that the application apparently wants the stack to stop here. Thanks for this clear explanation! Willy