From patchwork Wed Apr 13 03:57:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 989 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:48:04 -0000 Delivered-To: patches@linaro.org Received: by 10.68.59.138 with SMTP id z10cs267594pbq; Tue, 12 Apr 2011 20:57:22 -0700 (PDT) Received: by 10.52.66.173 with SMTP id g13mr4953803vdt.273.1302667041858; Tue, 12 Apr 2011 20:57:21 -0700 (PDT) Received: from mail-qy0-f171.google.com (mail-qy0-f171.google.com [209.85.216.171]) by mx.google.com with ESMTPS id o20si93454vdt.98.2011.04.12.20.57.20 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Apr 2011 20:57:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.216.171 is neither permitted nor denied by best guess record for domain of nicolas.pitre@linaro.org) client-ip=209.85.216.171; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.216.171 is neither permitted nor denied by best guess record for domain of nicolas.pitre@linaro.org) smtp.mail=nicolas.pitre@linaro.org Received: by qyj19 with SMTP id 19so2704773qyj.16 for ; Tue, 12 Apr 2011 20:57:20 -0700 (PDT) Received: by 10.224.211.200 with SMTP id gp8mr6114664qab.76.1302667039978; Tue, 12 Apr 2011 20:57:19 -0700 (PDT) Received: from xanadu.home (modemcable092.28-130-66.mc.videotron.ca [66.130.28.92]) by mx.google.com with ESMTPS id f5sm117036qck.44.2011.04.12.20.57.18 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Apr 2011 20:57:18 -0700 (PDT) Date: Tue, 12 Apr 2011 23:57:17 -0400 (EDT) From: Nicolas Pitre X-X-Sender: nico@xanadu.home To: patches@arm.linux.org.uk cc: patches@linaro.org Subject: 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 PATCH FOLLOWS KernelVersion: v2.6.39-rc1 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: