From nobody Sat May 18 00:52:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1646659670; cv=none; d=zohomail.com; s=zohoarc; b=Mpq8r9Now5cOwxbvF1TiXbEnGxzr5WJKec9rh3rPSERr5L1zTShTdxh00J1l8xWk9hhjSfHvETl0E3IPXj44IktS0rrfOn/JK+0ZB2k9jBS27YWfO5yVG7qZmHfoguGhxyDH+/gDcs+u/b1kdxYdktc/IgJt8GzhPEXIEZ8AAFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646659670; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=IbRWvxKAVDMglKSxqJP2F8H3lkA/vy48jGpIObbaCWw=; b=X/XmEq+2+/x4X2ZG/XAfbgO60zpa5fehyBcy4JvZmiymAYvtp1Ig4vh0meYQLkq7pddGhGgl2ZewCAMO3kvNcOOUTrEdjbIZrBzlVlnCdbfhAlGJuh1qU3yQvBAAD+YXCVnWj5nS67lFT78XA4ELSgnT6mylYA5Qu/bekUqBWp0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16466596703552.2510751933675692; Mon, 7 Mar 2022 05:27:50 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.286037.485357 (Exim 4.92) (envelope-from ) id 1nRDOW-0007VY-1q; Mon, 07 Mar 2022 13:27:24 +0000 Received: by outflank-mailman (output) from mailman id 286037.485357; Mon, 07 Mar 2022 13:27:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nRDOV-0007VR-Uk; Mon, 07 Mar 2022 13:27:23 +0000 Received: by outflank-mailman (input) for mailman id 286037; Mon, 07 Mar 2022 13:27:23 +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 1nRDOU-0007VL-V2 for xen-devel@lists.xenproject.org; Mon, 07 Mar 2022 13:27:22 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5047a127-9e1a-11ec-8539-5f4723681683; Mon, 07 Mar 2022 14:27:21 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 5047a127-9e1a-11ec-8539-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1646659641; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=8WBhbeFM83plyJRJ4bS9p+w4+qcZkh9ZBtc9lqg5Il0=; b=R/AhZsHXd00PMtd2D3DdRz5dDcTdRqQ+vuJB2A1fO1UIcZiACnfZazEM HfOE4uzi4ablmmi8vwcO6PAkKF2J1x4GjjQZB+birkL0iRWcxp5cOK1D+ PN1+PT918Wkll+SXdhP7g+u8du71oq5VPoZMMww44qIZv2e2YbxaI4tf5 4=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 65605479 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:BQT+96yWp9c93w7XsaN6t+dHxirEfRIJ4+MujC+fZmUNrF6WrkVUz zQeW2qBOKzfYjGgLdsiPIm28R8FsceGyoJjGVZkrSAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnj/0bv656yMUOZigHtIQMsadUsxKbVIiGX9JZS5LwbZj2NYz2YfhWWthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ NpljMaMR18HfazwpOUxVzcbOHlxIIRn5+qSSZS/mZT7I0zudnLtx7NlDV0sPJ1e8eFyaY1M3 aVGcnZXNEnF3r/ohuLgIgVvrp1LwM3DFYUToHx/ixreCu4rW8vrSKTW/95Imjw3g6iiGN6AO pRBNGYwPXwsZTVWJXwnLb03tdz3j3bZegZXhm6QnfIotj27IAtZj+G2bYu9lsaxbdpRtlaVo CTB5WuRKjMwOcGbyDGF2mmxneKJliT+MKoCGbv9+vN0jVm7wm0IFAZQRVa9ueO+iEO1R5RYM UN8x8Y1hfFsrgrxFIC7BkDm5i7f1vIBZzZOO9Rg1A/V5OnV3zqYKmwqDRUZZ8EPldBjEFTGy WS1t9/uADVutpicRnSc6qqYoFuOBMQFEYMRTXRaFFVYurEPtKl210uSFYg7TMZZm/WoQWmY/ tyckMQpa1z/Z+Yv3r7zw13IiinESnPhHl9svVW/so5IA2pEiG+Zi26AtAKzARVodt/xory9U J8swZT20Qz2JcvR/BFhuc1UdF1T296LMSfHnXlkFIQ7+jKm9haLJN4Mvmwveh82aZZUJVcFh XM/XisLuPdu0IaCN/crM+pd9exwpUQfKTgVfq+NNYcfCnSAXASG4DtvdSatM5PFyyARfVUEE c7DK66EVC9CYYw+lWbeb7pNgNcDm3FlrUuOFM+T8vhS+efHDJJjYexeawXmgyFQxP7snTg5B P4Eb5rak0gECbamCsQVmKZKRW03wbEALcieg6RqmiSreGKKxElJ5yft/I4c IronPort-HdrOrdr: A9a23:MM0rHKO6eOw0tMBcTs2jsMiBIKoaSvp037Eqv3oedfUzSL3+qy nOpoV+6faaslYssR0b9exoW5PwJE80l6QFgrX5VI3KNGKN1VdARLsSi7cKqAeAJ8SRzIFgPN 9bAspDNOE= X-IronPort-AV: E=Sophos;i="5.90,162,1643691600"; d="scan'208";a="65605479" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH] x86/cet: Force -fno-jump-tables for CET-IBT Date: Mon, 7 Mar 2022 13:26:51 +0000 Message-ID: <20220307132651.25691-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1646659671426100003 Both GCC and Clang have a (mis)feature where, even with -fcf-protection=3Dbranch, jump tables are created using a notrack jump rath= er than using endbr's in each case statement. This is incompatible with the safety properties we want in Xen, and enforced by not setting MSR_S_CET.NOTRACK_EN. The consequence is a fatal #CP[endbr]. -fno-jump-tables is generally active as a side effect of CONFIG_INDIRECT_THUNK (retpoline), but as of c/s 95d9ab461436 ("x86/Kconfig: introduce option to select retpoline usage"), we explicitly support turning retpoline off. Fixes: 3667f7f8f7c4 ("x86: Introduce support for CET-IBT") Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu --- xen/arch/x86/arch.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index f6fc852b5767..8e57476d6573 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -51,7 +51,10 @@ CFLAGS-$(CONFIG_CC_IS_CLANG) +=3D -mretpoline-external-t= hunk endif =20 ifdef CONFIG_XEN_IBT -CFLAGS +=3D -fcf-protection=3Dbranch -mmanual-endbr +# Force -fno-jump-tables to work around +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104816 +# https://github.com/llvm/llvm-project/issues/54247 +CFLAGS +=3D -fcf-protection=3Dbranch -mmanual-endbr -fno-jump-tables $(call cc-option-add,CFLAGS,CC,-fcf-check-attribute=3Dno) else $(call cc-option-add,CFLAGS,CC,-fcf-protection=3Dnone) --=20 2.11.0