Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752627AbdGFIYn (ORCPT ); Thu, 6 Jul 2017 04:24:43 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:32839 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752447AbdGFIYi (ORCPT ); Thu, 6 Jul 2017 04:24:38 -0400 Date: Thu, 6 Jul 2017 10:24:06 +0200 From: Willy Tarreau To: Linus Torvalds Cc: Ben Hutchings , Michal Hocko , 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" , Qualys Security Advisory , LKML , Ximin Luo Subject: Re: [PATCH] mm: larger stack guard gap, between vmas Message-ID: <20170706082406.GA25812@1wt.eu> References: <20170704113611.GA4732@decadent.org.uk> <1499209315.2707.29.camel@decadent.org.uk> <1499257180.2707.34.camel@decadent.org.uk> <20170705142354.GB21220@dhcp22.suse.cz> <1499268300.2707.41.camel@decadent.org.uk> <20170705165845.GB4732@decadent.org.uk> <1499297724.2707.56.camel@decadent.org.uk> 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: 1119 Lines: 23 On Wed, Jul 05, 2017 at 04:51:06PM -0700, Linus Torvalds wrote: > On Wed, Jul 5, 2017 at 4:35 PM, Ben Hutchings wrote: > >> > >> And I think your second patch breaks that "use a really large value to > >> approximate infinity" case that definitely has existed as a pattern. > > > > Right. Well that seems to leave us with remembering the MAP_FIXED flag > > and using that as the condition to ignore the previous mapping. > > I'm not particularly happy about having a MAP_FIXED special case, but > yeah, I'm not seeing a lot of alternatives. We can possibly refine it like this : - use PROT_NONE as a mark for the end of the stack and consider the application doing this knows exactly what it's doing ; - use other MAP_FIXED as a limit for a shorter gap (ie 4kB), considering that 1) it used to work like this for many years, and 2) if an application is forcing a MAP_FIXED just below the stack and at the same time uses large alloca() or VLA it's definitely bogus and looking for unfixable trouble. Not allowing this means we break existing applications anyway. Willy