From patchwork Wed Feb 16 16:21:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12748743 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id AB8E0C433EF for ; Wed, 16 Feb 2022 16:22:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.274290.469710 (Exim 4.92) (envelope-from ) id 1nKN47-0004Nl-LR; Wed, 16 Feb 2022 16:22:03 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 274290.469710; Wed, 16 Feb 2022 16:22:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nKN47-0004Ne-IS; Wed, 16 Feb 2022 16:22:03 +0000 Received: by outflank-mailman (input) for mailman id 274290; Wed, 16 Feb 2022 16:22:02 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nKN46-0004NT-0R for xen-devel@lists.xenproject.org; Wed, 16 Feb 2022 16:22:02 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8f37ed2b-8f44-11ec-b215-9bbe72dcb22c; Wed, 16 Feb 2022 17:21:58 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8f37ed2b-8f44-11ec-b215-9bbe72dcb22c DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1645028518; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=D1BziOChSKGR/TxZIuNhqH1cTbshReBw7WPjgUO2h1A=; b=GHlc2fplMwK/4CCVdHmX0ftM+s4p7Q9vKxk+d9e1nK5NTDWvsX2hG5iQ graFXoWm2yW+YnmrUQwOcxmogTYRW5l7zWvxKawKSUceqffeaB7FnPnI3 7vUSJfZ7gndlz+w2zhzgiLiDg1zuPR7imIz7CFs57Duq7ESHpiNCVzj2C Y=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com IronPort-SDR: WiLMvEK0EY48zZ8lOhwRekVUdgJK6muWjPAq7DaL4ZzFsMbnre6QQ+iIQldxNOkylr4Pd9IiJa SxvWHm+8dzZWSDnHVezpDakJA8lMlm/BJYWfT+rdUewA+tgeO8djeAYcQPxGJlGoIvHQpev7LT GrAxohNPATnF2Ml4tYw52pVS5VJ1V9b6cDm31k1f+AMa31vNHmWiKE1IYpnjR+ldyjIqhG8tUg uTUAYwbXQsjStQuoSvPOfmWVRvk0WXSuvSZVlE0xWRHgVaVcJVT7RPs9FCnFkLdabVmXfH6ddG Mw0uVOyrmDVmDgbSpng5la4f X-SBRS: 5.1 X-MesageID: 64256043 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:Zw7+pKqd/runSbpkFfPwlx1XBGheBmLEYhIvgKrLsJaIsI4StFCzt garIBmPOf7cZ2L1L95yaoi2oRhS6sXVztJqHAI/+yg8RXhApJuZCYyVIHmrMnLJJKUvbq7GA +byyDXkBJppJpMJjk71atANlZT4vE2xbuKU5NTsY0idfic5Dndx4f5fs7Rh2NQw24HnW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+JWoIKQglvVZ6EaP+mw16rk2IaneZ+AxnBLtVJIR2++4l2MS3hyPQwJphUexnEwzKb0 SeQAAsZ+raR89NkroGRiPnd/YmzEuZ4Ek5LJEXh7O67ZXvA426u4Y5cS+LULzrTY3z5pfe5b uJPwvCibPBexARWs5BxGqpAxL4l44e9vKdTywlpESmZb1mvDb88cHCK0dMW6/9Iz75d/wC3R liO6p9RPrDQYJHpF1sYJQwEaOWf1K5LxmmOvKpteEiqtjVq+LenUFlJO0jegSNQG7J5LYc5z Lpzo8UR8QG+1kInP9vuYvq4LIhQwqjsi5kai6w= IronPort-HdrOrdr: A9a23:kjivu6jdaK+VyqZhLlvZn9Td7XBQXuYji2hC6mlwRA09TyX+rb HLoB17726QtN9/YgBCpTntAsi9qBDnm6Kdg7NhWotKNTOO0AHEEGgL1/qF/9SKIVydygcy78 ddmoFFeaTN5QcQt63HCXODfOrIauP3iJxA/t2z80tQ X-IronPort-AV: E=Sophos;i="5.88,374,1635220800"; d="scan'208";a="64256043" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e0liJgRmy/Z+yST0MTLAocwWaKTvsORwn5U2ywYp01jQKxJGmUzOyCLJYWbdIXKlhLIcPa6n6VxnvsNpctX1IlOtrg2CNZnP1vvg1He2Hqr+ejY73mzqM5l25A03qJ00C2Zn6tXG6pkABkwOPpjkTDpJPkp+nHPWVrbeufAoWlytKe19wT37PCOfCSrEY7WA8o/YH+NDVJ+FR0BywlJQr3L/omPTDwfhKOyLox/4260slcMwFA//Cc4XEg0g12mYBasXLySquUeWDogLCN7a8SBdj9SGPWJ03YOsawPwwVDBoGMOAPYxKmqxkdvFsZTSKlQT2jPbicVarESexHzQjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7/LvDOtIy8kR/1dSVBF5RKlkbq0t2dXqF+GqtyJfVrM=; b=hGKQoDz8tgWwGgWKqRlazu4m9KkfUCTdVicjxrMz0yg4iNlMr3xiJ/B46+69DfPVfPjivfb09s1PAjOdwEIHFKSwQ8V3sgIiQELhZMUaE5C6MAoSw9Ibsz/P19GoC1hmFR5MKyXsplvhjl68kBQqhFEGr/9rsVjBcmh91QQZjhh5oplRXGDVLBYqAQ/ctrMa9QbvQNWn1/NLIDAdeOZnai6aGfDoFIdPHC9ogZcmVSjSgVWVZL9KejXMLc13e2FXMmhdT/m5mt/RXuhsqaviMYRP3v06OWXxbiohF1beptZqn3di5BnTQp/c5mXlhYZcjJIqNkoi0h7xuICpfGr1sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7/LvDOtIy8kR/1dSVBF5RKlkbq0t2dXqF+GqtyJfVrM=; b=ELR1Fqh7S7ucMWx8sFYYUC/yIL+FdpRYfWFD/AITL+DY45Ru4Jp95czDdmAt4PVNWyoHjsFoKrfrbCfJO+fFdSZJVJCvYsbh5eptdCHcau3txgYUyfI2jSIPraAMWdjBTkjxVpaFZevV1vCrElQaZVsaee72ciu4BudjHt7dZfU= From: Roger Pau Monne To: CC: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu Subject: [PATCH v2 1/3] x86/retpoline: rename retpoline Kconfig check to include GCC prefix Date: Wed, 16 Feb 2022 17:21:40 +0100 Message-ID: <20220216162142.15384-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216162142.15384-1-roger.pau@citrix.com> References: <20220216162142.15384-1-roger.pau@citrix.com> X-ClientProxiedBy: LO4P123CA0042.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:152::11) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8912618-61c7-414b-3a33-08d9f1687155 X-MS-TrafficTypeDiagnostic: SN6PR03MB4143:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O1/5QDIIdnrp3/a1umCzagELeemVooAbiIgtigd0HmCk8P8jecUwilbEQVWrL6kkZ02ENzYT3+Seic+GpDqwp05ZXbr4xbJM97RoWNgVDFOtuunQfDVAsUVFNlmhV2rsebnvuSsHxagPcOuwq2BJUEKzsyc+mQ8KsETthDmg+2kHOF5FnydI/0RRQGaz4H6Cu22FEQTgFWEUeevAyY094Eqn+5ewpO5pWE5mxBnxE7ExSaTMCXVVppOxJNuoiz0QcmKenDsalO6ppKP5Y/agnOV1rCM/DriZ4fl+kYMbGWfrOyPNcVOIIltV9GpjjlmlxhlTXdIXgT0WHTOoaSvXUFIPG8ORCyJ6gkWeImtmlVeUicYa685GHxen+vZkCow1DjVfec+UjLmzXOqaI8uNmdFiWH2Q2r0a2SlC+oPZgZEgDO3i7UjKXBOBAWAl6dPg++uQrXAM9yfzS0dIyczMveUoEIVworHr6DTVSb4v63cJWVSOyyP3DASja6N1w6F1GTLn+T9Vz+p2TVX6BsLbXpmxt6FdMFYN8Q47kR5b6T9L0z+h/0wzficwYRwfgs34NcxCczOrgx//cI75WqPcoW2yHUK/QaeyElY4a7ZFDyQdd0NJnergsovF2ClJs+bKRckdoN5xMOCYrVxoTnWt5A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6916009)(508600001)(4326008)(86362001)(1076003)(186003)(6506007)(316002)(8676002)(6512007)(66476007)(36756003)(2906002)(54906003)(5660300002)(83380400001)(6486002)(66556008)(2616005)(66946007)(26005)(6666004)(8936002)(38100700002)(82960400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?uv6FByUdmBqhjdgkXrNjXCtXenBN?= =?utf-8?q?X0K0fUjgjA3TWxna2tlsur0yEEcISWzsilXSnYxf0HTC9ELAXDKAJlc68Qq2gyV/7?= =?utf-8?q?NVLTCwOoR4C1YilqREEO4b2x+ipxnHZK5OoZkKJpmdpERZ1JAvelOIWp81U630YE8?= =?utf-8?q?BnzzF/QcYxr56Yh483rAe1tw7AFJ4hmrb1hmodPmATmKCPW61BY5kok9jnJtpYPRL?= =?utf-8?q?IbGaoCLQGZegWQ9XT4ARjrJUMHA/cYqfn+L3TwPDiN+m0MYxtCuNFm0vng/nPr3gy?= =?utf-8?q?ze4xevlgyR11bUwdLSwDyIp/wjN5IguWYWzIaixvjm5p/qiNxKsoZoJ9KbajHdfqt?= =?utf-8?q?LltWpFk76slHN+S9urIE3RZh5UHV8I56r21KiJlo0xdwr157Fb3vlTiTR6AmCVGKg?= =?utf-8?q?kBPRw4gSzKJxV0PO81V1patbpxu4eyo3ElxqxDWuZHvGdB8e4DyoRYyg1UHvJ7KY1?= =?utf-8?q?+EI6ZvjfDyzQuUHpA3cLwA0LNlq3blSTCkgocZh8BXEI9AJi95puz82O3yfscSLe6?= =?utf-8?q?ZIgW2U+zsnZnm8fbpFy9Oo3VI7ej1hD4YcTLZadV2K3EkaGmovd82csj63XV4VkUq?= =?utf-8?q?51lh5SNrTMmW3liiiscadX/wIksV6Pbgf9SS9YuBEELPpsa9MPKdirwVCAOHyJZaA?= =?utf-8?q?gNFmvrpU84QEyYxS6R8TxF256btgwN5tk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iqBTeRjC2HJUD6xwFW/LKQQxz421QzjkA=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: c8912618-61c7-414b-3a33-08d9f1687155 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 16:21:53.1970 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Po+kZwuMy//R1Bt3sv0dqCw2B+cBWJLQGqr0bNU3Pc+wjLpdYa3O4ReOsTVvRsC9DbYO8aDriqCOy8UgtNA3RQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB4143 X-OriginatorOrg: citrix.com Current retpoline checks apply to GCC only, so make it obvious by prefixing the Kconfig option with GCC. Keep the previous option as a way to signal generic retpoline support regardless of the underlying compiler. No functional change intended. Signed-off-by: Roger Pau Monné Reviewed-by: Jan Beulich --- Changes since v1: - Put def_bool before depend on. --- xen/arch/x86/Kconfig | 6 +++++- xen/arch/x86/arch.mk | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index b4abfca46f..219ef9791d 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -32,9 +32,13 @@ config ARCH_DEFCONFIG string default "arch/x86/configs/x86_64_defconfig" -config INDIRECT_THUNK +config GCC_INDIRECT_THUNK def_bool $(cc-option,-mindirect-branch-register) +config INDIRECT_THUNK + def_bool y + depends on GCC_INDIRECT_THUNK + config HAS_AS_CET_SS # binutils >= 2.29 or LLVM >= 6 def_bool $(as-instr,wrssq %rax$(comma)0;setssbsy) diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index fa7cf38443..2da4bdb1ed 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -42,10 +42,10 @@ CFLAGS += -mno-red-zone -fpic # SSE setup for variadic function calls. CFLAGS += -mno-sse $(call cc-option,$(CC),-mskip-rax-setup) -# Compile with thunk-extern, indirect-branch-register if avaiable. -CFLAGS-$(CONFIG_INDIRECT_THUNK) += -mindirect-branch=thunk-extern -CFLAGS-$(CONFIG_INDIRECT_THUNK) += -mindirect-branch-register -CFLAGS-$(CONFIG_INDIRECT_THUNK) += -fno-jump-tables +# Compile with gcc thunk-extern, indirect-branch-register if available. +CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += -mindirect-branch=thunk-extern +CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += -mindirect-branch-register +CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += -fno-jump-tables # If supported by the compiler, reduce stack alignment to 8 bytes. But allow # this to be overridden elsewhere. From patchwork Wed Feb 16 16:21:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12748741 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 85E5FC433F5 for ; Wed, 16 Feb 2022 16:22:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.274291.469716 (Exim 4.92) (envelope-from ) id 1nKN48-0004RT-18; Wed, 16 Feb 2022 16:22:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 274291.469716; Wed, 16 Feb 2022 16:22:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nKN47-0004PY-Qx; Wed, 16 Feb 2022 16:22:03 +0000 Received: by outflank-mailman (input) for mailman id 274291; Wed, 16 Feb 2022 16:22:02 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nKN46-0004NT-Mm for xen-devel@lists.xenproject.org; Wed, 16 Feb 2022 16:22:02 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 916820ed-8f44-11ec-b215-9bbe72dcb22c; Wed, 16 Feb 2022 17:22:00 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 916820ed-8f44-11ec-b215-9bbe72dcb22c DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1645028520; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=JHqA1stN/h7CkLREvasdTybcxRF2lyYLB/1/bAsoRGo=; b=CG7Jkn/Z9mEGgT+r8WvO3T1/+5pGNnJIxpIAwGyaDm22+Bgg/DO6orNx EXE8hOf8d/3fl1/dLmxpxagkZ7tGGPzMKeQ5FVV40wT8rbxxSrIhXC44y cpxFCOjOfaEK9TNGIxWCredYRAHL/pJ/k/W/Pv0AemO3nc65HPTv4vZoR 0=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com IronPort-SDR: LtBb+DVRLzoTfbdBNP60pqhrCZqUsiy1PUemff9wYnqeTFlBBaMXu3QXdvatExslLtS+GsIgdG NOtxvNCTcwZ9FW3sQojB733CYrZdJW9G73ELYnEXAyvyl0EMMw6wv1crZYefKfhSLP/q5aQ1r6 UdEhVcdYVb0JYRV2R6PXviXnyYzpdx5F4htu3WVtAHpa9Q42aC3UG6GyHu6n57feLpK+def49P uuxsZ/GM/dsIC9MmXRKBJxRI92vobPkB34xQIaCW/1HDfEpv8I0IGSNsChcrYpwxkXd5WVonhd BW/NopGiUVJHZkEnovXU9WRi X-SBRS: 5.1 X-MesageID: 64256048 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:KDx1Na6lPxdl9F6X0BcIwQxRtOTAchMFZxGqfqrLsTDasY5as4F+v mUbCjuEO6uCYjT2etx1Ptm0809QusfWm9ZkTANl/Hs8Hi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuV3zyIQUBUjclkfJKlYAL/En03FV8MpBsJ00o5wbZj29Aw27BVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Z+ YwWqLqdEggQLqTItORCUyYEFQddFPgTkFPHCSDXXc27ykTHdz3nwul0DVFwNoodkgp1KTgQr 7pCcmlLN03dwbLtqF64YrAEasALNs7kMZlZonh95TrYEewnUdbIRKCiCdpwgmtq254WQaa2i 8wxdDdCTEvKbBB1F3Q3Gq8lwvuSiDryWmgNwL6SjfVuuDWCpOBr65DyNPLFd9rMQt9a9m6ar G/b+2XyAjkBKceSjzGC9xqEluLJ2C/2Ro8WPLm57eJxxk2ewHQJDx8bXkf9puO24nNSQPoGd RZSoHB36/Fvqgr7FbERQiFUvla150UBffcLHNQq4QWhyvXU3FqfIEstG2sphMMdiOc6Qjkj1 1msltzvBCByvLD9dU9x5ot4vhvpZ3FLcDZqiTssCFJcvoK9+N1bYgfnE447eJNZmOEZDt0ZL 9qiiCElz4segscQv0lQ1QCW2mn8znQlo+Nc2+k2Yo5Hxl4hDGJGT9bxgbQ+0RqmBNzEJrVml CJZ8/VyFMhUUfmweNWlGY3h5o2B6fefKyH7ilVyBZQn/DnF0yf9IdwBvWgkdRY4a5xsldrVj Kn74145CHh7ZiXCUEOKS9jpV5RCIVbISbwJqcw4nvIRO8MsJWdrDQllZFKK3nCFraTfufpXB HtvSu71VSxyIf0+lFKeHr5BuZd2lnFW7T6CHvjTkkX4uYdykVbIEN/pxnPVNbtnhE5FyS2Im +ti2zyikUUPCravPXOOrOb+7zkidBAGOHw/kOQOHsarKQt6AmAxTfjXxLIqYYt+mKpJ0OzP+ xmAtoVwkjITXFXLdleHbG5NcrTqUcotpH43J3V0b12px2IiccCk66JGL8k7erwu9epCy/9oT qZaJ5XcU6oXEjmXqS4AaZTdrZB5cEj5jwy5ICf4MiM0eIRtRlKV94a8LBfv7iQHEgG+qdA6/ ++7zgreTJdaH1ZiAc/aZeiB1VS0uXRByut+U1GReotYeVn28ZgsICv016dlL8YJIBTF5z2by wfJXktI+biT+9c4qYCbi7qFooGlF/pFMnBbR2SLv6yrMST6/3a4xdMSWui/Yj2ABnj//7+vZ LsJwqikYuEHhltDr6F1D61vkfAl/9LqqrJXklZkEXHMYwj5A79sOCDbj8xGt6kLzb5FowqmH EmI/4ACa7mOPcrkFn8XJRYkMbvfha1FxGGK4KRnOlj+6Q924KGDABdbMBS7gSBAKKd4bdE+y uA7tc9KswGyh3LG6DpdYvy4I4hUEkE9bg== IronPort-HdrOrdr: A9a23:pvIjl6rfanF8uPK3pFo3lxwaV5oXeYIsimQD101hICG9Ffbo8/ xG/c5rsCMc5wxhO03I9ergBEDiex3hHPxOkO4s1N6ZNWGN1VdARLsSi7cKqAeQeREWmNQ86U 5ISdkGNDWuZmIQsS+B2maF+nwbsaG6GduT6dvj8w== X-IronPort-AV: E=Sophos;i="5.88,374,1635220800"; d="scan'208";a="64256048" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HhO8ffn98OsJYe7Vbfje5Sd2hy1/bzrzNRago4iq018a8Yhr1dxnOveI3KzMkJuoJ3QZkDb89a5hALzvvsoxYQ1/MEWTwrvSnoIaHXLuOw92l5sLfvBa3rWA6Lj/HwqMRcMsIz0az3Shs62p8ZmiH1I/ti+huF2PPwSi/kZ8QqiAfZVY0U5bkU2wRyCSj3C5aj7Syh81G8rxl+Wh6eCHbTaTY00+fkP8uYXEBKKjRsanwaCE2Z4O54wADuDVKy522Ru5tA/RBbZzkmEGf4JUnOZFj8bDUnjmPeI9yvrwJUNRMUz1183r7BWZZ5KwbF5ucPmgpAdC4PsqQGyCkg2SHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=J/c6eVyHYJXVUlazWNeV+ylcxSqZ5nGqV/mmllNoyMw=; b=av1yU3eMMX5oMtJjsffdN9h1A+PThG1Eh/A+mehnlrTgIZXeOHDOl3QW48/XQVCRr9juOYy6N6y8w3OlMeJNb1zXqNB0pDBSr5ln0zE0eitbYwGXX/qh4y48VARb476AAKhs35H/Wn8lv2AadaMSEKjqFdobJKcdd9qyWNzMgnmiSJWyzwZyZ6CYNlnChL+KHQNkZqOxjQlIeaktbWlztzH5KK2IDWG+0J4pg8ByxoB6E09/NtfSnsIprk5Io+w7/0u/a8KuYChTmIuleZM8DezPtS1aq0kLxoMU0svwJwbOt6oQe3nMTK2nLMRB2eYNRyvWDcZ5lhxZkV8DcuVRYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J/c6eVyHYJXVUlazWNeV+ylcxSqZ5nGqV/mmllNoyMw=; b=AMUoVtDGYiFfPg6nKjX5uFKnVUpIwfQA8RYaAA5I5drOQH+UPE8w+qP/ScjA1jN5HPIDoYml9JYjiEpaeSUFlpUz1qNOsQ1FJepfn4I0xCsuTUFzVP667ofcInK33ZVot0tPnzpMSYSt/1itwnseTU9JIkY2prQ3joAcBOx6tnQ= From: Roger Pau Monne To: CC: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu Subject: [PATCH v2 2/3] x86/clang: add retpoline support Date: Wed, 16 Feb 2022 17:21:41 +0100 Message-ID: <20220216162142.15384-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216162142.15384-1-roger.pau@citrix.com> References: <20220216162142.15384-1-roger.pau@citrix.com> X-ClientProxiedBy: LO2P265CA0220.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::16) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00291384-75d3-4571-d4ba-08d9f1687419 X-MS-TrafficTypeDiagnostic: SN6PR03MB4143:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lNYh/dr0P2vrPoR+Bd9L+NCodfTQb5J5TTxMBo0Briyz28YMxEe1YkJONZjZkINFnghOqlw85EUlGr6LAirxHLS1Hra7Jsbq6Th7NGmRqNK4ZdRwewTuZQ4qpxV31CuoR2jKRtRpQIkGZttIgPXr1rwjDd3xASeFjW2jxnBOi/wjOnVejrQ+fWt9aCvFmuY1qFQ9l8nGee4J9gPFDI2w8JdGzABB/5bL01ElSYQkGnoP/LSMOIqUI7h7sE+E/H8iep/cxcv7pdCFOS5R8US2LdBaXz5xffoHLMpAHHAWHq/3OCTV6DnU36v1cRap/XYccSV2xrn3jvVXALqRyeh33FDzQFt7jFo7pBaTFHlHMGd3HdgXrEVdgezR0pPRj+JXQwqCn9zT+K23yWfOfgJqXeDItjqz5P94t5UcZACcFQUeFplB1gsaCQQu2bdEzJe8it77ymOLHQB917lxTRCKRJJUu9xh+b9Yk4bGVzlOjyVlKBG2qqFf6kqMeNoX43WPfA2fUzOAG835gqMuFRHzV4qBhAAe/E/ftNJ4NknEXI1b+Y7AWjL25wqHjll4IlLpkQ4OLEJp2MJNx5jq5cqH8jLZtdsspwUP9n8xQ1oYnCSIncB1+h8C+BeLeR/ia0MGlLvhU0xM+WQ0QdMpfXhukw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6916009)(508600001)(4326008)(86362001)(1076003)(186003)(6506007)(316002)(8676002)(6512007)(66476007)(36756003)(2906002)(54906003)(5660300002)(83380400001)(6486002)(66556008)(2616005)(66946007)(26005)(6666004)(8936002)(38100700002)(82960400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?/WpJYK640J50urB4BuIAEZvyzYRa?= =?utf-8?q?k9jF9Dxl8tLwCAhmz9Stgt4ZY2oi5kWEFXBrtIhH8rXgvrwSAqO+uPkSCSu+nQrop?= =?utf-8?q?W27uLHaaG7R09ixz9VmVJX3EvHl8GybRIEz4b2VxEUSeHEmiwjGT4OZnsLWx/cQTd?= =?utf-8?q?75FiNlGvjvPIq6Mo0Kcc5BbX5OGJq4a5Aj2KssrakKICbOmHPDSUuKBZZE0BMBV5w?= =?utf-8?q?VMXrgvhlMfYs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2vo8xvWW3eTdrSzhIce+wuGIAAmQdMfmKtnWJ0LNOoKumfJ0zMuiBh?= =?utf-8?q?7SukqwQ8HKL3ojBUb6RVKF2TvBE8GzoZQoqnvg6GdnlaMP1OGIDHkuu25XRGCprFx?= =?utf-8?q?1P7Zl1ZaF1j8X7DxxV47QInXdAvXDJHATWkKCYw9o0akqdV/6oQM/Bo95qkNmHYkp?= =?utf-8?q?VfPlebH8og93wFFSzT/6VqvmaYJsoMbuDkyCcEz9M6a3o8GyKW5hpw3zDayzACOGx?= =?utf-8?q?l+9uPIDlyfof1ICkhtz7mqsZP6EurWBEvTY40YHJ0eQeDTdLIwL2YCdYAbcimL0hM?= =?utf-8?q?Z0D+V51g1eAyDgeVhwdIPnVnlvCjTXGNhEUwJ2uNLGmTveb2RfgCzYgJmAmGynRKF?= =?utf-8?q?eHxWHacM8RCy/atVfTFhbNZij8TSv4VO9bPi9J1LTil3oddam8Li6YZ3fwYMhRhQl?= =?utf-8?q?1W3LG86n7aAddSVH38Jh7bSpRkLspba1roT3Psx1YWUlIYBt2PLk8yw=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 00291384-75d3-4571-d4ba-08d9f1687419 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 16:21:57.8878 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8hxIRmJ60n3eWgB12EXULdL9jqvJEI+yOE5c2uS1nESGqNK9fGGM1477MdlnZlsr2pWUYoPSEzyH2131NNKecg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB4143 X-OriginatorOrg: citrix.com Detect whether the compiler supports clang retpoline option and enable by default if available, just like it's done for gcc. Note clang already disables jump tables when retpoline is enabled, so there's no need to also pass the fno-jump-tables parameter. Also clang already passes the return address on a register always on amd64, so there's no need for any equivalent mindirect-branch-register parameter. Reported-by: Andrew Cooper Signed-off-by: Roger Pau Monné Reviewed-by: Jan Beulich --- xen/arch/x86/Kconfig | 5 ++++- xen/arch/x86/arch.mk | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 219ef9791d..2fa456292b 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -35,9 +35,12 @@ config ARCH_DEFCONFIG config GCC_INDIRECT_THUNK def_bool $(cc-option,-mindirect-branch-register) +config CLANG_INDIRECT_THUNK + def_bool $(cc-option,-mretpoline-external-thunk) + config INDIRECT_THUNK def_bool y - depends on GCC_INDIRECT_THUNK + depends on GCC_INDIRECT_THUNK || CLANG_INDIRECT_THUNK config HAS_AS_CET_SS # binutils >= 2.29 or LLVM >= 6 diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index 2da4bdb1ed..f2aa2a515f 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -47,6 +47,9 @@ CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += -mindirect-branch=thunk-extern CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += -mindirect-branch-register CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += -fno-jump-tables +# Enable clang retpoline support if available. +CFLAGS-$(CONFIG_CLANG_INDIRECT_THUNK) += -mretpoline-external-thunk + # 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) From patchwork Wed Feb 16 16:21:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12748742 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 55169C433FE for ; Wed, 16 Feb 2022 16:22:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.274292.469733 (Exim 4.92) (envelope-from ) id 1nKN4G-0004xu-AR; Wed, 16 Feb 2022 16:22:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 274292.469733; Wed, 16 Feb 2022 16:22:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nKN4G-0004xj-5Z; Wed, 16 Feb 2022 16:22:12 +0000 Received: by outflank-mailman (input) for mailman id 274292; Wed, 16 Feb 2022 16:22:10 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nKN4E-0004NT-Ex for xen-devel@lists.xenproject.org; Wed, 16 Feb 2022 16:22:10 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 95981576-8f44-11ec-b215-9bbe72dcb22c; Wed, 16 Feb 2022 17:22:09 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 95981576-8f44-11ec-b215-9bbe72dcb22c DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1645028529; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=MXv+Whc/VwisieV7Q/pmLCawQze7jVoZkFb0ogwdHvQ=; b=TLF29kI1+uhUi7sGnegG9LGm2317sSypZATFPZt6wQgs2RSaStukkT08 m86daPmze/K4IEYYacs99YYCA9/XFg2FdeSTmpWRETuqWeKmqJcYsyi++ pB6zt0XhEB453yRu/yFuHksMn5yd5zVkBBvClD3NYv3qpUITsvjK6DQB/ I=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com IronPort-SDR: 1QVe5MJQGRHXQHb1UoGG4501ENCQntVhSev1Rl3Z5v3CPh9ALa474VjML37iCPqMPUPniDXL2V Pg4RNwSdGJfpFOQug4H3tkRrUvmsdZKlebCNl1v7XvHNtSDyT3STEgoQxX6mwFYv7xGrmn66aT uPLhaPwJEHkdQ8VZEH2Kqa/9vnFbNFN3uvy+PcFZ3avCdfRQIrozCgIUpMecMKIEusgk53jgCl lQPegJpT/t2aMST/yzAw5ERSMznTStEkpzwUuoHgEAkb1R+iLs2XyvSO8iMvrQN5UF/13AfHcF ZP8Ek/6mxFSocrlcJ/KA8zY9 X-SBRS: 5.1 X-MesageID: 64355270 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:I9LQVqsSAloxerXofd0JUReoIufnVNJZMUV32f8akzHdYApBsoF/q tZmKWCBaKneNGH0fIwgb9jkphwOvMTczINiGgM//Ho9EHsU+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZQP0VOZigHtIQMsadUsxKbVIiGHdJZS5LwbZj2NYy2IbhWWthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1h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ZyXd+2Oix65GUfqJIm+BBD+lpv36a LwMnf/mMfABkFJbiKZGEu5mnfAk+t/ih75G1QA4Tn/FWEumV+F7KX6c0MgR6qAUnu1FuRG7U 16k88VBPenbI9vsFVMcKVZ3bumH0v1IyDDe4e5sfRf/7S5zurGGTV9TL1+HjykEdOl5N4Ysw OEAvs8K6lPg1kp2Y4je1i0EpX6RKnEgUrk8ssBICYDmvQMn11VebMGOESTx+pyON41BP0RCz uV4X0Yea2CwHnb/Tkc= IronPort-HdrOrdr: A9a23:RE/AFa87zDjwDRQYKvluk+DkI+orL9Y04lQ7vn2ZLiYlFvBw9v re+cjzuiWE6wr5NEtApTniAse9qBHnhPlICOAqVN/JMTUO0FHYSr2KhrGSoQEIdRefygd179 YYT0AgY+eaMbEBt6nHCaODYq4dKaK8nJyVuQ== X-IronPort-AV: E=Sophos;i="5.88,374,1635220800"; d="scan'208";a="64355270" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FyVJ3McVpA1Otk5PIgKZROpbyYzT8PDgRlyw3Mx/yNjv3/oFTqhzIF2HdDMXB0jRdsBWpb4NxZCVicFvLM4CCKmf9ji9RLLVk38lxiFwcqQHSG5C/pK3xOZOXXEPwrAw3N4Ld5lt+UN5unsog3sXhCIR8i3ULgSR80xs2bIZ7h65lO20o2lEwPLSpGvBqnb0KYIu3yt1WKcoMJ77hZjsUxr9dJN29F7Awu6zrkoI2XvaoFardummhSWPic6ymPQbtZd6+4i1OFae6m2wVV5fNTowBl31uT0Cog46W92BQv9KVLuMoPHyqy3LO21Mzwe8D/mfb86zNHelCy65eXBoLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/baYjNnC5E1KhoJ7tzV137/mk2WyOVplKJZMdD4Ofn8=; b=e+LT2WKVuSIousfE1ov996QJ9K88QXCR2LAE+fWWt3TveRBwOZV4FC2x6/WedIk71aL98kwJH5eS9tBN8VpvXilTcIi7sT/n90PzyapRxCbiZ6A5ZHh+i0qNYXy/n7uQJiT3DfATQMfV9ftZxbvjuWLQv6jUgic5Psziank0SatbaUEc0qZmX56XnVQ9OyuWdQ1SNIagPzRyhkoLw+cJG9mdQQ8TcjEC5fDCxFTNXjqLgzO+w2j29ou4nodc2NRDd45KvKMuP+gkvwyFYhOWvF8wX6ydBgeuor33JmD+vdbPI1HvQfVWdldzZX+y4YbKwfP3me97/KRvlJ+n62/omg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/baYjNnC5E1KhoJ7tzV137/mk2WyOVplKJZMdD4Ofn8=; b=tGtOkstw7FgfIV2r8RIHhllWuwRK9jcIC27dCnxM1hz5UcV157WUOMNA8ZjmSaExc0bKkkBDIl23kG8RFKawruHBjQUI3XvNIAm5+cAP4yL2JBubtgtkbcsnk9R+GuygtAd1SZNsfXdodTp7R+2uCrUR9fM/JjmJs7rorUi+9BI= From: Roger Pau Monne To: CC: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu , George Dunlap , Julien Grall , Stefano Stabellini Subject: [PATCH v2 3/3] x86/Kconfig: introduce option to select retpoline usage Date: Wed, 16 Feb 2022 17:21:42 +0100 Message-ID: <20220216162142.15384-4-roger.pau@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216162142.15384-1-roger.pau@citrix.com> References: <20220216162142.15384-1-roger.pau@citrix.com> X-ClientProxiedBy: LO2P265CA0012.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:62::24) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cbeb1994-8bd5-47e2-7118-08d9f1687768 X-MS-TrafficTypeDiagnostic: SN6PR03MB4143:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RCxLCB2bSjk4POxcGbrUpVasm/oMsEw/EwVLSoah1LaOCqFsqe1PUKQwUnsXUUQS1QtIYnlIrM256zoLYPZM2KVj/C4H4YMHN8nqBYUR2ZjedpIKiUCefnuTCqvEeAHTZtqO+ssWX5Fgk3jD5t8TH8SuO0YiTUhD4gR3auINK8cZfM7+Q2lpBImEaUoGrc+RBPeDi/riEPcq5ozRGGKaJl6gOs5BUNZfhUvjXD6+ZMDelBl9nLVigq97Otn9cpY+NFWitmScZrysuxosWg/TvVsJCTrgVvuJnf7IMrdsTk8Ouc543Kd5liRLa/bPOH9XAFvXN8XpTyiyXreEwbN1KaiCJrvaR9Sm8zkhGob8UzxwK31SLnRojPA1ITiyp9DpVGMVL/9Lx1mhHSm9GHO2HtcL50BWvxqyFAh7Ew/phabUXGvUCJExmHSBKR8/JZghJ4JdVBjqOvktusr1zWH4rGOloIuvjFIpNojNhqNYwLbJ7LkYo3ZmmGEgrWx81rqWeCXYHjWwoxZSu7h/zKTLhq7xMkcpBZ4Fu+HzPSMAceyrxL2Tb6Hya9JUJlIISNavfD1MWQyzJ1byQhC7MtcJte4YmpTruzR8zq1QjYN5oJhl1lxtSGzLRBN9FiAL5a7n8efxwhT2KfZaBQ6IzFwp6A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6916009)(508600001)(4326008)(86362001)(1076003)(186003)(6506007)(316002)(8676002)(6512007)(66476007)(36756003)(2906002)(54906003)(5660300002)(83380400001)(6486002)(66556008)(2616005)(66946007)(26005)(6666004)(8936002)(38100700002)(82960400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?MtWdCICVNBOMem2zx1lpEnRiXSEs?= =?utf-8?q?MRheKC9vJvRUwDvTga7Lu8+Y+Q8XB6t3Z4zHwWZlqXGBR048iCeFYTzJRXSSJ01vA?= =?utf-8?q?H5L8aWvlo6QTmLonzvT0WerVXNzdLRScBeS4+TN2bvHCm/G0iag6hLA81tB0ZOzdT?= =?utf-8?q?PmS52vh6dlXWEHzjMT+6mGGvimyhyIPkOxvSzKESZj1MHcsBd3iz0CeDqpmKTJtKH?= =?utf-8?q?HME8zNNMqkL5tu5gKOZXvtbCpDdFO++iQ443UZSPZCG6X0FvyftDEOI4dloz/3nXz?= =?utf-8?q?fkx4W3AWtPpZ5qKByPI7II/mCNMmFh/6lOHzGMPKigZXnjaMBxzxDEKPZPTJgMpXO?= =?utf-8?q?FQSHGI9VM1GcWRs91Vv7eaUytMrh3aTVd4lCLrl6gpNZXXm4R1z4jL0jpyTxmZjfG?= =?utf-8?q?POcuvvhI4QgSqjXxX5KuV2Yv9zEuHBH75qpYv5K+m+QPQgq9zId14A8lUgN8Pedum?= =?utf-8?q?Qzw2SERV5ppvq4VQVueX2VllVztqBORQhX/ipW3JYF0bNwfE/nDaJqbhpzNAUcf0R?= =?utf-8?q?vitQg9u9/tSfV7s0WjsMeIPUCnwYHQxG4YllVvT/12FJX60ksAxBuHv8Uyxnv9B9Z?= =?utf-8?q?AgoZyyP6jMNGD3EsinHvVx92qJlnObKMKoGUPfOJVh93CcPfJmTb8oEJX7FDCiIHK?= =?utf-8?q?fwZ6vFRrqNs/5i1Pxc38PHYoOA1qhTpAnS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NPQ798Qno=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: cbeb1994-8bd5-47e2-7118-08d9f1687768 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 16:22:03.2955 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Jyv6/WKnWvnLgY+hwpW8ntiV2XgyxlIrNSvV3RJrrvtjc7f+GprbjqHMjRg/dWs5O7x0bIsdJ3VNah57Pb+d6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB4143 X-OriginatorOrg: citrix.com Add a new Kconfig option under the "Speculative hardening" section that allows selecting whether to enable retpoline. This depends on the underlying compiler having retpoline support. Requested-by: Andrew Cooper Signed-off-by: Roger Pau Monné Reviewed-by: Jan Beulich --- Changes since v1: - Fix description of option to use indirect branches instead of indirect calls. --- xen/arch/x86/Kconfig | 4 ---- xen/arch/x86/arch.mk | 2 ++ xen/common/Kconfig | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 2fa456292b..7c73802adc 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -38,10 +38,6 @@ config GCC_INDIRECT_THUNK config CLANG_INDIRECT_THUNK def_bool $(cc-option,-mretpoline-external-thunk) -config INDIRECT_THUNK - def_bool y - depends on GCC_INDIRECT_THUNK || CLANG_INDIRECT_THUNK - config HAS_AS_CET_SS # binutils >= 2.29 or LLVM >= 6 def_bool $(as-instr,wrssq %rax$(comma)0;setssbsy) diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index f2aa2a515f..0597e714f9 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -42,6 +42,7 @@ CFLAGS += -mno-red-zone -fpic # SSE setup for variadic function calls. CFLAGS += -mno-sse $(call cc-option,$(CC),-mskip-rax-setup) +ifeq ($(CONFIG_INDIRECT_THUNK),y) # Compile with gcc thunk-extern, indirect-branch-register if available. CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += -mindirect-branch=thunk-extern CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += -mindirect-branch-register @@ -49,6 +50,7 @@ CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += -fno-jump-tables # Enable clang retpoline support if available. CFLAGS-$(CONFIG_CLANG_INDIRECT_THUNK) += -mretpoline-external-thunk +endif # If supported by the compiler, reduce stack alignment to 8 bytes. But allow # this to be overridden elsewhere. diff --git a/xen/common/Kconfig b/xen/common/Kconfig index db687b1785..e688e45513 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -146,6 +146,22 @@ config SPECULATIVE_HARDEN_GUEST_ACCESS If unsure, say Y. +config INDIRECT_THUNK + bool "Speculative Branch Target Injection Protection" + depends on X86 && (GCC_INDIRECT_THUNK || CLANG_INDIRECT_THUNK) + default y + help + Contemporary processors may use speculative execution as a + performance optimisation, but this can potentially be abused by an + attacker to leak data via speculative sidechannels. + + One source of data leakage is via branch target injection. + + When enabled, indirect branches are implemented using a new construct + called "retpoline" that prevents speculation. + + If unsure, say Y. + endmenu config HYPFS