From patchwork Tue Oct 25 20:06:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 10967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1196054wru; Tue, 25 Oct 2022 13:12:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4NmnjKwJqdRcNDqAGDRB8BgN9UIdmBELxr9NceScwMkU+D+623BqNIcAiSYM6ARgZZyKW/ X-Received: by 2002:a17:90b:691:b0:20d:6171:c94 with SMTP id m17-20020a17090b069100b0020d61710c94mr14984pjz.25.1666728769679; Tue, 25 Oct 2022 13:12:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666728769; cv=none; d=google.com; s=arc-20160816; b=i0EertDm0gQWoX55Ml4+85mJ52TGqd8UxR33De0UG7ihwxhd1Rt1keqil2DNavLOo1 inIutnqLUdxxqg4HHp/zpvfmoMZUaq0B2BJZZamOBnXw4H0Vbx9VpP2/1jMDcT0g7MkW 6I8vM6fxnWMjvjTJnM98BYfCZCikJfSnjK4CLnHUHpDNv9pgOBkDd/kkn5xsrYRcQrs7 Y+YRrpx70Yj+LhoqypM9fbH6tH4/mOtfPutko1aJY+GYyLU4O/pamDaCjGwEmBjtpbFP YEzvBVeL6//Nu1o56YbdgoBDPub2/12RZriUODrxYrhVcjg6FSePf2jbOGT/FvwsbAts SfuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=UvZ0A5YMgLIp6qjx93Bx4vopUfVlvYD0i9vsQFxAYRM=; b=iBouLoMTY7SSl2grgSqYFpu2yV3I90YNRggDIg2M7v+zpWOxXSdN93koH3770tkeNi hUUkMkUBqeyaWG/0vkP6x+A4TKHESU0VyvqvfZ7WUWZb5jEyvACMShy8PvHSubcu2iah cJdkBUitWW7CtgQM+DrUjqiOKktwKzxWiYzy2gaMo4JhAPkVYUnZ2CR2iNRcrNhBmXWE 0UPnSShQOjXy7xHmCaTVAE5sFe+UJaB+q+QofAIVO5PPGoqUeFdnV3xgkTP8dPJE7zXK xpIzsfSa3mbi3mExRsyHKG0OfmRaKS73W01SycsQE5xmYvWsGxt5ND7OKv6BSCdToc6r M0jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="dW/slevq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020a17090a2dc500b0020d4f2e056csi4048835pjm.151.2022.10.25.13.12.19; Tue, 25 Oct 2022 13:12:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="dW/slevq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231748AbiJYULl (ORCPT + 99 others); Tue, 25 Oct 2022 16:11:41 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747691786483684640?= X-GMAIL-MSGID: =?utf-8?q?1747691786483684640?= In order to allow using mm_alloc() much earlier, move initializing mm_cachep into mm_init(). Signed-off-by: Peter Zijlstra (Intel) --- 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); +extern void mm_cache_init(void); extern void proc_caches_init(void); 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(); } #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); } -void __init proc_caches_init(void) +void __init mm_cache_init(void) { unsigned int mm_size; + /* + * 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 = sizeof(struct mm_struct) + cpumask_size(); + + mm_cachep = 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 = 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); - /* - * 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 = sizeof(struct mm_struct) + cpumask_size(); - - mm_cachep = 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 = KMEM_CACHE(vm_area_struct, SLAB_PANIC|SLAB_ACCOUNT); mmap_init(); nsproxy_cache_init(); From patchwork Tue Oct 25 20:06:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 10972 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1197011wru; Tue, 25 Oct 2022 13:15:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BExWXTvbN8M+mOda7Ia3JCB28feLELbQVOy3c+Kdo/3wKEIwkDI4l7FdCSw+iYSAYpcvd X-Received: by 2002:a63:64d:0:b0:46b:158f:102e with SMTP id 74-20020a63064d000000b0046b158f102emr35268596pgg.150.1666728905435; Tue, 25 Oct 2022 13:15:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666728905; cv=none; d=google.com; s=arc-20160816; b=vSGCT34sQFCfpuwLFnm+jF4TvsB1Io3ch9mrTCVk7v8+U3BXfWd05Q1Bi8ZVy8cOGV J0ZguE+TtJS9mQHpmoyEPUT4TPpjF31qHBgxdE3rMRe6dp3CprLZcqfZ0LoYUhlxH//r clTxNb0kvEOCxQPIoJh/56V5kgTpcoIKGjUSVvd0pT+eO8/zbMG89bsUfI2yUfMS75K2 irQ0MhcNLteWTTFzoRfbby3k7WMkmjoAgj9EnpfLxvOkTZzjbAhA1PMxAc3gE5fHBGQR fKtMEoc7oxLoc/GRjnrV2NsoHc9GVGJw9Bjkpll7kFnWsCRsrzXdUM9yJAHozgp7k0S1 9NkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=ttT6NbRi8PNEZh+vmTM7YkYkKivgXBYrKgPGhOWejO8=; b=mROrDuVjD9PvBjDRBPqM9FmNB1C80a0rDFb/TS8Cd/Xki1bMlu+nbwJHtHqUh/SQZ2 XKCsCbwFSWfJ6By3cgJh+rvaTrOkMVVb93bfWqLiwNwRAXj1Ygd9NdP/AGrzeNvQhNWT qQNEq5f/PxGle2a4L3zR8cYxRv6ggHxizTNX5lCe+1d06mefXgi2GK6WpD0/hq0mHZFd RYfqYywgtmvRKDmBc/SLe0AyZyAjY56paD51x5lybWZFY7hQPS6MUuA+/DUMhR5gs3Yh NlrrkwuTuek+QobTbS23gGVFMzcXI0tci2ZQq8BAtkuzTIuVCFLYmgCIUhbbvFhRBexu kxBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=CCp5CtY4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o20-20020a170903301400b0016f1eb1317esi3398140pla.471.2022.10.25.13.14.37; Tue, 25 Oct 2022 13:15:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=CCp5CtY4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232706AbiJYUMA (ORCPT + 99 others); Tue, 25 Oct 2022 16:12:00 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747691929011045474?= X-GMAIL-MSGID: =?utf-8?q?1747691929011045474?= 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) --- 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; - poking_mm = copy_init_mm(); + poking_mm = mm_alloc(); BUG_ON(!poking_mm); /* --- 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 node); 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 flags); 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; } -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 pointer. From patchwork Tue Oct 25 20:06:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 10970 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1196543wru; Tue, 25 Oct 2022 13:13:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jfWaGFNI6RVDLafkey11qNKCz2adAaxliv7m5cTlurBQb6ozwCX1iOm/xIzVoUTQidzOd X-Received: by 2002:a17:902:7786:b0:178:48c0:a083 with SMTP id o6-20020a170902778600b0017848c0a083mr40851783pll.125.1666728822665; Tue, 25 Oct 2022 13:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666728822; cv=none; d=google.com; s=arc-20160816; b=a1BJ5wWdAkdU/9lSYbZ+icumhwZHmYtdlE/Of4aJ1oM9KpazBTOF4qAyEedAJdqW4i gu5Nzfk9bb9vGJhZI9t0FyaMcj2/V7YpKxj7RCUi5XZ68+Fkuupx6MfKHfMRCe21Ttt5 3lnnf3x6AhYnOHAkABQOQZkasQxkRF1mZboV1xxxn+6o+xzg3MvL7G2OD9CKUhpY1hCE Oh7zwhPaVrkKG39t+Pqxh2KIFB+9aK+MHtl7FyyGGDri3TOKTBRrUeA8ulorEOgtFxmk bi/oR8pup+HSrqwgtzBxhrZsChHI+mCU7SR+/jn76NTYpF4s9bNqKy5Tu9yXSwiF/RUV s/qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=vqWW09KISKCCkh6u5sz08Jb6XS7CEV1aGc6COZk9VFQ=; b=IiaT+0dvYG+pM7iSA3K6Vp+ZR6/VaKoJtQ2bfsdZuf5gU/9qbVy4iM+5CifMnY4TSb KyJNfpLuA2CHV0H18CauD0g146BPIwthtBe9Fb8E6gFQZwo5bxDApy4OsZxF1Y8dsH1m OJkAgNnO510Vl+nuTY69klQMzTenSTpFx4UWal40pdGS/O+KMjVft4Asfwq2F7uwNWeo rZYhNgHi5QbAArshLczD2ddqt3KtMFC7o3n0gemoBLcp7KPhXk1ULrPstz+pPE3dYf2q 3MVOPVv8OytKTH04QzEEUJ/8CnkGLMPvK4GKumCBhYthAal7Di5CHgX6PPAXVTeUkc0I bdcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=jI2MOKll; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k1-20020a170902c40100b001869e7dea17si4862653plk.129.2022.10.25.13.13.21; Tue, 25 Oct 2022 13:13:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=jI2MOKll; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231833AbiJYUL4 (ORCPT + 99 others); Tue, 25 Oct 2022 16:11:56 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747691841767562493?= X-GMAIL-MSGID: =?utf-8?q?1747691841767562493?= 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) --- 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(); /* trace_printk can be enabled here */ @@ -1135,7 +1135,6 @@ asmlinkage __visible void __init __no_sa taskstats_init_early(); delayacct_init(); - poking_init(); check_bugs(); acpi_subsystem_init(); From patchwork Tue Oct 25 20:07:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 10969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1196373wru; Tue, 25 Oct 2022 13:13:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mBl6LxL4BSOPKcBifS+H6b/CVwyicO7d80uxBQ99/NIOYQJ8exDoatRer63WXj6OEWH+/ X-Received: by 2002:a63:1e05:0:b0:451:31d0:8c0f with SMTP id e5-20020a631e05000000b0045131d08c0fmr34169392pge.227.1666728812187; Tue, 25 Oct 2022 13:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666728812; cv=none; d=google.com; s=arc-20160816; b=ievWRIjfRHs7n4Lu5Aywl5HdPPeeOSD6sNHe+K1nAyZF+X1/VX8J+q5RlGOw/itCQO +FhAu6dV3fUTiI+7LNT8yDSTflF11TDq3AcFpua/OhSZcTVOINIGQufWufxSF2l2d6yK 7K3bqhxvvRZrw69yFShBb/OBcwh5km30u3r8iHhIelT6TFvwq30WvoJ5kk6eUOxP0O6b oWWrnMWLy2P+OTHB4Br46pANcxIuob7Ta/FA5Df5Ueg12WRUgxiP4Wm9Dd3PP/1gL2B6 d1dO+xbmw2sMWhUFy3Eh1E9nV1TFkYWFVIbyH9n38K6sQJwjyykIEbyNFhgk0covUyQ1 CZSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=r0O1A5cCcJcSiywQeCYs1n88surn5b369qkAVUdXrbY=; b=a6IAc3lcRMPQBa30ycbiaOy+tfZt6g1SHOKRtpHL4uPg2RuXTy2ym3xx8yYHlDYGMq /z1Tr59T+vq4iU3wGTeGbNnuy9kZEQ34b4x/M0foeFzN3SeKvCRzLcxbSYNnD22qRIYr PvBEjOtM9s9qRCDbyn2++gUxh5RJlUY4yPEjEHlz0ggR9mR4ykMcDQxBiNVz7Msbk/eh K4sTuWsNRgwBhouU2aNugWqMyU5rzaZapk9DfNZZv5IWe8OoCU9P1/wK+Ythg4yX/gj8 mBQHH81epZfi8eQA1xuXQL8KxEgVlQZ645rqw0fkcFDb9ck1mAXGb7Lhpoe/iHzTnKBi TeLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=lXH6RCe6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pb14-20020a17090b3c0e00b0020d3a22af84si3908258pjb.186.2022.10.25.13.13.00; Tue, 25 Oct 2022 13:13:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=lXH6RCe6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231790AbiJYULv (ORCPT + 99 others); Tue, 25 Oct 2022 16:11:51 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747691830837220819?= X-GMAIL-MSGID: =?utf-8?q?1747691830837220819?= 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) --- 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; - if (unlikely(system_state == SYSTEM_BOOTING)) { - text_poke_early(addr, opcode, len); - return; - } - text_poke_flush(addr); tp = &tp_vec[tp_vec_nr++]; @@ -1707,11 +1702,6 @@ void __ref text_poke_bp(void *addr, cons { struct text_poke_loc tp; - if (unlikely(system_state == 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 set_vm_flush_reset_perms(trampoline); - if (likely(system_state != 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 patchwork Tue Oct 25 20:07:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 10968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1196275wru; Tue, 25 Oct 2022 13:13:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72HTdeAh58cafyc8aUfQ9dFveQUyK7e3FcYMfw8SbvhPGWZS1fkSvHhF0JqfHhiAH7/8ud X-Received: by 2002:a17:90a:4b02:b0:212:f63f:6deb with SMTP id g2-20020a17090a4b0200b00212f63f6debmr18542625pjh.241.1666728798839; Tue, 25 Oct 2022 13:13:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666728798; cv=none; d=google.com; s=arc-20160816; b=vms70ccw/GXYiXR4R59nLnfBUwMcE+gOL5t+1nf7XI6DuNusbIuq682Ffs2kSrgNB2 JsS6vzJJTmEk0PJwNM3FHkZoh89khIfHsYkclxqSyw7SfiRR59wrp8FJNbJ6q1sRGnPJ bFUR12OFuefZQkcP5Uccm2+0b8MYehx/oDJeVQUDvkPNijgx77+ecEyxOv45rXrLvKV6 /tVLUGUyIskSSzcSnszrL0upyGvdX8KbakZ7qVsc3mTeZ/vw18Bl0naRtWzgdNBV+PeT 3S45ql//ulweYSCzhrflA8N79hXgBQwDyAAoK5JKTDvhgSGQl4dTrTkp1IeOuWh1ez13 tOkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=GQNMbODNLjgV6RJ0RGaO6u1ANw+MYd4DzgUTsmQMz8s=; b=AqTKIh0LpUi4axSlXatg5affURAU67yCGflfeVA9Woya0brVzKZYh6d3rQSZz0+KGb +Cm8+fwaq9l979ZxPvqLshehqPfITgREbVebTDnlX6V9htlPvxob5wGt6JQy6D5gCHKc FvEYWVAg4aQs9iIXg53K0zxi6W9Eq4aCI5miHswSQFzt6aKX4zxGT9Wo5woxhVFdZBvT vdIRDv+mSpmfo/vXrpHli7UoEe2x+a8hlDoAfSFYeZoJe8HLSMfITcmnXjavP9fQDKsn 5vm6FwtMdL7ZRW5iakGH0hOHdeG14Ges4HAuYV1wpaKv51l1X2LW7HP8+Ss0ggJDZJlM J4rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tqi8rwcE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nv8-20020a17090b1b4800b0020d3424d919si16366684pjb.97.2022.10.25.13.12.44; Tue, 25 Oct 2022 13:13:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tqi8rwcE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231964AbiJYULq (ORCPT + 99 others); Tue, 25 Oct 2022 16:11:46 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747691816882138030?= X-GMAIL-MSGID: =?utf-8?q?1747691816882138030?= 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) --- 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; - /* Kernel text is rw at boot up */ - if (system_state == SYSTEM_BOOTING) - return new; - /* * 32-bit has some unfixable W+X issues, like EFI code * and writeable data being in the same page. Disable