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 937B6EB64D9 for ; Mon, 26 Jun 2023 18:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232117AbjFZS0l (ORCPT ); Mon, 26 Jun 2023 14:26:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232094AbjFZS0W (ORCPT ); Mon, 26 Jun 2023 14:26:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66A921984 for ; Mon, 26 Jun 2023 11:25:49 -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 03AFB60E76 for ; Mon, 26 Jun 2023 18:25:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8B30C433C9; Mon, 26 Jun 2023 18:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687803948; bh=rPuc8Pj6VUZ4jVpNy+8Lp9AuzNyWmMOhqY1rhbIfKgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GMXVZYfiqABjxrnO92x8qyC8SQvD1Q+v0/mQ7z5yJApKJ4ijYZ+zV7reXDZbgkQ7P HK+UZmrmQylQXnFieCI3690QjjshBnacepKLE9xA6GUubGT5cMSKSiaQSaCAileiSV e0wqsY1ECX3ZKrw+S0p+JoLp5g5zmrSTh0GbMyS0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ricardo Ribalda , 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 , Palmer Dabbelt , Paul Walmsley , Philipp Rudo , Ross Zwisler , Simon Horman , "Steven Rostedt (Google)" , Thomas Gleixner , Tom Rix , Andrew Morton Subject: [PATCH 4.19 06/41] x86/purgatory: remove PGO flags Date: Mon, 26 Jun 2023 20:11:29 +0200 Message-ID: <20230626180736.500425171@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626180736.243379844@linuxfoundation.org> References: <20230626180736.243379844@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 97b6b9cbba40a21c1d9a344d5c1991f8cfbf136e 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-2-b05c520b7296@chromium.org Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory") Signed-off-by: Ricardo Ribalda 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: 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: Ricardo Ribalda Delgado Signed-off-by: Greg Kroah-Hartman --- arch/x86/purgatory/Makefile | 5 +++++ 1 file changed, 5 insertions(+) --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -12,6 +12,11 @@ $(obj)/string.o: $(srctree)/arch/x86/boo $(obj)/sha256.o: $(srctree)/lib/sha256.c FORCE $(call if_changed_rule,cc_o_c) +# 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)) + LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib targets += purgatory.ro