From patchwork Fri Apr 8 02:51:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 934 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:47:32 -0000 Delivered-To: patches@linaro.org Received: by 10.68.52.132 with SMTP id t4cs133959pbo; Thu, 7 Apr 2011 19:51:38 -0700 (PDT) Received: by 10.220.62.8 with SMTP id v8mr462591vch.9.1302231097714; Thu, 07 Apr 2011 19:51:37 -0700 (PDT) Received: from mail-vw0-f50.google.com (mail-vw0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id b8si2513226vcm.16.2011.04.07.19.51.35 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 07 Apr 2011 19:51:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of nicolas.pitre@linaro.org) client-ip=209.85.212.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of nicolas.pitre@linaro.org) smtp.mail=nicolas.pitre@linaro.org Received: by vws14 with SMTP id 14so2994982vws.37 for ; Thu, 07 Apr 2011 19:51:35 -0700 (PDT) Received: by 10.52.92.226 with SMTP id cp2mr2461375vdb.220.1302231095482; Thu, 07 Apr 2011 19:51:35 -0700 (PDT) Received: from xanadu.home (modemcable092.28-130-66.mc.videotron.ca [66.130.28.92]) by mx.google.com with ESMTPS id bl3sm575343vdc.5.2011.04.07.19.51.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 07 Apr 2011 19:51:34 -0700 (PDT) Date: Thu, 7 Apr 2011 22:51:32 -0400 (EDT) From: Nicolas Pitre X-X-Sender: nico@xanadu.home To: linux-arm-kernel@lists.infradead.org cc: patches@linaro.org Subject: [PATCH 1/2] ARM: the ADDR_NO_RANDOMIZE personality flag should be honored with mmap() Message-ID: User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 Signed-off-by: Nicolas Pitre --- arch/arm/mm/mmap.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index afe209e..74be05f 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -82,7 +83,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, mm->cached_hole_size = 0; } /* 8 bits of randomness in 20 address space bits */ - if (current->flags & PF_RANDOMIZE) + if ((current->flags & PF_RANDOMIZE) && + !(current->personality & ADDR_NO_RANDOMIZE)) addr += (get_random_int() % (1 << 8)) << PAGE_SHIFT; full_search: