From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751089AbdAQOaw (ORCPT ); Tue, 17 Jan 2017 09:30:52 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33714 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750924AbdAQOau (ORCPT ); Tue, 17 Jan 2017 09:30:50 -0500 Date: Tue, 17 Jan 2017 23:30:43 +0900 From: Stafford Horne To: Peter Zijlstra Cc: Vlastimil Babka , linux-kernel@vger.kernel.org, Andrew Morton , Thomas Gleixner , Kees Cook , Jessica Yu , Petr Mladek , Rasmus Villemoes , Yang Shi , Tejun Heo , Prarit Bhargava , Yaowei Bai , Andrey Ryabinin Subject: Re: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists Message-ID: <20170117143043.GA7836@lianli.shorne-pla.net> References: <20170117125624.8535-1-shorne@gmail.com> <20170117134454.GB6515@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170117134454.GB6515@twins.programming.kicks-ass.net> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 17, 2017 at 02:44:54PM +0100, Peter Zijlstra wrote: > On Tue, Jan 17, 2017 at 02:07:36PM +0100, Vlastimil Babka wrote: > > > Anyway I'm not sure if this patch is safe. Hopefully Peter can judge > > this better... > > > > > Cc: Vlastimil Babka > > > Signed-off-by: Stafford Horne > > > --- > > > init/main.c | 3 +-- > > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > > > diff --git a/init/main.c b/init/main.c > > > index 8b1adb6e..d1ca7cb 100644 > > > --- a/init/main.c > > > +++ b/init/main.c > > > @@ -513,6 +513,7 @@ asmlinkage __visible void __init start_kernel(void) > > > boot_cpu_state_init(); > > > smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ > > > > > > + jump_label_init(); > > > build_all_zonelists(NULL, NULL); > > > page_alloc_init(); > > > > > > @@ -526,8 +527,6 @@ asmlinkage __visible void __init start_kernel(void) > > > parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, > > > NULL, set_init_arg); > > > > > > - jump_label_init(); > > > - > > Urgh, that means auditing all archs that implement this. The thing > you're looking for is if the self-modifying code cruft can be done that > early. > > x86 looks to be fine, because this is after setup_arch() which is > required for ideal_nops[] to be initialied and we use text_poke_early() > which doesn't really need anything else. > > I've not gone through the other arches... Vlastimil, Will you be able to look into that? Openrisc doesnt have jump_label support, so its no issue at the moment. Archs that do have it: arch/arm64/Kconfig: select HAVE_ARCH_JUMP_LABEL arch/mips/Kconfig: select HAVE_ARCH_JUMP_LABEL arch/s390/Kconfig: select HAVE_ARCH_JUMP_LABEL arch/sparc/Kconfig: select HAVE_ARCH_JUMP_LABEL if SPARC64 arch/tile/Kconfig: select HAVE_ARCH_JUMP_LABEL arch/x86/Kconfig: select HAVE_ARCH_JUMP_LABEL arch/arm/Kconfig: select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU arch/powerpc/Kconfig: select HAVE_ARCH_JUMP_LABEL I looked at a few (arm, tile) and I dont see their arch_jump_label_transform* implementations depending on global state like ideal_nops from x86. They should be ok. If no time, Should you change your patch to not use static keys for build_all_zonelists at least?