From patchwork Wed Nov 2 09:12:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 14137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3504313wru; Wed, 2 Nov 2022 02:15:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4v/f6rtRnJX3FhBzmk5DIisU9azrt2McbVytTFiGVbIJafm7dn9lSSmhbNPGqjYoUlRtJE X-Received: by 2002:a17:902:da8a:b0:187:3d6:4c60 with SMTP id j10-20020a170902da8a00b0018703d64c60mr23811183plx.117.1667380517468; Wed, 02 Nov 2022 02:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667380517; cv=none; d=google.com; s=arc-20160816; b=lUI4iSpjCoL/5zqAzbo1Tp7zXFWU0jrxCc1/SAbnQpvKQ8VsKerJZSPSlKJnk8JWAd l1+wVQSrByoqHfx/KtB6W1SGJsJAuc8Kj4SdNXCxvNxIoJLkHUfCr8X8r1gZ6G5irTpE IDJYI6hxxcl1g1CvurLyEzWEWZ8ISvpwbTGLeuKcic3o4a4ELAMwKamCcAIlWiqLAOA+ x3sEUxmPwxdmbGGQtQzcjje7N9pbVzatX1srJaEoc7hlxN5V7Ds+Fjr5vnzoBK5dEzIa zyQc21i59v6tMkIan88OanIk3V7IK4sxJDFPZ55IPSMYqcHFSyrqMlfYFqT08sqGnxJC KcNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=AgG2rCPrFDpdI0zoUhNhjwOMLIi1Qe1fHdpR+YdJups=; b=bd2eyIyP1INAWKBDFmHuoTSyXy4AKpbvNqsmTYjZBspIHys9sE/hAnIZX8vaSN0oaK CXcjpDGXPRn0/+vPGobJY7Ys7MmMszTvu8wQzu3DhD6AQ3OU5YVlT1Tew69FDnMOsycF zIjQwtXvVwQU1h5hdo94DNPIa2z+LfNFQglINJcQbWXZYU8nMio46T42Sm/t+KJeaLL/ QSb15NL+cLhGSIW5RqjWKYE7g8Tu2JZ7fmymjMqts/BfiuckbsADD14E7p2YU8k7u+MR lRnwYM+WzwlHE9RmVSPg5wPOOwDbV2Wk/FT0wHTSG/fUC8clHF34ADy9eXgIC3PVucBR 5y7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DLUlnRCT; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020a056a00240100b00550ec562c79si15444158pfh.369.2022.11.02.02.15.02; Wed, 02 Nov 2022 02:15:17 -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=@linutronix.de header.s=2020 header.b=DLUlnRCT; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231328AbiKBJOp (ORCPT + 99 others); Wed, 2 Nov 2022 05:14:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231296AbiKBJNY (ORCPT ); Wed, 2 Nov 2022 05:13:24 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6518828E39; Wed, 2 Nov 2022 02:12:53 -0700 (PDT) Date: Wed, 02 Nov 2022 09:12:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1667380371; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AgG2rCPrFDpdI0zoUhNhjwOMLIi1Qe1fHdpR+YdJups=; b=DLUlnRCTrBa9nAnm0jAFQRRIr3o/7PCF9s8KKJ4JFJXZ+CpSOImEEE4Ue0fM9aYOJNB/Ow 2RA7ohT3pGDM6B9G4+pQHQwckTAAu9ofcvTjEtiMkB/NP9tYc1DdrvEwrMiJfhJOCyzJdO 9Hp9egyCt603axJBad5gHuAOKOdEIffCgbh58oHLQLYyVarcyD53gLzqoD0ncraY/8LCHW A9a2vi/jTUQ58RdAPi7jJhzlDxblXlYZZLoVZ8MgNP7qnLbnHjR8zCSek1JAIdijy6SC1T CBo0V4rBrjBtv1dSXW74WPuUvxGtscM2Y8tCgmyiFm9M3YgQX1JYRSVapS+McA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1667380371; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AgG2rCPrFDpdI0zoUhNhjwOMLIi1Qe1fHdpR+YdJups=; b=FIeOMfaqgkiLMoklR2qrh4uRWeedrCiXnF/LR3DLsGx4dPNGhSotu0a0Pqcms/3Wsj7xgv tRRdOo1d2xOb0bBA== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] x86/ftrace: Remove SYSTEM_BOOTING exceptions Cc: "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221025201057.945960823@infradead.org> References: <20221025201057.945960823@infradead.org> MIME-Version: 1.0 Message-ID: <166738037045.7716.16513980408909497030.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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_PASS 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?1748375193761533010?= The following commit has been merged into the x86/mm branch of tip: Commit-ID: 52a56f20bb7c34ed4b48466ad2d443165fad942f Gitweb: https://git.kernel.org/tip/52a56f20bb7c34ed4b48466ad2d443165fad942f Author: Peter Zijlstra AuthorDate: Tue, 25 Oct 2022 21:39:47 +02:00 Committer: Peter Zijlstra CommitterDate: Tue, 01 Nov 2022 13:43:58 +01:00 x86/ftrace: Remove SYSTEM_BOOTING exceptions 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) Link: https://lkml.kernel.org/r/20221025201057.945960823@infradead.org --- arch/x86/kernel/alternative.c | 10 ---------- arch/x86/kernel/ftrace.c | 3 +-- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 5cadcea..e240351 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -1681,11 +1681,6 @@ void __ref text_poke_queue(void *addr, const void *opcode, size_t len, const voi { 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, const void *opcode, size_t len, const void * { 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); } diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index bd16500..43628b8 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -415,8 +415,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size) 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: