From patchwork Tue May 12 19:11:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11543807 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D60D8912 for ; Tue, 12 May 2020 19:13:17 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A81702492B for ; Tue, 12 May 2020 19:13:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="IX6PR4MF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A81702492B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jYaJi-0002Qw-Dc; Tue, 12 May 2020 19:11:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jYaJi-0002Qq-0x for xen-devel@lists.xenproject.org; Tue, 12 May 2020 19:11:50 +0000 X-Inumbo-ID: 6dae7a82-9484-11ea-ae69-bc764e2007e4 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 6dae7a82-9484-11ea-ae69-bc764e2007e4; Tue, 12 May 2020 19:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1589310709; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=oMCdGSDqIXHcN3yrHbB182v6Q6Qj/Ianz2JO6oKJY2I=; b=IX6PR4MFFU/bz0O8a5EdaZZhfcUZ5iIOJXQWMMOcycD/60yfqHylwgju lf3hSuEqiqWHWprWJCPeccx/xKWzzuyGvozVy7ifd5hRop9jP5vnTAIgY iJruB7MYZAbMupvQ0kVbfOL0lew45mS8tDx4GDa4yO1joJFkLQqHAjFP8 8=; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com; dmarc=pass (p=none dis=none) d=citrix.com IronPort-SDR: PBwiuavzafFtcce7TY/uOXgN1tTXnJ+s1m+WMDEnJTkyadmsH7TPFfUwRDQDuQmV67huSJee6e /G4x1e/Igmwppwy/Nt1vKUIE90uZP+K59wXFR32m/yrPVyrKP3RcfuTLgRATacAcWvRqJdWmdC f447dNQL5Gw2m32E1Tq3re8yrcrqM6pG4w32pbHR+UbRRuMLz2ZzJBCk6h7AFtp55pN1ONzEU6 VK/Q/586PvfBzNP+bDcTCI7QwoujHHGXhH3DKEviXZPl7hM0doEuxxqciXYC1xike67kCeT0UD zNM= X-SBRS: 2.7 X-MesageID: 17620682 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.73,384,1583211600"; d="scan'208";a="17620682" From: Andrew Cooper To: Xen-devel Subject: [PATCH] x86/build: Unilaterally disable -fcf-protection Date: Tue, 12 May 2020 20:11:16 +0100 Message-ID: <20200512191116.6851-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Jason Andryuk , Andrew Cooper , Stefan Bader , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" See comment for details. Works around a GCC-9 bug which breaks the build on Ubuntu. Reported-by: Jason Andryuk Signed-off-by: Andrew Cooper Tested-by: Jason Andryuk Reviewed-by: Jason Andryuk Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné CC: Jason Andryuk CC: Stefan Bader Sorry for messing you around with how to fix this. I'd neglected to consider the CONFIG_LIVEPATCH interaction. With that extra observation, there is no point having the extra complexity given that the result with CET-IBT and Retpoline still isn't usable. --- xen/arch/x86/arch.mk | 9 +++++++++ xen/arch/x86/boot/build32.mk | 1 + 2 files changed, 10 insertions(+) diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index 2a51553edb..93e30e4bea 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -67,6 +67,15 @@ CFLAGS-$(CONFIG_INDIRECT_THUNK) += -mindirect-branch=thunk-extern CFLAGS-$(CONFIG_INDIRECT_THUNK) += -mindirect-branch-register CFLAGS-$(CONFIG_INDIRECT_THUNK) += -fno-jump-tables +# Xen doesn't support CET-IBT yet. At a minimum, logic is required to +# enable it for supervisor use, but the Livepatch functionality needs +# to learn not to overwrite ENDBR64 instructions. +# +# Furthermore, Ubuntu enables -fcf-protection by default, along with a +# buggy version of GCC-9 which objects to it in combination with +# -mindirect-branch=thunk-extern (Fixed in GCC 10, 9.4). +$(call cc-option-add,CFLAGS,CC,-fcf-protection=none) + # If supported by the compiler, reduce stack alignment to 8 bytes. But allow # this to be overridden elsewhere. $(call cc-option-add,CFLAGS-stack-boundary,CC,-mpreferred-stack-boundary=3) diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk index 48c7407c00..5a00755512 100644 --- a/xen/arch/x86/boot/build32.mk +++ b/xen/arch/x86/boot/build32.mk @@ -3,6 +3,7 @@ CFLAGS = include $(XEN_ROOT)/Config.mk $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) +$(call cc-option-add,CFLAGS,CC,-fcf-protection=none) CFLAGS += -Werror -fno-asynchronous-unwind-tables -fno-builtin -g0 -msoft-float CFLAGS += -I$(XEN_ROOT)/xen/include