Message ID | 20230524155339.415820-1-john.allen@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp2929697rwl; Wed, 24 May 2023 09:05:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Fwly0hvhOiHkce2OwEFf1vHnrMFFQDHfBdd9f1Etf5w+Zq+L5o6Mm4IpblyTvhroGn8Vm X-Received: by 2002:a05:6a00:2303:b0:643:a6d1:b27 with SMTP id h3-20020a056a00230300b00643a6d10b27mr3098698pfh.15.1684944334887; Wed, 24 May 2023 09:05:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684944334; cv=pass; d=google.com; s=arc-20160816; b=OgG21zL5et4Cg+PVsjfLSNgJm6aAVrd2pFDrIieyQukXmqHJcPCSHzT6NqyLTeG3Dl aoXzlAfPslct1oAKv7xqqsSqpXYdLz28nHykhrvvZC44/3IZSyX/OFP+IiVuLRMOWQ3x 2+RFUFl8i3teIgTKMGkkUmMZekeVa4TrWRZuTRAQEH2geyS0V1oOKEuTld4sL9lm3wUc TplTNMt6n1nn59DnMR/P0yUCkk/Q8tFkibeLnquTNU7ZUJ+I2h/8k0HZUhRxcOaz/vvi +BhD8odgx/NnGhqyVehCBmqqBJ9F9hAWqHLY9BiZ9lUOh97QSNnFN0rxleuufhhRcOje Hhmg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=F8KNqdnjtKWcEXSXUqLQ+v026bq+7atcJwrPjkBLIxQ=; b=Cvezt3REXhvmqaZz6NoileJxMjdpBy3bk/OAKs0qrUHz+ZgS9JAZyNGzCcVKmOtCwB rEFC7m3AbnP1nU+6K4GJmG18R9Uj61A1HOw62sgbPaaLKs87LwkwT358bmnMjDCTDrV+ pYHN16Jg9oZFFrd0OpNG/ixg6R0si9bjDtsbTxDdMd0Nfut7YezpNoofJfXJH/4knHrv C/FdoTAfNRRmrmVPfHZ30MtKNR1MkMDNE19VYMElNd2ImnsJMjinsmcDiUnlzZrZZCmq Sw+x5XE01pnpUg085sk1vqGBszotYCe1Nd2YOUhnv3omGaSEuA7TL7APT65cGrmwmawv GyLw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Ah7gqAOC; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r16-20020aa79630000000b0064d675fc97csi380014pfg.27.2023.05.24.09.05.21; Wed, 24 May 2023 09:05:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Ah7gqAOC; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237403AbjEXPyI (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Wed, 24 May 2023 11:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232134AbjEXPyE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 24 May 2023 11:54:04 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2059.outbound.protection.outlook.com [40.107.244.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2620093; Wed, 24 May 2023 08:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MuZHcTV2c1Hw6aFt1H2HzXbUVNHyje4SH4mBJhg1WSZ9mypLuoV3HRZG/U2ANlDGNfOOpt+IUcJohX5WfpmQ9xQyWAXvo4KDCkfuY4HB1O9p7bRT9c8bUbcwq8a7dU6Dnl4iO8unJ5S3lIpt+Nq4XdrIQ2paCGROfnejQok09R+iPDBl7zu0Rtrs5w1b/N+CDJoVK3bdkW0ccz4eT8lBAN/Bq1S99ECOrJk7nsYyffXB2yaFHVwXwvjqvQP4C8svyiJsLHlbg6f3MWDvqkBUfcYaAPvfv9sHkcXKxUA5FvHoO8b18ojWmr2g71QN9RU6ObzWvGz9Yu0OmW8gz4p6Sg== 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=F8KNqdnjtKWcEXSXUqLQ+v026bq+7atcJwrPjkBLIxQ=; b=JWHqASk00xWb7J3fYm4ueJ65ZTe5/KkdkcD6LKdisAkHOXjkBs0rhoP+u4czyTQLCwenHGiXxwNu1tZfS7Tf7K083VoRmCbW8WPStb/Boa97U50EaykpuZUdKIubCrcU0qzQc2EMztOcZ40P/X84Y8EXAw1Hh4auniW6TkjHq09n3uOkqOW1pCsqW3eMImcYP0ymH8UCaA5gLoVf3Nnt+9lMTSEPup5PwUqYq912A36B8HNDc2/AN/R1FYohP/vJuWirzw65wIvM9Ed0h8x5yMuL51vZuLdWnVpBfiIrPRNheBLeagDWPuQziOULRslDFvao5b8VypIqK+jwVgRUFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F8KNqdnjtKWcEXSXUqLQ+v026bq+7atcJwrPjkBLIxQ=; b=Ah7gqAOCkFqdXAn+gT2Duiz+YRHvfxY29CEUHAtuQFHqQ5SPYdovr8NMhtVpefOODDNdkSDWTEZ0ldDOwDVIZwLy4UxLiT1hkDstOAsPwnQeWdAQqe09PjaWVWkMFEen+9QHXHPPfOUKAkMHxwK9WvIPDiXvn1JG0iB31cnivA0= Received: from BN9PR03CA0058.namprd03.prod.outlook.com (2603:10b6:408:fb::33) by CH3PR12MB8209.namprd12.prod.outlook.com (2603:10b6:610:123::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Wed, 24 May 2023 15:54:00 +0000 Received: from BN8NAM11FT101.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fb:cafe::ca) by BN9PR03CA0058.outlook.office365.com (2603:10b6:408:fb::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Wed, 24 May 2023 15:54:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT101.mail.protection.outlook.com (10.13.177.126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.16 via Frontend Transport; Wed, 24 May 2023 15:53:59 +0000 Received: from jallen-jump-host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 24 May 2023 10:53:59 -0500 From: John Allen <john.allen@amd.com> To: <kvm@vger.kernel.org> CC: <linux-kernel@vger.kernel.org>, <pbonzini@redhat.com>, <weijiang.yang@intel.com>, <rick.p.edgecombe@intel.com>, <seanjc@google.com>, <x86@kernel.org>, <thomas.lendacky@amd.com>, <bp@alien8.de>, John Allen <john.allen@amd.com> Subject: [RFC PATCH v2 0/6] SVM guest shadow stack support Date: Wed, 24 May 2023 15:53:33 +0000 Message-ID: <20230524155339.415820-1-john.allen@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT101:EE_|CH3PR12MB8209:EE_ X-MS-Office365-Filtering-Correlation-Id: f00dbde6-3216-49c1-13c6-08db5c6f1705 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1+XA7MpPBFyl9F1PGjydwpXFMz0iiod2Pe4jnfj/LoCjHkAD+BdW79eAFkNJsFotTrswSwZ4//uB1rtQCDWw088YX3R1M81HZ0Ej2kWYnrjHkOfjHbnuKVlSwa9MFTHQSoitqX38+pLcn/vj3uplDM5HAI/SDM4Sd6ruk9yW+Rv96ItVodaVSwGwTFBYly8IQgI7gIDH7FmnmhL+nun7nd/IBmvUB0fl/VfH+V54CXPbq9rI6ZWoxDF6pQEnORPSK2H8xtIicj/XvzlhgpyPYjMHaQStTbrhdHN2midWm4neQH+iSFaV6nvFCgggo3JT3EESXy7xZBbCruw69wlyz6oXnmUJ3N29FWJwnnmGodmuoFcK3jT8PkQnTfBAB667Iqte1iqjz27mEKOXP3N3omd/NcF4mgXYFWwK8ghVbqrYjkHyNoeZ2168wE4CFPfBV7cW0fwlciGi0IFv7YbUNtYu3lfypBdHxZ/e+lNMB0K7CP5c8/rPiFhIXdvcOU4XpG8ugNyA8uHeBCCMon8E1IfDyMYMh5IfH/wsitrhAABdLDxI8mvsNOTKmeBCOMw7+oAA7/l8n2+PMdodd56oJtdawb+cSLgIeXUG1im5zjoA/zk0UD7JkJ/+DYXlPe1hx8xxAF7JRW0OCZJNqiCMlwsmTPKXAFVoMNKnAa4drPpVF+iwzVSuTUwbMRZ6q7X9QQ5fmiZzenJnyNZWXVwk2tlmJUcyy35pYenG55XqvithqNXqz2r82VadI7MqV2SY/EUjyCnQYYHxWxG8qjT+uVHSes1wyFWn5A+2GNmXZdk= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(136003)(396003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(54906003)(6666004)(26005)(1076003)(70586007)(70206006)(316002)(4326008)(6916009)(7696005)(41300700001)(966005)(478600001)(8936002)(8676002)(5660300002)(40460700003)(40480700001)(2616005)(83380400001)(86362001)(426003)(336012)(36756003)(2906002)(82740400003)(356005)(81166007)(82310400005)(44832011)(186003)(16526019)(36860700001)(47076005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 15:53:59.9766 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f00dbde6-3216-49c1-13c6-08db5c6f1705 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT101.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8209 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766792190676267607?= X-GMAIL-MSGID: =?utf-8?q?1766792190676267607?= |
Commit Message
John Allen
May 24, 2023, 3:53 p.m. UTC
AMD Zen3 and newer processors support shadow stack, a feature designed to protect against ROP (return-oriented programming) attacks in which an attacker manipulates return addresses on the call stack in order to execute arbitrary code. To prevent this, shadow stacks can be allocated that are only used by control transfer and return instructions. When a CALL instruction is issued, it writes the return address to both the program stack and the shadow stack. When the subsequent RET instruction is issued, it pops the return address from both stacks and compares them. If the addresses don't match, a control-protection exception is raised. Shadow stack and a related feature, Indirect Branch Tracking (IBT), are collectively referred to as Control-flow Enforcement Technology (CET). However, current AMD processors only support shadow stack and not IBT. This series adds support for shadow stack in SVM guests and builds upon the support added in the CET guest support patch series [1]. Additional patches are required to support shadow stack enabled guests in qemu [2] and glibc [3]. [1]: CET guest support patches https://lore.kernel.org/all/20230511040857.6094-1-weijiang.yang@intel.com/ [2]: CET qemu patches https://patchwork.ozlabs.org/project/qemu-devel/patch/20201013051935.6052-2-weijiang.yang@intel.com/ [3]: glibc tree containing necessary updates https://gitlab.com/x86-glibc/glibc/-/tree/users/hjl/cet/master/ --- v2: - Rebased on v3 of the Intel CET virtualization series, dropping the patch that moved cet_is_msr_accessible to common code as that has been pulled into the Intel series. - Minor change removing curly brackets around if statement introduced in patch 6/6. --- Note to maintainers: This series is split into two parts. This series pertains to KVM and should apply to the KVM tree. Another patch which I will be submitting separately entitled, "[RFC PATCH v2] x86/sev-es: Include XSS value in GHCB CPUID request", pertains to the guest kernel and should apply to the tip tree. However, I realized that both series depend on the following line from patch 5/6 in this series: Please advise on how to resolve this situation. Thanks, John John Allen (6): KVM: x86: SVM: Emulate reads and writes to shadow stack MSRs KVM: x86: SVM: Update dump_vmcb with shadow stack save area additions KVM: x86: SVM: Pass through shadow stack MSRs KVM: SVM: Save shadow stack host state on VMRUN KVM: SVM: Add MSR_IA32_XSS to the GHCB for hypervisor kernel KVM: SVM: Add CET features to supported_xss arch/x86/include/asm/svm.h | 1 + arch/x86/kvm/svm/sev.c | 25 +++++++++++- arch/x86/kvm/svm/svm.c | 84 ++++++++++++++++++++++++++++++++++++++ arch/x86/kvm/svm/svm.h | 2 +- 4 files changed, 109 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index e7c7379d6ac7..8f91376273e0 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -677,5 +677,6 @@ DEFINE_GHCB_ACCESSORS(sw_exit_info_1) DEFINE_GHCB_ACCESSORS(sw_exit_info_2) DEFINE_GHCB_ACCESSORS(sw_scratch) DEFINE_GHCB_ACCESSORS(xcr0) +DEFINE_GHCB_ACCESSORS(xss) #endif