From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bk0-x229.google.com (mail-bk0-x229.google.com [IPv6:2a00:1450:4008:c01::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 2ED222C00C8 for ; Thu, 26 Sep 2013 03:44:46 +1000 (EST) Received: by mail-bk0-f41.google.com with SMTP id na10so14bkb.0 for ; Wed, 25 Sep 2013 10:44:41 -0700 (PDT) Sender: Ingo Molnar Date: Wed, 25 Sep 2013 19:44:36 +0200 From: Ingo Molnar To: Timothy Pepper Subject: Re: mm: insure topdown mmap chooses addresses above security minimum Message-ID: <20130925174436.GA14037@gmail.com> References: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.intel.com> <20130925073048.GB27960@gmail.com> <20130925171243.GA7428@tcpepper-desk.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20130925171243.GA7428@tcpepper-desk.jf.intel.com> Cc: linux-mips@linux-mips.org, linux-sh@vger.kernel.org, linux-mm@kvack.org, Paul Mackerras , "H. Peter Anvin" , sparclinux@vger.kernel.org, Michel Lespinasse , Russell King , x86@kernel.org, Ingo Molnar , Rik van Riel , Al Viro , James Morris , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Ralf Baechle , Paul Mundt , Andrew Morton , Linus Torvalds , "David S. Miller" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , * Timothy Pepper wrote: > On Wed 25 Sep at 09:30:49 +0200 mingo@kernel.org said: > > > info.flags = VM_UNMAPPED_AREA_TOPDOWN; > > > info.length = len; > > > - info.low_limit = PAGE_SIZE; > > > + info.low_limit = max(PAGE_SIZE, PAGE_ALIGN(mmap_min_addr)); > > > info.high_limit = mm->mmap_base; > > > info.align_mask = filp ? get_align_mask() : 0; > > > info.align_offset = pgoff << PAGE_SHIFT; > > > > There appears to be a lot of repetition in these methods - instead of > > changing 6 places it would be more future-proof to first factor out the > > common bits and then to apply the fix to the shared implementation. > > Besides that existing redundancy in the multiple somewhat similar > arch_get_unmapped_area_topdown() functions, I was expecting people might > question the added redundancy of the six instances of: > > max(PAGE_SIZE, PAGE_ALIGN(mmap_min_addr)); That redundancy would be automatically addressed by my suggestion. Thanks, Ingo