Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp79685ybe; Wed, 4 Sep 2019 15:30:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZ1xNXi3ddpY8m/jjqypM744GCPymWieVc4yzm6GnNKgbl0shYFAlPklF3UGyJE6IsWu/z X-Received: by 2002:a63:534d:: with SMTP id t13mr361544pgl.313.1567636246084; Wed, 04 Sep 2019 15:30:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567636246; cv=none; d=google.com; s=arc-20160816; b=dK8ecpZ/YKPlynrl55Hs1G9IyO4e2Z+VELOxaDzlHWONqs8arxMBy7KhD7xN2fxlVG KATB4c7bV1VN2XaTGXWcMlQ/V8HKCVs55GSb+JmLa3zevUE4GTkzXc/QgGP1Vsp9ZslH pl1LEosxI8chh39APxH67v3r/ma8wPYZdyzlEPFKEkZcZWRxsdTsNsqvWz9pMD8hxmj1 rcY8dtr2qXDJmlVvMKeUAa+MEByQEzdHT7wiPjj5Lx+hx8OhVs4bXElv5vH00R9iMD7F 6c3u0SXVg7rcuUADhnA6nT8RaaqOvUVamY2w5Lg/qicJIYhK3nctyN25dgCKYomhKeQt LylA== 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=126flrf1A3cL3mz+nUSHlYojF+EVKVDxSC6U82okBVY=; b=RsCBa1sBH3LrP9Pdyn45T0CnyCQlvhJVq6ete25jGzyXODxTXpVLZ/tC/lhtOvKT8Q KL7IPEhDx0x+e0UlpNQ1t8iU+iBCITRDh2hG4x0rbujUusQIaW+rsld7XiyoCn7iScez r9ID88O8SF9lj8r09cxE6HMTtu+Eo1NutfWI4bSt969/xzo3l/dU6dmgvnZcq9My+0ch cvBLQKNmpVfsPWj61hpx/W3KjO7tZ4joDfC+kkvruVO+yUp6aCj0mBJL8e9gBTYouRbB Vu9EewC2ayuoSrWJfLdAbILyaSjWBaO/0W+SSkBT6ZVQzbNc+Jtt4mVie42fXiT5zFqi 8LpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=j45t4Wou; 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.30.30; Wed, 04 Sep 2019 15:30:46 -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=j45t4Wou; 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 S1730219AbfIDW2P (ORCPT + 99 others); Wed, 4 Sep 2019 18:28:15 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:34152 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727562AbfIDW2O (ORCPT ); Wed, 4 Sep 2019 18:28:14 -0400 Received: by mail-io1-f67.google.com with SMTP id s21so200122ioa.1 for ; Wed, 04 Sep 2019 15:28:14 -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=126flrf1A3cL3mz+nUSHlYojF+EVKVDxSC6U82okBVY=; b=j45t4WouLX5NDL22pWBGeIDHoUkIf57zOrKuKTrDdXFkdhudfHr4rKqTyrdi9CCmIS co7xFmgjIgHRqewrmO/UxS3Pe5F4UICZt3Gpz++LSvHF24mMe0y+zVVhRG0B1pEbtG7R APuSG5h3M7zYSsNXNK1r7iTFCJIOGpQeaTw8GkmvDGWe/2q7O5Ngzey49dzjK3A/MPiw lyueua7ePwhicylVYuL84W2ooF874zW1YHUj1AdlbVymi1tbFQuA1T+h59OJp5sMG33G tRE0Tybv0voiNCbGI0QyPexlDQiCxnYmOCvTOPWJjAT9kimUrXGcXKl8JTRL1zNtbaPl cPdQ== 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=126flrf1A3cL3mz+nUSHlYojF+EVKVDxSC6U82okBVY=; b=tL6zn/+UjQzs7WykH4a3Cid6204ChWO+7bsCBT5f/018aUqXYCzUbumcqukGmh3OWm RI+RFP/fHwkMnjl+xlFXs4dFwQvJhAM1Ny9yp6johx6+nIXRUl5IQm/xDuZuLlQYRpWe M3sPgX4spW2yeR7917987qkYRAUZpvCQjgZm6I4lN+OWbWnD30baO+bL288T6YiqSC6F FzxtJcXjYe7nnc9Q0pv6aM8Ud1CGTrxhW4JCq5h75mjXvl26AfN74vw169uqxgdQFo7g lKkVuONQcp6Rs7vobsYB8vCJ+BhjbMp+VI6mrAqh/SWUbXduT9thUwB7AqFoe6M3UwQf D8NA== X-Gm-Message-State: APjAAAXJRX8L4ucQwWtRju22cfea0kJ2t9lS9iZQqmPFHJCYrVqHqc0p xYH81S/q8A38TtXZ4aK5//jprBDhsQhA5GeFNSvSMQ== X-Received: by 2002:a02:93e5:: with SMTP id z92mr672371jah.8.1567636093257; Wed, 04 Sep 2019 15:28:13 -0700 (PDT) MIME-Version: 1.0 References: <20190904214505.GA15093@swahl-linux> In-Reply-To: From: Vaibhav Rustagi Date: Wed, 4 Sep 2019 15:28:01 -0700 Message-ID: Subject: Re: [PATCH 1/1] x86/purgatory: Change compiler flags to avoid relocation errors. To: Nick Desaulniers Cc: Steve Wahl , Thomas Gleixner , LKML , clang-built-linux , 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 On Wed, Sep 4, 2019 at 3:19 PM Nick Desaulniers wrote: > > + (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? I will setup the environment and will try the changes. > 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