Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1380828ybg; Thu, 4 Jun 2020 08:18:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzc6IqAtLpaFTVSWWbQPVyJlenKUsHEMn5ERpZVaK12ym5ToUkTHlzfnH8fyLFwL4JdGt1i X-Received: by 2002:a17:906:490f:: with SMTP id b15mr4195350ejq.180.1591283891186; Thu, 04 Jun 2020 08:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591283891; cv=none; d=google.com; s=arc-20160816; b=zej+K3HjfBdKmxOM8LRCkc5FPq4LRgGAxY7Yy50f1Fw9mquYBbHE+3BjZlG/WrR6sZ PKcZWqODzc3zhSZ2nP6Ew3X+CoHQYkd0WxK5gnKC2MR7crMXZRwH+uG0Da3lPEFd6N42 AeRzmL7ltncEuUM84HbXaPeX3LsP2oiARHmBXXs/QB3Qf0N9TChM/tvuLU61TCNnmBln n/cINODfYqSg2xg9qvA4+iCVNS7C/BN2owgoQUMtfHvbS3x0Ea9V3e3Fn63LV6BXDuPp bjTxdlRquVjZTBT2+FX/wguDAASCHWXtK8x10WpP7U5jr+U/j4YHdGzB6XE9QsAVehgZ vr2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=Zb1/JaoCGs1TmDMdLgQpkcgONOnX2U8xflu8cOzal44=; b=CXsSnbi86ysq1M2XT2rctY8GHrPLPoKDPMwcS89umZtN2MFX1O8lknxWyFV4H1mae4 bdx7sGPTZZo44Oxm+5NaJ5kli14RlDtcfujMl+mwfUEbmltv0kXEs8wwddS28rZwd72N Tq5Bop5eOu2bld2iAK2EiDYrGM1XX3ZiS6x63xOYzEkfEzR3GSRv8YSOfMt8E2tYd0jX K6o6HTF9G9rUWljU+XYTc7ilLll3X7OGezZzn9EDFXbSn2HEVTVmRXKFdSkNQxMCZ9vj PTQPQEPT+uuqQ9RvuxPX5li4QZUHKDziS0fk6QOIWekkXuCawhuisKELmdngVWOTQKd6 Zk8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AzUKdjZs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a9si1683928edt.344.2020.06.04.08.17.46; Thu, 04 Jun 2020 08:18:11 -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; dkim=pass header.i=@kernel.org header.s=default header.b=AzUKdjZs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729352AbgFDPPa (ORCPT + 99 others); Thu, 4 Jun 2020 11:15:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:39596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729215AbgFDPP1 (ORCPT ); Thu, 4 Jun 2020 11:15:27 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C92422072E; Thu, 4 Jun 2020 15:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591283726; bh=ehTRmixmctGTG2rIendMHkrDCa4Xx6HZ+HL+iKOW2Es=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=AzUKdjZsEdsVO/muRW82FLhh+tkqkBsCTIvWLS4USDM3sS+PhXlEGhYN2AoO3MUky qDeDLwPPklB8HVdpx6QGGwSpl3gGSmN9oUfIKPqJ/Ztn2YzdX4ywZKxBWeBlNPpgZf sx/8OtL/Acm09hxo47MoGY/XB+VhUBS7XO8orxq8= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgraX-000HRX-9N; Thu, 04 Jun 2020 16:15:25 +0100 Date: Thu, 4 Jun 2020 16:15:23 +0100 From: Marc Zyngier To: "Kirill A. Shutemov" Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , David Rientjes , Andrea Arcangeli , Kees Cook , Will Drewry , "Edgecombe, Rick P" , "Kleen, Andi" , x86@kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , kernel-team@android.com, will@kernel.org Subject: Re: [RFC 00/16] KVM protected memory extension Message-ID: <20200604161523.39962919@why> In-Reply-To: <20200522125214.31348-1-kirill.shutemov@linux.intel.com> References: <20200522125214.31348-1-kirill.shutemov@linux.intel.com> Organization: Approximate X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: kirill@shutemov.name, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, pbonzini@redhat.com, sean.j.christopherson@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, rientjes@google.com, aarcange@redhat.com, keescook@chromium.org, wad@chromium.org, rick.p.edgecombe@intel.com, andi.kleen@intel.com, x86@kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kirill.shutemov@linux.intel.com, kernel-team@android.com, will@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kirill, Thanks for this. On Fri, 22 May 2020 15:51:58 +0300 "Kirill A. Shutemov" wrote: > =3D=3D Background / Problem =3D=3D >=20 > There are a number of hardware features (MKTME, SEV) which protect guest > memory from some unauthorized host access. The patchset proposes a purely > software feature that mitigates some of the same host-side read-only > attacks. >=20 >=20 > =3D=3D What does this set mitigate? =3D=3D >=20 > - Host kernel =E2=80=9Daccidental=E2=80=9D access to guest data (think s= peculation) >=20 > - Host kernel induced access to guest data (write(fd, &guest_data_ptr, l= en)) >=20 > - Host userspace access to guest data (compromised qemu) >=20 > =3D=3D What does this set NOT mitigate? =3D=3D >=20 > - Full host kernel compromise. Kernel will just map the pages again. >=20 > - Hardware attacks Just as a heads up, we (the Android kernel team) are currently involved in something pretty similar for KVM/arm64 in order to bring some level of confidentiality to guests. The main idea is to de-privilege the host kernel by wrapping it in its own nested set of page tables which allows us to remove memory allocated to guests on a per-page basis. The core hypervisor runs more or less independently at its own privilege level. It still is KVM though, as we don't intend to reinvent the wheel. Will has written a much more lingo-heavy description here: https://lore.kernel.org/kvmarm/20200327165935.GA8048@willie-the-truck/ This works for one of the virtualization modes that arm64 can use (what we call non-VHE, or nVHE for short). The other mode (VHE), is much more similar to what happens on other architectures, where the kernel and the hypervisor are one single entity. In this case, we cannot use the same trick with nested page tables, and have to rely on something that would very much look like what you're proposing. Note that the two modes of the architecture would benefit from this work anyway, as I'd like the host to know that we've pulled memory from under its feet. Since you have done most of the initial work, I intend to give it a go on arm64 shortly and see what sticks. Thanks, M. --=20 Jazz is not dead. It just smells funny...