From patchwork Mon May 1 12:38:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 89037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2669282vqo; Mon, 1 May 2023 05:50:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7PgcLQuWdbM37Y/XxHSNY7K+AptKATjlx/a3U+yajnQx2O7vBNoZ0dplg+mK5o4ZXeayLs X-Received: by 2002:a05:6a20:43ac:b0:f0:3e78:715b with SMTP id i44-20020a056a2043ac00b000f03e78715bmr15178839pzl.40.1682945429655; Mon, 01 May 2023 05:50:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682945429; cv=none; d=google.com; s=arc-20160816; b=0RoY2qi2SvsLujzt2xsc2RR1nFldCt9DBmtKAnoR17wrDDlxwYZMZMIjnY2H0CJfga /YECstZPGcKNSZXkNuaNQRHcl1fKkhws6lj32Y1bS6PCtYQPX5beOfB68yEgpY3AKKSu PInT+Zo8y1XLcR6x8os7Y+Yq56k5y7+M8AGoPphDgNf5ox9U0LXf313JrsDlbtPQx5Wt /WJngkC4stuyKsluj96IjvEuet84Gf+/0Dn0dzifyXBuEG5hEHPAMqsqb8dxGpQuzQA4 t/8Jfi+NOtgq669KKDrytj79rpEdZp2NRcyiLPO1HewMcucWilzDWySrL9DHva0ZwrS/ d2Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=vsOOlRTCOjL3abNi/3ZUSQqB4+vgvV69cdyU9ee1C48=; b=uA6NmQUD/bSzq0RBrRF4Scvuu0+o+j+9a84rLD9iaxhQA+a/GQ2hav2gj8jb4X+af3 ci30kBnynh51kFrl/EWaXEXkFDlAesBlH4PCDlL+IUHzWROO1Ca0u0H3tBggxkx+y5pt 5XEbmGBVwNHYHV6a6LVjZ+QVqVTjO83Rk6+El3GmhvHt7v3Y0XgwTUfL4DHT4Wj1TeNW xcdrLlv95pWn/1I5JkxL3zGNGP3ODVrIaBROnig42PddR717X2LWhfH1pCDHnrJ7SHgt NDb5A92fN0KydO22kQjdsYExDAVJpfvEwSQ1YeJWCcTUv4R1dX/NsWBxQYZUgRNJK86p 2bHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hODYeDeY; 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=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a6566d4000000b00518d97e15ebsi27273148pgw.431.2023.05.01.05.50.15; Mon, 01 May 2023 05:50:29 -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=@chromium.org header.s=google header.b=hODYeDeY; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232586AbjEAMjO (ORCPT + 99 others); Mon, 1 May 2023 08:39:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232556AbjEAMjE (ORCPT ); Mon, 1 May 2023 08:39:04 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3452E58 for ; Mon, 1 May 2023 05:39:02 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-50bc4d96e14so8630207a12.1 for ; Mon, 01 May 2023 05:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682944742; x=1685536742; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vsOOlRTCOjL3abNi/3ZUSQqB4+vgvV69cdyU9ee1C48=; b=hODYeDeYg6APhZAviVEDv24zkkV5PSyD9YF80bCIKMgiHcDDsd8y08C3drl6nvnGJD IlJxYRT/wEBGX7nbEciydDBBtR5sxWJSS+Q1JOTL+EYkrNHQvWMsz4+2JhTAsCU5cMFe Ea+MOxsYngr/dEQhvm3KkMoPZiJyiwADd2JrY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682944742; x=1685536742; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vsOOlRTCOjL3abNi/3ZUSQqB4+vgvV69cdyU9ee1C48=; b=cbvArH7xDGKhcS4k09RJUxv+BJTrExTjlxy5kT3W3uG3t1FcA1+eJe3CuRmeImImcp bIj9pc9VMVv2m6HCmjuMlhnfBE1L7JbFfLFkATCzi+9oS7eLYzPdCYnek5o+TT6+ZsML EzSM0iXP8Q9MN0ZKi5IR3R8hv0vMqp0o+GWdrLi51Mw6Q48m/rS81HB6cYn42Vxhsv15 t02vuUhf5s43gCuyVJzuzX75ii5Yl9ZCA3PPjwRYE1rBbBfS7+RLDh+VQsxhlj5SwxEN QkdqktPGBv9KrF8csIakzmM83hPuwVw4Nb14bKlHuvtHWgaKouplEV3/npntPGB3yxJ0 Vbbg== X-Gm-Message-State: AC+VfDzx6cMSNXL/c1U62x4ggOE3K31hTyPZMnLa1zG+i8Tt/LZpb2GA hKu+WFW8ABqSR7RslJimJob/2w== X-Received: by 2002:a05:6402:27c8:b0:504:77ed:5a33 with SMTP id c8-20020a05640227c800b0050477ed5a33mr5864584ede.8.1682944742259; Mon, 01 May 2023 05:39:02 -0700 (PDT) Received: from alco.roam.corp.google.com ([2620:0:1059:10:c573:159e:712e:688b]) by smtp.gmail.com with ESMTPSA id c8-20020aa7c988000000b0050bcbb5708asm146772edt.35.2023.05.01.05.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 05:39:02 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 01 May 2023 14:38:22 +0200 Subject: [PATCH v6 4/4] risc/purgatory: Add linker script MIME-Version: 1.0 Message-Id: <20230321-kexec_clang16-v6-4-a2255e81ab45@chromium.org> References: <20230321-kexec_clang16-v6-0-a2255e81ab45@chromium.org> In-Reply-To: <20230321-kexec_clang16-v6-0-a2255e81ab45@chromium.org> To: Eric Biederman , Philipp Rudo , Dave Young , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Nathan Chancellor , Tom Rix , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Baoquan He , Philipp Rudo , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Ross Zwisler , Steven Rostedt , Simon Horman , Nick Desaulniers , llvm@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, Ricardo Ribalda , stable@vger.kernel.org X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1219; i=ribalda@chromium.org; h=from:subject:message-id; bh=ECbK3ORJb/ox8qpp2VcGabf7Ou2PzFFDokGI84nq/PQ=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBkT7Lc5MTx2hMC4Re9phVjZPNed9BIxos1Pxii0 61fGiCxDbqJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCZE+y3AAKCRDRN9E+zzrE iJuYD/9j2b1eDvjy+uQCumtGC2Jn+H/Md0JWPsxPb46aNyMDJJYtpnBOkQyLCIR1Ro6iTpnQQLM +8uN/ou0X4CF9cfN+g6f5JwkPoQfQcP+jYNP8HE3vvJyaw+gY8gFKrsolGYojIu5+7EZscjeM+x 7hCRkxslbxzkKo8bCXJPNM5bL+TS+8voKLtJw5vxmDtH71krf0z6Gp38OUM1qbruri9kSi75MmP pPIc503fFiicjySfDDJ804XtSoK2FjXUVn96C+XtJdu8JE5WpzayNi5G1CCxtOHmymMyPL11Nyb +Y3kXDpLRgX+07NcFuZOiO/0ThN8bGM98On1cBYfS5PV2bqYo2Cv6+KOCjnObJd8T8zLrIWY31E dkIZGehfJGieHtPMQYd0Up0Q7UFloD9EOCUk3YXQjbVL5YW62U0ajBT0UqSNiyO8Fk5AdOGQnDv M1oDH7eB6zhw04nOc8MvRcEL1vb70bgueckn6cp6u0ViYD7VRwHLkKiDx9y2wl93EfhhVpu9EpQ 108x63OJbcTsVjOEtHREb8lzuERyPHJsPH5o49C5N+yZd7HKY8dMY7vi4/kdo4rqsrCdLSOYIRN nVm4G0/Z6eWsohGrZwA5weUUpMcYwEHd+mCMobjyQ8WPRg/nBapyYtxdaEgYMK3As9R4j0j3G0s Q5pwBDSsFyR/N1Q== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1764696187035255358?= X-GMAIL-MSGID: =?utf-8?q?1764696187035255358?= If PGO is enabled, the purgatory ends up with multiple .text sections. This is not supported by kexec and crashes the system. Cc: stable@vger.kernel.org Fixes: 930457057abe ("kernel/kexec_file.c: split up __kexec_load_puragory") Signed-off-by: Ricardo Ribalda Acked-by: Palmer Dabbelt --- arch/riscv/purgatory/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile index 5730797a6b40..cf3a44121a90 100644 --- 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 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