Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp71959ybe; Wed, 4 Sep 2019 15:21:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAzFqy6Yn4YUqCzbh7xmRgaELl8zcXQMUjk8w7sc8krPpMNKg0x7bO11y9ha1wzFqJBgcr X-Received: by 2002:a17:902:6b4c:: with SMTP id g12mr94261plt.118.1567635701088; Wed, 04 Sep 2019 15:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567635701; cv=none; d=google.com; s=arc-20160816; b=PfMAXT2gpv9Hz0v0jjfn3rbS7Vh4PGdO8L5WYr3CwrHbdiWI8AGPHfhFmdjLR/Wvze DptkzP4Q43gDbFaxqMLskPlnJjHHYiX+u1IASxoU/Nq4rO8cnp+/6aYy/poJ/+/UqwHm Q4w/t18x0gZ3t04xi+/slquv7VGHTlkzgqjqavAFsa9uEbf1DaXt2U8kVLl2vG9U5e4q 6ukTsJIsVnxJ1C7rapk/+OTISEdTeKRUE9cWUypWflO/tdaM3aXDURcJHMhW0w9Ojjbo 0N9CgvWwKS/g+m1IX9yv4V4E5CCBIJhXYv0CC2mOyf8YgZoTHTRUIMAYCRsCEaJl6oV9 lqJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=WAKv5eY0ztO3m4xAEUNoNojMwgMq+ljdxAZW09mQ/Sg=; b=0gO1vPWLM2H/CdDgUBFx4HpHUPUo93owOlzq3PsH9h8+20jlUjjF36qIYvKm3SSB8w Vt42f1rI7FkfCTxROFpDQpxL8A7hO2dLPEBV5rB8j+GfRdysQ2B+3+tsVTPtpKM989lr gBzzwzhMlNPmsqWKtwWN9NdNe8wiS7cwryDyT6gg20lMgjFBlMyHAei4LceOOXccBs2f 4lzlt9NpCSjbB0cF5l50n5lXaMoMlGcWQvwI1j5P3blwTC4gUFYaRAchmhx4VpYjPJf3 4aPMi0K+qpvlA/sahQ4bJ+J4CRPV2nbUBWMk56MKWhz4hUKmBYJYWrRKwiE/x54w8HO/ qwSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="dzBRjN/u"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a61si160542plc.344.2019.09.04.15.21.24; Wed, 04 Sep 2019 15:21:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="dzBRjN/u"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730129AbfIDWTM (ORCPT + 99 others); Wed, 4 Sep 2019 18:19:12 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:33984 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727741AbfIDWTL (ORCPT ); Wed, 4 Sep 2019 18:19:11 -0400 Received: by mail-pf1-f194.google.com with SMTP id r12so293641pfh.1 for ; Wed, 04 Sep 2019 15:19:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WAKv5eY0ztO3m4xAEUNoNojMwgMq+ljdxAZW09mQ/Sg=; b=dzBRjN/ucSOV3jwvHQwMfI/0wj070a5lY8VIXgT8XfjPx2PzY+GtPjQmZbWdly8vy3 /SSFqcbOTU4au8bMFh7njPTZpqmPbvl5uhr1nubZucFgsr8InizNpH5S/6nTVfMA6dS4 SIN20VVWC+QBMDvBBhmsoPP74za2Dmz67gvPG0QEskSDtu1QnEt3+/kusHQDzLVmQrRX yQ+xJVRiIkFLOrnZCcG7ioHGi4NQk8W5U8CEi5H2xJEbtIXZaVCPaVsH8KFH9b6O10KM xRHtIsnz1hddG2ACGGgwCX0QVqfDVoRS7rL1O6D1Jx2Rp8e6lkrC1VxUhE3zHUV6T/4C 9+Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WAKv5eY0ztO3m4xAEUNoNojMwgMq+ljdxAZW09mQ/Sg=; b=NcKurwVE6lpeiBSRYVIiAtHQxwPjwc4HeFtcxxR4SGvtrw43xs1v/M3V48ouZNR2Ux 7v94kXXtNwF3Dc4Xhq+iyyohFvCatwy4xSV9B7ZF3ZqwdJq0m0oUVMrfrNwhFbZwF+54 FK2w9MQnrSdJZsCUp9AB0x4PNrkCd7Ci2k6CjynnNgDtvKkPAZZLv2ORCx+qY/DXpk2u U1NjN8U/LioW+pXa/H8JukXS8AU8iq72X2ez1e2Fw1MyKnvSEA6EHbBDgVf95ial5eIx +jC1t693pbYZ9Wt1V6t8l/Ss4qFu2LorV9hDhN/zaTFAjeirq+xPI1ypud+TXxhm03qI 6Vbg== X-Gm-Message-State: APjAAAVFWpc8eK+qLgqMGHem8mkUrUaEmwsdN97QzMkhJU4DBymp+o3w wEBEWotfvrigFPl0VyEOh9ucLcrxNAOHH3V5BL2FEQ== X-Received: by 2002:a62:cec4:: with SMTP id y187mr9962pfg.84.1567635550318; Wed, 04 Sep 2019 15:19:10 -0700 (PDT) MIME-Version: 1.0 References: <20190904214505.GA15093@swahl-linux> In-Reply-To: <20190904214505.GA15093@swahl-linux> From: Nick Desaulniers Date: Wed, 4 Sep 2019 15:18:58 -0700 Message-ID: Subject: Re: [PATCH 1/1] x86/purgatory: Change compiler flags to avoid relocation errors. To: Steve Wahl , Thomas Gleixner Cc: LKML , clang-built-linux , Vaibhav Rustagi , russ.anderson@hpe.com, dimitri.sivanich@hpe.com, mike.travis@hpe.com, Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + (folks recommended by ./scripts/get_maintainer.pl ) (See also, step 7: https://nickdesaulniers.github.io/blog/2017/05/16/submitting-your-first-patch-to-the-linux-kernel-and-responding-to-feedback/) On Wed, Sep 4, 2019 at 2:45 PM Steve Wahl wrote: > > The last change to this Makefile caused relocation errors when loading It's good to add a fixes tag like below when a patch fixes a regression, so that stable backports the fix as far back as the regression: Fixes: b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS") > a kdump kernel. This change restores the appropriate flags, without > reverting to the former practice of resetting KBUILD_CFLAGS. > > Signed-off-by: Steve Wahl > --- > arch/x86/purgatory/Makefile | 35 +++++++++++++++++++---------------- > 1 file changed, 19 insertions(+), 16 deletions(-) > > diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile > index 8901a1f89cf5..9f0bfef1f5db 100644 > --- a/arch/x86/purgatory/Makefile > +++ b/arch/x86/purgatory/Makefile > @@ -18,37 +18,40 @@ targets += purgatory.ro > KASAN_SANITIZE := n > KCOV_INSTRUMENT := n > > +# These are adjustments to the compiler flags used for objects that > +# make up the standalone porgatory.ro > + > +PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel > +PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss Thanks for confirming the fix. While it sounds like -mcmodel=large is the only necessary change, I don't object to -ffreestanding of -fno-zero-initialized-in-bss being readded, especially since I think what you've done with PURGATORY_CFLAGS_REMOVE is more concise. Reviewed-by: Nick Desaulniers Vaibhav, do you still have an environment setup to quickly test this again w/ Clang builds? Tglx, we'll likely want to get this into 5.3 if it's not too late (I saw Miguel Ojeda mention there might be an -rc8)? > + > # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That > # in turn leaves some undefined symbols like __fentry__ in purgatory and not > # sure how to relocate those. > ifdef CONFIG_FUNCTION_TRACER > -CFLAGS_REMOVE_sha256.o += $(CC_FLAGS_FTRACE) > -CFLAGS_REMOVE_purgatory.o += $(CC_FLAGS_FTRACE) > -CFLAGS_REMOVE_string.o += $(CC_FLAGS_FTRACE) > -CFLAGS_REMOVE_kexec-purgatory.o += $(CC_FLAGS_FTRACE) > +PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_FTRACE) > endif > > ifdef CONFIG_STACKPROTECTOR > -CFLAGS_REMOVE_sha256.o += -fstack-protector > -CFLAGS_REMOVE_purgatory.o += -fstack-protector > -CFLAGS_REMOVE_string.o += -fstack-protector > -CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector > +PURGATORY_CFLAGS_REMOVE += -fstack-protector > endif > > ifdef CONFIG_STACKPROTECTOR_STRONG > -CFLAGS_REMOVE_sha256.o += -fstack-protector-strong > -CFLAGS_REMOVE_purgatory.o += -fstack-protector-strong > -CFLAGS_REMOVE_string.o += -fstack-protector-strong > -CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector-strong > +PURGATORY_CFLAGS_REMOVE += -fstack-protector-strong > endif > > ifdef CONFIG_RETPOLINE > -CFLAGS_REMOVE_sha256.o += $(RETPOLINE_CFLAGS) > -CFLAGS_REMOVE_purgatory.o += $(RETPOLINE_CFLAGS) > -CFLAGS_REMOVE_string.o += $(RETPOLINE_CFLAGS) > -CFLAGS_REMOVE_kexec-purgatory.o += $(RETPOLINE_CFLAGS) > +PURGATORY_CFLAGS_REMOVE += $(RETPOLINE_CFLAGS) > endif > > +CFLAGS_REMOVE_purgatory.o += $(PURGATORY_CFLAGS_REMOVE) > +CFLAGS_purgatory.o += $(PURGATORY_CFLAGS) > + > +CFLAGS_REMOVE_sha256.o += $(PURGATORY_CFLAGS_REMOVE) > +CFLAGS_sha256.o += $(PURGATORY_CFLAGS) > + > +CFLAGS_REMOVE_string.o += $(PURGATORY_CFLAGS_REMOVE) > +CFLAGS_string.o += $(PURGATORY_CFLAGS) > + > $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE > $(call if_changed,ld) > > -- > 2.12.3 > -- Thanks, ~Nick Desaulniers