Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3276150pxu; Mon, 19 Oct 2020 08:15:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVgP9z8SbCpnU+9nyL3EB2kKadibqNMHJYC1wKZ27mSbGKwAUe1J8GEArBGB+hmhJBPaLL X-Received: by 2002:a17:907:40bb:: with SMTP id nu19mr361691ejb.246.1603120515431; Mon, 19 Oct 2020 08:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603120515; cv=none; d=google.com; s=arc-20160816; b=V5PMlDLIu71WeggN6PQzpRgFx63gphz3J2IIbGgvDmSsRI/26UDKiiRzt3SCWEeZRb 2JKj5dx/exQZgepvWx1mag3wp5ScaYfC4X+SKAo9ZPwlp7cnFNTN5Rlh07CGKVC6ILDC ndx65FnsSY89JvBp8yOtkEXMbtNeIxuZHt5LCYjvV+V6eirjO1HICXyLeAdUFW9C0hMp 6t0oDvc+9/TWTmtZCFnr62L6+nEz36DeNHEILUkdXRzLW1FwDSHE34ndpxi4RvMvnaKg nB3B1DhVpQ+rR0X0BnVJRPL6mjC0rWXtGQQ2/npAlyK3yGjxYdNodLLMPuSpPnkLY1E2 GEPw== ARC-Message-Signature: i=1; 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; bh=HiPUIy2IHbwGlGx+VGVzbdfKiUB1yRUMSXHIibASOkY=; b=KA4/m8HrNf+v1Of8ZNXW2L4JPeSCErjQA8o5az3lRAUBy95yn163uNVwGFCgB7vEI+ oINgVyjtUV4CIEmmxjNRmCS5K0IHW4epLYOK1A17CGjHWstlzVXGNkorA2v+DWRdM0oZ 1n2GkDR1ssiThHgrldAc9rxeR+/GbmQ8vI/j7u1K4CwRNd0re2XtePMlT9yWZr7ybEhA 48rYbcXY3ItZhZoQNKehuhEN7dxd5ED6ozDBhhaXuaQIQGwBJqDELh/mTJYqcYT7fLh2 Ih+Yf4HZ9L1fu7UIXpCZ0mqV+263bY3JZs/UaTq7jjVW/xFdizehyoV269jiy6JF2Gfy 67rQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bg11si168459ejb.200.2020.10.19.08.14.49; Mon, 19 Oct 2020 08:15:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729865AbgJSPLZ (ORCPT + 99 others); Mon, 19 Oct 2020 11:11:25 -0400 Received: from 8bytes.org ([81.169.241.247]:33420 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729776AbgJSPLY (ORCPT ); Mon, 19 Oct 2020 11:11:24 -0400 Received: from cap.home.8bytes.org (p549add56.dip0.t-ipconnect.de [84.154.221.86]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by theia.8bytes.org (Postfix) with ESMTPSA id 25864171; Mon, 19 Oct 2020 17:11:23 +0200 (CEST) From: Joerg Roedel To: x86@kernel.org Cc: Joerg Roedel , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Kees Cook , Arvind Sankar , Martin Radev , Tom Lendacky , linux-kernel@vger.kernel.org Subject: [PATCH 0/5] x86/sev-es: Mitigate some HV attack vectors Date: Mon, 19 Oct 2020 17:11:16 +0200 Message-Id: <20201019151121.826-1-joro@8bytes.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel Hi, here are some enhancements to the SEV(-ES) code in the Linux kernel to self-protect it against some newly detected hypervisor attacks. There are 3 attacks addressed here: 1) Hypervisor does not present the SEV-enabled bit via CPUID 2) The Hypervisor presents the wrong C-bit position via CPUID 3) An encrypted RAM page is mapped as MMIO in the nested page-table, causing #VC exceptions and possible leak of the data to the hypervisor or data/code injection from the Hypervisor. The attacks are described in more detail in this paper: https://arxiv.org/abs/2010.07094 Please review. Thanks, Joerg Joerg Roedel (5): x86/boot/compressed/64: Introduce sev_status x86/boot/compressed/64: Add CPUID sanity check to early #VC handler x86/boot/compressed/64: Check SEV encryption in 64-bit boot-path x86/head/64: Check SEV encryption before switching to kernel page-table x86/sev-es: Do not support MMIO to/from encrypted memory arch/x86/boot/compressed/ident_map_64.c | 1 + arch/x86/boot/compressed/mem_encrypt.S | 18 +++++- arch/x86/boot/compressed/misc.h | 2 + arch/x86/kernel/head_64.S | 14 ++++- arch/x86/kernel/sev-es-shared.c | 26 +++++++++ arch/x86/kernel/sev-es.c | 20 ++++--- arch/x86/kernel/sev_verify_cbit.S | 77 +++++++++++++++++++++++++ arch/x86/mm/mem_encrypt.c | 1 + 8 files changed, 150 insertions(+), 9 deletions(-) create mode 100644 arch/x86/kernel/sev_verify_cbit.S -- 2.28.0