From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell King - ARM Linux Date: Tue, 24 Sep 2013 21:28:53 +0000 Subject: Re: mm: insure topdown mmap chooses addresses above security minimum Message-Id: <20130924212853.GK12758@n2100.arm.linux.org.uk> List-Id: References: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.intel.com> In-Reply-To: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-arm-kernel@lists.infradead.org On Tue, Sep 24, 2013 at 02:23:31PM -0700, Timothy Pepper wrote: > diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c > index 0c63562..0e7355d 100644 > --- a/arch/arm/mm/mmap.c > +++ b/arch/arm/mm/mmap.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include > > #define COLOUR_ALIGN(addr,pgoff) \ > @@ -146,7 +147,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, > > 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 = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0; > info.align_offset = pgoff << PAGE_SHIFT; This looks sane for ARM. Acked-by: Russell King Thanks. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 24 Sep 2013 23:35:20 +0200 (CEST) Received: from caramon.arm.linux.org.uk ([78.32.30.218]:33129 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S6824811Ab3IXVfTEXZq4 (ORCPT ); Tue, 24 Sep 2013 23:35:19 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=efjon2CfsIn50qeKrPUl9XKs3kBqPAJQVSljeF6gFMM=; b=bsQNh8TsJi8G7Kgv0vEZlO1XEi7dGadhvs7Jrd7HNNIrtlBI0H5fp1oM4GiFlHH4ipnus55zLIVRkYanRrqJBGJSnTMI329ey/PuFYA/wGulB8CSSt95StM6yCBfSx9KrTkuPRPKTUlIl3f/CGRd2COOZeZSqvxrwgiuxQl6NFI=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:41357) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1VOaAB-0005M8-Nm; Tue, 24 Sep 2013 22:28:56 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1VOaAA-0006UF-1A; Tue, 24 Sep 2013 22:28:54 +0100 Date: Tue, 24 Sep 2013 22:28:53 +0100 From: Russell King - ARM Linux To: Timothy Pepper Cc: linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, 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 Subject: Re: mm: insure topdown mmap chooses addresses above security minimum Message-ID: <20130924212853.GK12758@n2100.arm.linux.org.uk> References: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.intel.com> User-Agent: Mutt/1.5.19 (2009-01-05) 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: 37940 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: linux@arm.linux.org.uk 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 On Tue, Sep 24, 2013 at 02:23:31PM -0700, Timothy Pepper wrote: > diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c > index 0c63562..0e7355d 100644 > --- a/arch/arm/mm/mmap.c > +++ b/arch/arm/mm/mmap.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include > > #define COLOUR_ALIGN(addr,pgoff) \ > @@ -146,7 +147,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, > > 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 = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0; > info.align_offset = pgoff << PAGE_SHIFT; This looks sane for ARM. Acked-by: Russell King Thanks. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by kanga.kvack.org (Postfix) with ESMTP id 027766B0031 for ; Tue, 24 Sep 2013 17:29:24 -0400 (EDT) Received: by mail-pd0-f176.google.com with SMTP id q10so5120048pdj.21 for ; Tue, 24 Sep 2013 14:29:24 -0700 (PDT) Date: Tue, 24 Sep 2013 22:28:53 +0100 From: Russell King - ARM Linux Subject: Re: mm: insure topdown mmap chooses addresses above security minimum Message-ID: <20130924212853.GK12758@n2100.arm.linux.org.uk> References: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.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, 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 On Tue, Sep 24, 2013 at 02:23:31PM -0700, Timothy Pepper wrote: > diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c > index 0c63562..0e7355d 100644 > --- a/arch/arm/mm/mmap.c > +++ b/arch/arm/mm/mmap.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include > > #define COLOUR_ALIGN(addr,pgoff) \ > @@ -146,7 +147,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, > > 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 = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0; > info.align_offset = pgoff << PAGE_SHIFT; This looks sane for ARM. Acked-by: Russell King Thanks. -- 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 caramon.arm.linux.org.uk (caramon.arm.linux.org.uk [IPv6:2002:4e20:1eda::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3249D2C00CF for ; Wed, 25 Sep 2013 07:35:40 +1000 (EST) Date: Tue, 24 Sep 2013 22:28:53 +0100 From: Russell King - ARM Linux To: Timothy Pepper Subject: Re: mm: insure topdown mmap chooses addresses above security minimum Message-ID: <20130924212853.GK12758@n2100.arm.linux.org.uk> References: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.intel.com> Sender: Russell King - ARM Linux Cc: linux-mips@linux-mips.org, Paul Mundt , linux-sh@vger.kernel.org, x86@kernel.org, Ralf Baechle , linux-mm@kvack.org, Ingo Molnar , Paul Mackerras , "H. Peter Anvin" , sparclinux@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, "David S. Miller" , linux-arm-kernel@lists.infradead.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Tue, Sep 24, 2013 at 02:23:31PM -0700, Timothy Pepper wrote: > diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c > index 0c63562..0e7355d 100644 > --- a/arch/arm/mm/mmap.c > +++ b/arch/arm/mm/mmap.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include > > #define COLOUR_ALIGN(addr,pgoff) \ > @@ -146,7 +147,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, > > 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 = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0; > info.align_offset = pgoff << PAGE_SHIFT; This looks sane for ARM. Acked-by: Russell King Thanks. From mboxrd@z Thu Jan 1 00:00:00 1970 From: linux@arm.linux.org.uk (Russell King - ARM Linux) Date: Tue, 24 Sep 2013 22:28:53 +0100 Subject: mm: insure topdown mmap chooses addresses above security minimum In-Reply-To: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.intel.com> References: <1380057811-5352-1-git-send-email-timothy.c.pepper@linux.intel.com> Message-ID: <20130924212853.GK12758@n2100.arm.linux.org.uk> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tue, Sep 24, 2013 at 02:23:31PM -0700, Timothy Pepper wrote: > diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c > index 0c63562..0e7355d 100644 > --- a/arch/arm/mm/mmap.c > +++ b/arch/arm/mm/mmap.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include > > #define COLOUR_ALIGN(addr,pgoff) \ > @@ -146,7 +147,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, > > 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 = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0; > info.align_offset = pgoff << PAGE_SHIFT; This looks sane for ARM. Acked-by: Russell King Thanks.