From nobody Wed Apr 8 12:42:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3AA9C38A2D for ; Tue, 25 Oct 2022 20:11:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231523AbiJYULm (ORCPT ); Tue, 25 Oct 2022 16:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231244AbiJYULg (ORCPT ); Tue, 25 Oct 2022 16:11:36 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E29979EC6 for ; Tue, 25 Oct 2022 13:11:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=UvZ0A5YMgLIp6qjx93Bx4vopUfVlvYD0i9vsQFxAYRM=; b=dW/slevqqrlkPqDipH2N24ioFq ulGSbcJXeRK+kDZeRbpzM/GVbrIP5v+bIK6nxrlTWlYLAjZL9RqVI1CcRgUEixULXAjglX4tSAtO4 4h/WClTyNIB+h5I+CLuPWdrodL4uWnbgDRBJ5XjQw8y8pxTB8IQW78KQ/vCqr9xUQvwEJUeLCYQog lRcIoCihCgWvzvGTxehh/oOHS4PiC1FKaXRX3Nk9VqqNP+WwJGbiFlKw+YXlQAt1OaJiJEYT1ooE9 Xw4o6aPkkJYgQmXcT6IicdEl63ccikyBVzubCY/al2LoQHMk7/1hx88xb2M+jgOTyht+aJTpFGll7 VaP2/YVQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1onQGm-00GWF4-EP; Tue, 25 Oct 2022 20:11:28 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A3C13300169; Tue, 25 Oct 2022 22:11:22 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 8C43F2C4502E9; Tue, 25 Oct 2022 22:11:22 +0200 (CEST) Message-ID: <20221025201057.751153381@infradead.org> User-Agent: quilt/0.66 Date: Tue, 25 Oct 2022 22:06:57 +0200 From: Peter Zijlstra To: torvalds@linux-foundation.org, rostedt@goodmis.org, dave.hansen@intel.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, x86@kernel.org, keescook@chromium.org, seanjc@google.com Subject: [PATCH 1/5] mm: Move mm_cachep initialization to mm_init() References: <20221025200656.951281799@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In order to allow using mm_alloc() much earlier, move initializing mm_cachep into mm_init(). Signed-off-by: Peter Zijlstra (Intel) Suggested-by: Linus Torvalds --- include/linux/sched/task.h | 1 + init/main.c | 1 + kernel/fork.c | 32 ++++++++++++++++++-------------- 3 files changed, 20 insertions(+), 14 deletions(-) --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -65,6 +65,7 @@ extern void sched_dead(struct task_struc void __noreturn do_task_dead(void); void __noreturn make_task_dead(int signr); =20 +extern void mm_cache_init(void); extern void proc_caches_init(void); =20 extern void fork_init(void); --- a/init/main.c +++ b/init/main.c @@ -860,6 +860,7 @@ static void __init mm_init(void) /* Should be run after espfix64 is set up. */ pti_init(); kmsan_init_runtime(); + mm_cache_init(); } =20 #ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET --- a/kernel/fork.c +++ b/kernel/fork.c @@ -3015,10 +3015,27 @@ static void sighand_ctor(void *data) init_waitqueue_head(&sighand->signalfd_wqh); } =20 -void __init proc_caches_init(void) +void __init mm_cache_init(void) { unsigned int mm_size; =20 + /* + * The mm_cpumask is located at the end of mm_struct, and is + * dynamically sized based on the maximum CPU number this system + * can have, taking hotplug into account (nr_cpu_ids). + */ + mm_size =3D sizeof(struct mm_struct) + cpumask_size(); + + mm_cachep =3D kmem_cache_create_usercopy("mm_struct", + mm_size, ARCH_MIN_MMSTRUCT_ALIGN, + SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_ACCOUNT, + offsetof(struct mm_struct, saved_auxv), + sizeof_field(struct mm_struct, saved_auxv), + NULL); +} + +void __init proc_caches_init(void) +{ sighand_cachep =3D kmem_cache_create("sighand_cache", sizeof(struct sighand_struct), 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_TYPESAFE_BY_RCU| @@ -3036,19 +3053,6 @@ void __init proc_caches_init(void) SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_ACCOUNT, NULL); =20 - /* - * The mm_cpumask is located at the end of mm_struct, and is - * dynamically sized based on the maximum CPU number this system - * can have, taking hotplug into account (nr_cpu_ids). - */ - mm_size =3D sizeof(struct mm_struct) + cpumask_size(); - - mm_cachep =3D kmem_cache_create_usercopy("mm_struct", - mm_size, ARCH_MIN_MMSTRUCT_ALIGN, - SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_ACCOUNT, - offsetof(struct mm_struct, saved_auxv), - sizeof_field(struct mm_struct, saved_auxv), - NULL); vm_area_cachep =3D KMEM_CACHE(vm_area_struct, SLAB_PANIC|SLAB_ACCOUNT); mmap_init(); nsproxy_cache_init(); From nobody Wed Apr 8 12:42:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11F4CC38A2D for ; Tue, 25 Oct 2022 20:12:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232714AbiJYUMB (ORCPT ); Tue, 25 Oct 2022 16:12:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbiJYULj (ORCPT ); Tue, 25 Oct 2022 16:11:39 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE2267A774 for ; Tue, 25 Oct 2022 13:11:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=ttT6NbRi8PNEZh+vmTM7YkYkKivgXBYrKgPGhOWejO8=; b=CCp5CtY4T2ASXO7NOuGpEDuCUr D6t4vGtY4Jh7x11ri+mThqWYX9jTtY9HLfICzpS4f012b0R/vJMwUK0dvPo8jdUI3zbjrekgkGyDd 1wj7UY+UC1G4hOubbmL1R7N9O+Cf/Z3v2vz4w89B5NXDn9Pk9I5tXmz0gCauho/WDdQLBqP31sMeA Eaa5jOAOsz3YdrjHdvt1LTxCrE7vUUoWy1Osae/6CMuOaKXAqDVvvqPw8wimINajbonMTePqD2vMt Xu7TxQV5MJrXT3uMz/z6IXdMWjhH6bPzi2DCP3LfZbjkATjOHXFqU2B0AUJKXQp62fMPct8jpVcbY OfM9pnBw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1onQGh-006OK5-Sv; Tue, 25 Oct 2022 20:11:26 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A678630020C; Tue, 25 Oct 2022 22:11:22 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 8E23B2C4502EB; Tue, 25 Oct 2022 22:11:22 +0200 (CEST) Message-ID: <20221025201057.816175235@infradead.org> User-Agent: quilt/0.66 Date: Tue, 25 Oct 2022 22:06:58 +0200 From: Peter Zijlstra To: torvalds@linux-foundation.org, rostedt@goodmis.org, dave.hansen@intel.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, x86@kernel.org, keescook@chromium.org, seanjc@google.com Subject: [PATCH 2/5] x86/mm: Use mm_alloc() in poking_init() References: <20221025200656.951281799@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of duplicating init_mm, allocate a fresh mm. The advantage is that mm_alloc() has much simpler dependencies. Additionally it makes more conceptual sense, init_mm has no (and must not have) user state to duplicate. Signed-off-by: Peter Zijlstra (Intel) Suggested-by: Linus Torvalds --- arch/x86/mm/init.c | 2 +- include/linux/sched/task.h | 1 - kernel/fork.c | 5 ----- 3 files changed, 1 insertion(+), 7 deletions(-) --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -801,7 +801,7 @@ void __init poking_init(void) spinlock_t *ptl; pte_t *ptep; =20 - poking_mm =3D copy_init_mm(); + poking_mm =3D mm_alloc(); BUG_ON(!poking_mm); =20 /* --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -91,7 +91,6 @@ extern void exit_itimers(struct task_str extern pid_t kernel_clone(struct kernel_clone_args *kargs); struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int nod= e); struct task_struct *fork_idle(int); -struct mm_struct *copy_init_mm(void); extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long fla= gs); extern pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long = flags); extern long kernel_wait4(pid_t, int __user *, int, struct rusage *); --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2592,11 +2592,6 @@ struct task_struct * __init fork_idle(in return task; } =20 -struct mm_struct *copy_init_mm(void) -{ - return dup_mm(NULL, &init_mm); -} - /* * This is like kernel_clone(), but shaved down and tailored to just * creating io_uring workers. It returns a created task, or an error point= er. From nobody Wed Apr 8 12:42:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26B36C38A2D for ; Tue, 25 Oct 2022 20:12:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232672AbiJYUL5 (ORCPT ); Tue, 25 Oct 2022 16:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231455AbiJYULj (ORCPT ); Tue, 25 Oct 2022 16:11:39 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D1127A745 for ; Tue, 25 Oct 2022 13:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=vqWW09KISKCCkh6u5sz08Jb6XS7CEV1aGc6COZk9VFQ=; b=jI2MOKllzRXOLxYgNpNI5zP8AR 6vVHJ9pMxNaFqfykRbCzkdDD5JoPCx8VxkPq3CsnbrS/Vi8rwS0u1F1+0egrRNW6rE9OY0T634rfo zPi8k7n/tsYogemzZhDQBc9/+IUcoDgaebRmNKbIbp3GooFmTyWswoXcfB03Ig0uI+GcaWW4bgAtj /2dfF8jHhHI48rkAOHWUA8mVvZ34zkXUCwzhRtUxAwhL6W64Aj6uzdGOgs7CZMnfmgIQVVRjxm2WZ cGX2XXJDq1EnEjaqPly5FCf9MVwiy1jNNNk8z1AwDJKIgHN4pwDCw7nRnJrjd7k+wFSIEB3Wcs9Xx cznA5bhQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1onQGh-006OK6-T4; Tue, 25 Oct 2022 20:11:26 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id ACCDA30035C; Tue, 25 Oct 2022 22:11:22 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 95F2F2C4502E8; Tue, 25 Oct 2022 22:11:22 +0200 (CEST) Message-ID: <20221025201057.881703081@infradead.org> User-Agent: quilt/0.66 Date: Tue, 25 Oct 2022 22:06:59 +0200 From: Peter Zijlstra To: torvalds@linux-foundation.org, rostedt@goodmis.org, dave.hansen@intel.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, x86@kernel.org, keescook@chromium.org, seanjc@google.com Subject: [PATCH 3/5] x86/mm: Initialize text poking earlier References: <20221025200656.951281799@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move poking_init() up a bunch; specifically move it right after mm_init() which is right before ftrace_init(). This will allow simplifying ftrace text poking which currently has a bunch of exceptions for early boot. Signed-off-by: Peter Zijlstra (Intel) Suggested-by: Linus Torvalds --- init/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/init/main.c +++ b/init/main.c @@ -996,7 +996,7 @@ asmlinkage __visible void __init __no_sa sort_main_extable(); trap_init(); mm_init(); - + poking_init(); ftrace_init(); =20 /* trace_printk can be enabled here */ @@ -1135,7 +1135,6 @@ asmlinkage __visible void __init __no_sa taskstats_init_early(); delayacct_init(); =20 - poking_init(); check_bugs(); =20 acpi_subsystem_init(); From nobody Wed Apr 8 12:42:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F38C0C38A2D for ; Tue, 25 Oct 2022 20:11:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231838AbiJYULw (ORCPT ); Tue, 25 Oct 2022 16:11:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231241AbiJYULj (ORCPT ); Tue, 25 Oct 2022 16:11:39 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D5AA7A750 for ; Tue, 25 Oct 2022 13:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=r0O1A5cCcJcSiywQeCYs1n88surn5b369qkAVUdXrbY=; b=lXH6RCe64PDOftKZYiV3BSdSyS Vf1YajQ1pZNPPNyQeqhAcoDkxeQj5Is8ivCIMW3x3XmccSusppC8cnqbdfOuogRx++v9KLbJk2+FS vKcmnUCExsnpkZCRQjpAxbICl/rwWmRyLS+M5zl4S+Ed/K8w3XxhMhnoTVd9zLNCrdtK5eNfxn2GZ 5Q673p1zDJAdZWkFqjyPy76VGJCRUkjlldj9bVTI6C6Wnuxwa9hI9WPqynq1sPiKCW/Pq1j8sfhuF 2SdWITEeeOM9+UhF5F86Tw8iHl2ehnBp2Kgwq9wiAZodatkH570UAwSYos3mqZv5svKsFSJcK9s1X JSQHdeYA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1onQGh-006OK4-Sv; Tue, 25 Oct 2022 20:11:24 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B41D5300446; Tue, 25 Oct 2022 22:11:22 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 99DC920117B33; Tue, 25 Oct 2022 22:11:22 +0200 (CEST) Message-ID: <20221025201057.945960823@infradead.org> User-Agent: quilt/0.66 Date: Tue, 25 Oct 2022 22:07:00 +0200 From: Peter Zijlstra To: torvalds@linux-foundation.org, rostedt@goodmis.org, dave.hansen@intel.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, x86@kernel.org, keescook@chromium.org, seanjc@google.com Subject: [PATCH 4/5] x86/ftrace: Remove SYSTEM_BOOTING exceptions References: <20221025200656.951281799@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that text_poke is available before ftrace, remove the SYSTEM_BOOTING exceptions. Specifically, this cures a W+X case during boot. Signed-off-by: Peter Zijlstra (Intel) Suggested-by: Linus Torvalds --- arch/x86/kernel/alternative.c | 10 ---------- arch/x86/kernel/ftrace.c | 3 +-- 2 files changed, 1 insertion(+), 12 deletions(-) --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -1681,11 +1681,6 @@ void __ref text_poke_queue(void *addr, c { struct text_poke_loc *tp; =20 - if (unlikely(system_state =3D=3D SYSTEM_BOOTING)) { - text_poke_early(addr, opcode, len); - return; - } - text_poke_flush(addr); =20 tp =3D &tp_vec[tp_vec_nr++]; @@ -1707,11 +1702,6 @@ void __ref text_poke_bp(void *addr, cons { struct text_poke_loc tp; =20 - if (unlikely(system_state =3D=3D SYSTEM_BOOTING)) { - text_poke_early(addr, opcode, len); - return; - } - text_poke_loc_init(&tp, addr, opcode, len, emulate); text_poke_bp_batch(&tp, 1); } --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -415,8 +415,7 @@ create_trampoline(struct ftrace_ops *ops =20 set_vm_flush_reset_perms(trampoline); =20 - if (likely(system_state !=3D SYSTEM_BOOTING)) - set_memory_ro((unsigned long)trampoline, npages); + set_memory_ro((unsigned long)trampoline, npages); set_memory_x((unsigned long)trampoline, npages); return (unsigned long)trampoline; fail: From nobody Wed Apr 8 12:42:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B414FA373E for ; Tue, 25 Oct 2022 20:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232000AbiJYULs (ORCPT ); Tue, 25 Oct 2022 16:11:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231429AbiJYULj (ORCPT ); Tue, 25 Oct 2022 16:11:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86F8A7A526 for ; Tue, 25 Oct 2022 13:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=GQNMbODNLjgV6RJ0RGaO6u1ANw+MYd4DzgUTsmQMz8s=; b=tqi8rwcEyiK/lR7ccOEZObJwlg f6M0lfg4SINlmLYHQ179fgI9rnETIlOsHXQ/KEfxI1lqKrlvBYZkceL1bYoTeYndxrWRIQ+SMpqyd hlyrYdkx25pKDVpdz7dXhd/x8BsLqvMj4IkciQYunLQVFLpETxPFaB4cyYnZWubl611BWxh9t2mPW 1M2zCQmC9SNK8Rqih6OjY3d46m6Uv58sj/3feY1nJ/yynLV7MPty9Bx2tcUc1sQ6mJ+EhZQB0Bg1p e8C0wbIZJeUmlY8YuB9V2CB5xusmSK/3C8HKvIyLm5cFUb4IDQKR7wVJTK6LmtR5I9+TUf0++cylJ jpv4vLLw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1onQGm-00GWF9-Ud; Tue, 25 Oct 2022 20:11:29 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1020A300474; Tue, 25 Oct 2022 22:11:23 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 9E7722C4502EA; Tue, 25 Oct 2022 22:11:22 +0200 (CEST) Message-ID: <20221025201058.011279208@infradead.org> User-Agent: quilt/0.66 Date: Tue, 25 Oct 2022 22:07:01 +0200 From: Peter Zijlstra To: torvalds@linux-foundation.org, rostedt@goodmis.org, dave.hansen@intel.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, x86@kernel.org, keescook@chromium.org, seanjc@google.com Subject: [PATCH 5/5] x86/mm: Do verify W^X at boot up References: <20221025200656.951281799@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Straight up revert of commit: a970174d7a10 ("x86/mm: Do not verify W^X at boot up") now that the root cause has been fixed. Signed-off-by: Peter Zijlstra (Intel) Suggested-by: Linus Torvalds --- arch/x86/mm/pat/set_memory.c | 4 ---- 1 file changed, 4 deletions(-) --- a/arch/x86/mm/pat/set_memory.c +++ b/arch/x86/mm/pat/set_memory.c @@ -587,10 +587,6 @@ static inline pgprot_t verify_rwx(pgprot { unsigned long end; =20 - /* Kernel text is rw at boot up */ - if (system_state =3D=3D SYSTEM_BOOTING) - return new; - /* * 32-bit has some unfixable W+X issues, like EFI code * and writeable data being in the same page. Disable