Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755475AbbLABGw (ORCPT ); Mon, 30 Nov 2015 20:06:52 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:50910 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753010AbbLABGu (ORCPT ); Mon, 30 Nov 2015 20:06:50 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: Andrew Morton Cc: Kees Cook , Daniel Cashman , LKML , Russell King - ARM Linux , Ingo Molnar , "linux-arm-kernel\@lists.infradead.org" , Jonathan Corbet , Don Zickus , Heinrich Schuchardt , jpoimboe@redhat.com, "Kirill A. Shutemov" , n-horiguchi@ah.jp.nec.com, Andrea Arcangeli , Mel Gorman , Thomas Gleixner , David Rientjes , Linux-MM , "linux-doc\@vger.kernel.org" , Mark Salyzyn , Jeffrey Vander Stoep , Nick Kralevich , Catalin Marinas , Will Deacon , "H. Peter Anvin" , "x86\@kernel.org" , Hector Marco , Borislav Petkov , Daniel Cashman References: <1448578785-17656-1-git-send-email-dcashman@android.com> <1448578785-17656-2-git-send-email-dcashman@android.com> <20151130155412.b1a087f4f6f4d4180ab4472d@linux-foundation.org> <20151130160118.e43a2e53a59e347a95a94d5c@linux-foundation.org> <20151130161811.592c205d8dc7b00f44066a37@linux-foundation.org> Date: Mon, 30 Nov 2015 18:55:23 -0600 In-Reply-To: <20151130161811.592c205d8dc7b00f44066a37@linux-foundation.org> (Andrew Morton's message of "Mon, 30 Nov 2015 16:18:11 -0800") Message-ID: <87610jugw4.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX18N9GDow4DKXT+q3BjsxHwOqrPGIxbTx6I= X-SA-Exim-Connect-IP: 70.59.167.217 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Andrew Morton X-Spam-Relay-Country: X-Spam-Timing: total 493 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.6 (0.7%), b_tie_ro: 2.6 (0.5%), parse: 0.77 (0.2%), extract_message_metadata: 17 (3.4%), get_uri_detail_list: 1.78 (0.4%), tests_pri_-1000: 7 (1.5%), tests_pri_-950: 1.22 (0.2%), tests_pri_-900: 1.06 (0.2%), tests_pri_-400: 29 (6.0%), check_bayes: 28 (5.7%), b_tokenize: 10 (2.0%), b_tok_get_all: 8 (1.7%), b_comp_prob: 2.4 (0.5%), b_tok_touch_all: 4.6 (0.9%), b_finish: 0.75 (0.2%), tests_pri_0: 252 (51.1%), tests_pri_500: 178 (36.1%), poll_dns_idle: 167 (33.9%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v4 1/4] mm: mmap: Add new /proc tunable for mmap_base ASLR. X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2547 Lines: 72 Andrew Morton writes: > On Mon, 30 Nov 2015 16:04:36 -0800 Kees Cook wrote: > >> >> > +#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? >> >> The _min and _max values shouldn't be changing: they're decided based >> on the various CONFIG options that calculate the valid min/maxes. Only >> mmap_rnd_bits itself should be changing. > > hmpf. > > From: Andrew Morton > Subject: include/linux/sysctl.h: make ctl_table.extra1/2 const > > Nothing should be altering these values. Declare the pointed-to values to > be const so we can actually use const values. No large objects except we do seem to have values that are stashed in extra1 that are cast to non-const types. Any chance you will do the work to hunt all of those down and modify the casts to preserve const or to remove the casts entirely? Eric > Cc: Kees Cook > Cc: Daniel Cashman > Signed-off-by: Andrew Morton > --- > > include/linux/sysctl.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff -puN include/linux/sysctl.h~a include/linux/sysctl.h > --- a/include/linux/sysctl.h~a > +++ a/include/linux/sysctl.h > @@ -111,8 +111,8 @@ struct ctl_table > struct ctl_table *child; /* Deprecated */ > proc_handler *proc_handler; /* Callback for text formatting */ > struct ctl_table_poll *poll; > - void *extra1; > - void *extra2; > + const void *extra1; > + const void *extra2; > }; > > struct ctl_node { > diff -puN kernel/sysctl.c~a kernel/sysctl.c > _ -- 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/