Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753234AbbKAV6z (ORCPT ); Sun, 1 Nov 2015 16:58:55 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:33925 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753127AbbKAV6r (ORCPT ); Sun, 1 Nov 2015 16:58:47 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: Daniel Cashman Cc: Jeffrey Vander Stoep , linux-kernel@vger.kernel.org, linux@arm.linux.org.uk, Andrew Morton , Kees Cook , mingo@kernel.org, linux-arm-kernel@lists.infradead.org, Jonathan Corbet , dzickus@redhat.com, xypron.glpk@gmx.de, jpoimboe@redhat.com, kirill.shutemov@linux.intel.com, n-horiguchi@ah.jp.nec.com, aarcange@redhat.com, Mel Gorman , tglx@linutronix.de, rientjes@google.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, Mark Salyzyn , Nick Kralevich , dcashman References: <1446067520-31806-1-git-send-email-dcashman@android.com> <871tcewoso.fsf@x220.int.ebiederm.org> <87oafiuys0.fsf@x220.int.ebiederm.org> <56329880.4080103@android.com> Date: Sun, 01 Nov 2015 15:50:17 -0600 In-Reply-To: <56329880.4080103@android.com> (Daniel Cashman's message of "Thu, 29 Oct 2015 15:06:56 -0700") Message-ID: <87k2q1tmna.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: U2FsdGVkX1+0iR9ulxVh6RAgxNCnWEQRGCCnbh6aKDw= X-SA-Exim-Connect-IP: 67.3.201.231 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 * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: T_TM2_M_HEADER_IN_MSG * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa03 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Daniel Cashman X-Spam-Relay-Country: X-Spam-Timing: total 1439 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 5 (0.3%), parse: 1.44 (0.1%), extract_message_metadata: 10 (0.7%), get_uri_detail_list: 4 (0.3%), tests_pri_-1000: 9 (0.6%), tests_pri_-950: 2 (0.1%), tests_pri_-900: 1.64 (0.1%), tests_pri_-400: 46 (3.2%), check_bayes: 44 (3.0%), tests_pri_0: 1352 (93.9%), tests_pri_500: 8 (0.5%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 1/2] 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 in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3321 Lines: 71 Daniel Cashman writes: > On 10/28/2015 08:41 PM, Eric W. Biederman wrote: >> Dan Cashman writes: >> >>>>> This all would be much cleaner if the arm architecture code were just to >>>>> register the sysctl itself. >>>>> >>>>> As it sits this looks like a patchset that does not meaninfully bisect, >>>>> and would result in code that is hard to trace and understand. >>>> >>>> I believe the intent is to follow up with more architecture specific >>>> patches to allow each architecture to define the number of bits to use >>> >>> Yes. I included these patches together because they provide mutual >>> context, but each has a different outcome and they could be taken >>> separately. >> >> They can not. The first patch is incomplete by itself. > > Could you be more specific in what makes the first patch incomplete? Is > it because it is essentially a no-op without additional architecture > changes (e.g. the second patch) or is it specifically because it > introduces and uses the three "mmap_rnd_bits*" variables without > defining them? If the former, I'd like to avoid combining the general > procfs change with any architecture-specific one(s). If the latter, I > hope the proposal below addresses that. A bit of both. The fact that the code can not compile in the first patch because of missing variables is distressing. Having the arch specific code as a separate patch is fine, but they need to remain in the same patchset. >>> The arm architecture-specific portion allows the changing >>> of the number of bits used for mmap ASLR, useful even without the >>> sysctl. The sysctl patch (patch 1) provides another way of setting >>> this value, and the hope is that this will be adopted across multiple >>> architectures, with the arm changes (patch 2) providing an example. I >>> hope to follow this with changes to arm64 and x86, for example. >> >> If you want to make the code generic. Please maximize the sharing. >> That is please define the variables in a generic location, as well >> as the Kconfig variables (if possible). >> >> As it is you have an architecture specific piece of code that can not be >> reused without duplicating code, and that is just begging for problems. > > I think it would make sense to move the variable definitions into > mm/mmap.c, included conditionally based on the presence of > CONFIG_ARCH_MMAP_RND_BITS. > > As for the Kconfigs, I am open to suggestions. I considered declaring > and documenting ARCH_MMAP_RND_BITS in arch/Kconfig, but I would like it > to be bounded in range by the _MIN and _MAX values, which necessarily > must be defined in the arch-specific Kconfigs. Thus, we'd have > ARCH_MMAP_RND_BITS declared in arch/Kconfig as it currently is in > arch/arm/Kconfig defaulting to _MIN, and would declare both the _MIN and > _MAX in arch/Kconfig, while specifying default values in > arch/${ARCH}/Kconfig. > > Would these changes be more acceptable? Yes. I don't think you can do much about the Kconfigs so I would not worry about that too much. Eric -- 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/