From patchwork Fri Sep 15 08:36:26 2023 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: 140383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp985952vqi; Fri, 15 Sep 2023 04:59:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2Nn0xm7OaCK3MO+qZ6S1ynymeqi/5MwbScU8Rb0f+Y5TKT9Ihe90/qM5vYRmotCB3tZbl X-Received: by 2002:a05:6a21:a590:b0:153:40c3:aa71 with SMTP id gd16-20020a056a21a59000b0015340c3aa71mr1893397pzc.43.1694779165053; Fri, 15 Sep 2023 04:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694779165; cv=none; d=google.com; s=arc-20160816; b=0DcAFB8pT0ZFb1duALrOJ1bQPcDzY9xLVek+39b4KPZU58Gjvpbw6BsED1oYp1p85V 1Wnwn2pHPNVlmQMukO5Uk/fur7ssiYrpytieD/coWJULqo+aD3owb5o1vbAjo29G3aZG tQ3lkAysGArSbUui0FzQTt3HkiiFTbPdzaUp54+ddpWh5SpCZoecZTs8EPKWsS9py9qI k4K6c9JiawyqFDFcT2YF+hhdy3GfBnxxdGrVWg5bhI+0V9Bix7PSuUi4q7Rr8L1lPg6o FqVNoWlLj3PQxQmNkXuOQFsUvANiQCEuZG4gppbhY/WyIMZX7hXJHWvImQG1FgfsmuAh RBFw== 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=gblbQos8VTNNdUR5WR/h70J7iw2C+0i404bkbVCQRoI=; fh=8QP7Dim9UBzZrqXGJ4nO2D6gd3aGbnd7O2MJj+NLX7U=; b=nQGY67kd9VUGTylqfJ+QrqcobwGbVP69EMAD3Ila/H++6vevfnCbctFSFSW/peGgRu s/UZ2vOY35yXlV1uWAADgVWRrwMbkwVW8YMc6iX2js4Z+UyKV0AIsHOz5qF282+2eGsu +RZrQxLm5i3/oOKm/KYNioqHgzOggOBuaYxHOTFaSL06MQHiyNyGloM8xz2fhW6byfcU YpihvFHv7eelChKa71VE1xXIDwnWtg4zX8aWyp8Uz8vsZsgvjIiCUBADf4vTlFgUVMoC Hp4MUd4Cto2a03Fsa4zHauXVewRr17uzX4KuJQcBKGbKXb1uLy2qg7klHZ2NRpPF2i3e puKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KQVFclS0; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id z16-20020a656650000000b00565d05b2211si3042630pgv.819.2023.09.15.04.59.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 04:59:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KQVFclS0; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 306B181143F2; Fri, 15 Sep 2023 01:36:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233007AbjIOIgi (ORCPT + 32 others); Fri, 15 Sep 2023 04:36:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233057AbjIOIgf (ORCPT ); Fri, 15 Sep 2023 04:36:35 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0807E7E; Fri, 15 Sep 2023 01:36:28 -0700 (PDT) Date: Fri, 15 Sep 2023 08:36:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694766987; 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=gblbQos8VTNNdUR5WR/h70J7iw2C+0i404bkbVCQRoI=; b=KQVFclS0QKWzqEXxbT+1qkip+4o6d3/VMsLrND60Zo3g32lWCHscjOl8YkWhKxKZKSpjKU MSiPedACt1Uc3xP2/oq0mxGeueNYlBORmP6VcL9S6xrn2e42shi39ieDT2w5ngI0bfPkC8 OGCS+pLNH4PrIo+g6cGLNzgFElEjNq3Df21VuTQ0Wg/F1y7WM4+5UThiFchGK9Bxt/SRZl cCBoWfqJtWHBGjdndvCwAWTOqh2OdNYQxBTengPCy9HNs2J3Qe5cV+RVXcjoMyNPt3zoaF YgayGYGCdlQgfnp8UG+ZIBsSwZOzgr6fEUVDDFkOf+3I74id7wnLbv7M2ymCSg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694766987; 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=gblbQos8VTNNdUR5WR/h70J7iw2C+0i404bkbVCQRoI=; b=oc2zV1Oj+U9a3vg/XiC8NJIdfJ7jt5ZTPK0ixXHC6Y1xndJZLrl7ji/ts2JPV5sgmK6/Xy vMe452etrsSp7mBw== From: "tip-bot2 for Song Liu" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/purgatory: Remove LTO flags Cc: Song Liu , Ingo Molnar , Nick Desaulniers , Sami Tolvanen , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230914170138.995606-1-song@kernel.org> References: <20230914170138.995606-1-song@kernel.org> MIME-Version: 1.0 Message-ID: <169476698697.27769.6321588484141795759.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 01:36:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777040479066943738 X-GMAIL-MSGID: 1777104757437259911 The following commit has been merged into the x86/urgent branch of tip: Commit-ID: f7d2101197488fdd2106ca21346733562f398765 Gitweb: https://git.kernel.org/tip/f7d2101197488fdd2106ca21346733562f398765 Author: Song Liu AuthorDate: Thu, 14 Sep 2023 10:01:38 -07:00 Committer: Ingo Molnar CommitterDate: Fri, 15 Sep 2023 10:31:26 +02:00 x86/purgatory: Remove LTO flags -flto* implies -ffunction-sections. With LTO enabled, ld.lld generates multiple .text sections for purgatory.ro: $ readelf -S purgatory.ro | grep " .text" [ 1] .text PROGBITS 0000000000000000 00000040 [ 7] .text.purgatory PROGBITS 0000000000000000 000020e0 [ 9] .text.warn PROGBITS 0000000000000000 000021c0 [13] .text.sha256_upda PROGBITS 0000000000000000 000022f0 [15] .text.sha224_upda PROGBITS 0000000000000000 00002be0 [17] .text.sha256_fina PROGBITS 0000000000000000 00002bf0 [19] .text.sha224_fina PROGBITS 0000000000000000 00002cc0 This causes WARNING from kexec_purgatory_setup_sechdrs(): WARNING: CPU: 26 PID: 110894 at kernel/kexec_file.c:919 kexec_load_purgatory+0x37f/0x390 Fix this by disabling LTO for purgatory. [ AFAICT, x86 is the only arch that supports LTO and purgatory. ] We could also fix this with an explicit linker script to rejoin .text.* sections back into .text. However, given the benefit of LTOing purgatory is small, simply disable the production of more .text.* sections for now. Fixes: b33fff07e3e3 ("x86, build: allow LTO to be selected") Signed-off-by: Song Liu Signed-off-by: Ingo Molnar Reviewed-by: Nick Desaulniers Reviewed-by: Sami Tolvanen Link: https://lore.kernel.org/r/20230914170138.995606-1-song@kernel.org --- arch/x86/purgatory/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index c2a29be..08aa0f2 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -19,6 +19,10 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY # optimization flags. KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) +# When LTO is enabled, llvm emits many text sections, which is not supported +# by kexec. Remove -flto=* flags. +KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO),$(KBUILD_CFLAGS)) + # When linking purgatory.ro with -r unresolved symbols are not checked, # also link a purgatory.chk binary without -r to check for unresolved symbols. PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib