From mboxrd@z Thu Jan 1 00:00:00 1970 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 7325DEB64D9 for ; Mon, 19 Jun 2023 10:35:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231797AbjFSKen (ORCPT ); Mon, 19 Jun 2023 06:34:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231494AbjFSKej (ORCPT ); Mon, 19 Jun 2023 06:34:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D100013D for ; Mon, 19 Jun 2023 03:34:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E6EB60B78 for ; Mon, 19 Jun 2023 10:34:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D542C433C8; Mon, 19 Jun 2023 10:34:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687170865; bh=jRunHdUGCfcOmNvZ67q3nLOUlXcbtNBLyHbd2WvQzFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CcGqvzTstosARUJWg2h30ST01L2vjaXRc3jnB0nC0utKA8+kLIAiaifuxQI2poDhm HHMcW+55U/dKucHJMsNP/ZBbi6iQfiBQCrUzrQz3J/zofx0EYOlKWZSz8a8cxPcQh/ x6yG/QO0HPJR6yqE8NVxT31ejI3CqkTlz4j3nkHg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ricardo Ribalda , Palmer Dabbelt , Albert Ou , Baoquan He , "Borislav Petkov (AMD)" , Christophe Leroy , Dave Hansen , Dave Young , "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Michael Ellerman , Nathan Chancellor , Nicholas Piggin , Nick Desaulniers , Palmer Dabbelt , Paul Walmsley , Philipp Rudo , Ross Zwisler , Simon Horman , "Steven Rostedt (Google)" , Thomas Gleixner , Tom Rix , Andrew Morton Subject: [PATCH 6.3 063/187] riscv/purgatory: remove PGO flags Date: Mon, 19 Jun 2023 12:28:01 +0200 Message-ID: <20230619102200.725429142@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230619102157.579823843@linuxfoundation.org> References: <20230619102157.579823843@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ricardo Ribalda commit 88ac3bbcf73853880a9b2a65c67e6854390741cc upstream. If profile-guided optimization is enabled, the purgatory ends up with multiple .text sections. This is not supported by kexec and crashes the system. Link: https://lkml.kernel.org/r/20230321-kexec_clang16-v7-4-b05c520b7296@chromium.org Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory") Signed-off-by: Ricardo Ribalda Acked-by: Palmer Dabbelt Cc: Cc: Albert Ou Cc: Baoquan He Cc: Borislav Petkov (AMD) Cc: Christophe Leroy Cc: Dave Hansen Cc: Dave Young Cc: Eric W. Biederman Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Michael Ellerman Cc: Nathan Chancellor Cc: Nicholas Piggin Cc: Nick Desaulniers Cc: Palmer Dabbelt Cc: Paul Walmsley Cc: Philipp Rudo Cc: Ross Zwisler Cc: Simon Horman Cc: Steven Rostedt (Google) Cc: Thomas Gleixner Cc: Tom Rix Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- arch/riscv/purgatory/Makefile | 5 +++++ 1 file changed, 5 insertions(+) --- a/arch/riscv/purgatory/Makefile +++ b/arch/riscv/purgatory/Makefile @@ -35,6 +35,11 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS CFLAGS_string.o := -D__DISABLE_EXPORTS CFLAGS_ctype.o := -D__DISABLE_EXPORTS +# When profile-guided optimization is enabled, llvm emits two different +# overlapping text sections, which is not supported by kexec. Remove profile +# optimization flags. +KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(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