Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755004AbbLAABV (ORCPT ); Mon, 30 Nov 2015 19:01:21 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35770 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753998AbbLAABT (ORCPT ); Mon, 30 Nov 2015 19:01:19 -0500 Date: Mon, 30 Nov 2015 16:01:18 -0800 From: Andrew Morton To: Daniel Cashman , linux-kernel@vger.kernel.org, linux@arm.linux.org.uk, keescook@chromium.org, mingo@kernel.org, linux-arm-kernel@lists.infradead.org, corbet@lwn.net, dzickus@redhat.com, ebiederm@xmission.com, xypron.glpk@gmx.de, jpoimboe@redhat.com, kirill.shutemov@linux.intel.com, n-horiguchi@ah.jp.nec.com, aarcange@redhat.com, mgorman@suse.de, tglx@linutronix.de, rientjes@google.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, salyzyn@android.com, jeffv@google.com, nnk@google.com, catalin.marinas@arm.com, will.deacon@arm.com, hpa@zytor.com, x86@kernel.org, hecmargi@upv.es, bp@suse.de, dcashman@google.com Subject: Re: [PATCH v4 1/4] mm: mmap: Add new /proc tunable for mmap_base ASLR. Message-Id: <20151130160118.e43a2e53a59e347a95a94d5c@linux-foundation.org> In-Reply-To: <20151130155412.b1a087f4f6f4d4180ab4472d@linux-foundation.org> References: <1448578785-17656-1-git-send-email-dcashman@android.com> <1448578785-17656-2-git-send-email-dcashman@android.com> <20151130155412.b1a087f4f6f4d4180ab4472d@linux-foundation.org> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1658 Lines: 41 On Mon, 30 Nov 2015 15:54:12 -0800 Andrew Morton wrote: > On Thu, 26 Nov 2015 14:59:42 -0800 Daniel Cashman wrote: > > > ASLR only uses as few as 8 bits to generate the random offset for the > > mmap base address on 32 bit architectures. This value was chosen to > > prevent a poorly chosen value from dividing the address space in such > > a way as to prevent large allocations. This may not be an issue on all > > platforms. Allow the specification of a minimum number of bits so that > > platforms desiring greater ASLR protection may determine where to place > > the trade-off. > > > > --- a/kernel/sysctl.c > > +++ b/kernel/sysctl.c > > @@ -1568,6 +1568,28 @@ static struct ctl_table vm_table[] = { > > .mode = 0644, > > .proc_handler = proc_doulongvec_minmax, > > }, > > +#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS > > + { > > + .procname = "mmap_rnd_bits", > > + .data = &mmap_rnd_bits, > > + .maxlen = sizeof(mmap_rnd_bits), > > + .mode = 0600, > > + .proc_handler = proc_dointvec_minmax, > > + .extra1 = (void *) &mmap_rnd_bits_min, > > + .extra2 = (void *) &mmap_rnd_bits_max, > > hm, why the typecasts? They're unneeded and are omitted everywhere(?) > else in kernel/sysctl.c. > Oh. Casting away constness. What's the thinking here? They can change at any time so they aren't const so we shouldn't declare them to be const? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/