From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Date: Wed, 25 Sep 2013 17:44:36 +0000 Subject: Re: mm: insure topdown mmap chooses addresses above security minimum Message-Id: <20130925174436.GA14037@gmail.com> List-Id: References: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.intel.com> <20130925073048.GB27960@gmail.com> <20130925171243.GA7428@tcpepper-desk.jf.intel.com> In-Reply-To: <20130925171243.GA7428@tcpepper-desk.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-arm-kernel@lists.infradead.org * 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 25 Sep 2013 19:44:53 +0200 (CEST) Received: from mail-bk0-f51.google.com ([209.85.214.51]:45887 "EHLO mail-bk0-f51.google.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S6816233Ab3IYRorS37r6 (ORCPT ); Wed, 25 Sep 2013 19:44:47 +0200 Received: by mail-bk0-f51.google.com with SMTP id mx10so2374072bkb.24 for ; Wed, 25 Sep 2013 10:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=hbA9GP+zgR0e+o9LIr0jlfpUvN0pdtY+EHjqI0S8zzY=; b=Ntv+8fl1l4t5x7aLSIbpo1ZFXCQ9RG757rjAFXPwMyvP57D0cn/9bFuzsk7yAbzQA0 BhnHAThfwq0YWRAA2srFtRIn/8SSSUjFGRV8m2Y1LQjh8XTRu6MuiH4Wz06InIhzR9aU DZafmmyHaVEWyjQYnDpvqtqfufigAL6FumM2FwDRup89srhsHn8RxL/HijgBBUNlEgBs aRw8ZIHWsurjzph8S0h/tHaqk5H/A9WlOxrc7jZG9MCPpRfNKvqRn5QwPtdj9ubrmhu4 2MDn89oWZi8bSM2uVG5RlvI3W5kfejBpIpQmjKs8IqiQkQhbe/PqPPCfgvBIuxHXxpvA isLw== X-Received: by 10.205.35.15 with SMTP id su15mr28728498bkb.21.1380131081871; Wed, 25 Sep 2013 10:44:41 -0700 (PDT) Received: from gmail.com (BC24D856.catv.pool.telekom.hu. [188.36.216.86]) by mx.google.com with ESMTPSA id kk2sm14928985bkb.10.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 25 Sep 2013 10:44:39 -0700 (PDT) Date: Wed, 25 Sep 2013 19:44:36 +0200 From: Ingo Molnar To: Timothy Pepper Cc: linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Russell King , linux-arm-kernel@lists.infradead.org, Ralf Baechle , linux-mips@linux-mips.org, Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, Paul Mundt , linux-sh@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org, Andrew Morton , Linus Torvalds , Al Viro , James Morris , Michel Lespinasse , Rik van Riel 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 Content-Disposition: inline In-Reply-To: <20130925171243.GA7428@tcpepper-desk.jf.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 37975 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: mingo@kernel.org Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips * 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by kanga.kvack.org (Postfix) with ESMTP id 1E1676B0033 for ; Wed, 25 Sep 2013 13:44:46 -0400 (EDT) Received: by mail-pd0-f177.google.com with SMTP id y10so6323550pdj.8 for ; Wed, 25 Sep 2013 10:44:45 -0700 (PDT) Received: by mail-bk0-f44.google.com with SMTP id mz10so13bkb.3 for ; Wed, 25 Sep 2013 10:44:42 -0700 (PDT) Date: Wed, 25 Sep 2013 19:44:36 +0200 From: Ingo Molnar 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 Content-Disposition: inline In-Reply-To: <20130925171243.GA7428@tcpepper-desk.jf.intel.com> Sender: owner-linux-mm@kvack.org List-ID: To: Timothy Pepper Cc: linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Russell King , linux-arm-kernel@lists.infradead.org, Ralf Baechle , linux-mips@linux-mips.org, Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, Paul Mundt , linux-sh@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org, Andrew Morton , Linus Torvalds , Al Viro , James Morris , Michel Lespinasse , Rik van Riel * 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 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: mingo@kernel.org (Ingo Molnar) Date: Wed, 25 Sep 2013 19:44:36 +0200 Subject: mm: insure topdown mmap chooses addresses above security minimum In-Reply-To: <20130925171243.GA7428@tcpepper-desk.jf.intel.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> Message-ID: <20130925174436.GA14037@gmail.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org * Timothy Pepper wrote: > On Wed 25 Sep at 09:30:49 +0200 mingo at 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