From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 542C6C433F5 for ; Thu, 23 Sep 2021 12:59:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1714961090 for ; Thu, 23 Sep 2021 12:59:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1714961090 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5GcP8Dh/R4DygLRPzc7/ybZOCZXJI2tDoN5W/91HnEw=; b=LXL6qLwcVCZnmq Jpe5jWCkn703KTL6P+NNidy2h0zEgPb8uSH5yseq0f+tchf1+qZEMhS0z4WHsRFh2k+4yHJludQZy 5q4PQdr6aA9QuwbzzU1U4GuqGZcPKrXvPvBvE9Oz1m9KAF42A9RQ/6r3WG05tZaPPJB3M8a9nMdJ3 mkG5Sa+/w+Wukt+qnsb++xRnSeyKzbb8xDZPSINBqc8TucXGr8n+iQ2vj7i7FTqW9V5kVu7ITLesL /jTwkPhN8Po8WVKCSHryvPJsEcvLApnL/T6W3PVHfZJ4ay+yNJwik1LPfKpV7+xmu+9YzKI0pgRdZ u3zl7BFMl9z5n/T8hPPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTOJI-00BUts-UN; Thu, 23 Sep 2021 12:58:45 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTOJD-00BUrw-OK for linux-arm-kernel@lists.infradead.org; Thu, 23 Sep 2021 12:58:41 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 10DB660F43; Thu, 23 Sep 2021 12:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632401919; bh=BEIXGCH5BckmtiISCaPM5m33QFlER0ukVLbDKFBYkrs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qG6P7kDfsh6uKtn48XozMnjmUKYMUP0z70teirWUd+FFJ+nMk2J+zG4lIbZX6C4Ba y6fhGdafrhTfJAq0Y2+Xz214DepC2NiZR83fTbe9dvdPcnsTi33+r3fn6D44GBOYAM nJVN+pQLpwW8crA0Zgu3hvKgirv1sGPqJKSwd4sf1ntEkE/diKNzcw5CB5JmLQM6jx OSF2WZ2u6c/OiDrIWXRCBIS0xSvUfZ3xeEY/ZYf0bhs0RryWTjNWlps1DVEEuM/GkL 0Hxn5LjRPWkYBxpKja9b3G8ZcTIYfLUcXX+OQL2AtboGH1R2LJxKS5s0Crx20vTQEq epe2Cxz5jcymw== Date: Thu, 23 Sep 2021 13:58:34 +0100 From: Will Deacon To: linux-arm-kernel@lists.infradead.org Cc: Marc Zyngier , Quentin Perret , Catalin Marinas , Alexandru Elisei , Suzuki K Poulose , kvmarm@lists.cs.columbia.edu Subject: Re: [PATCH 5/5] KVM: arm64: Disable privileged hypercalls after pKVM finalisation Message-ID: <20210923125834.GA15934@willie-the-truck> References: <20210923112256.15767-1-will@kernel.org> <20210923112256.15767-6-will@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210923112256.15767-6-will@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210923_055839_876937_F0A4687B X-CRM114-Status: GOOD ( 19.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 23, 2021 at 12:22:56PM +0100, Will Deacon wrote: > After pKVM has been 'finalised' using the __pkvm_prot_finalize hypercall, > the calling CPU will have a Stage-2 translation enabled to prevent access > to memory pages owned by EL2. > > Although this forms a significant part of the process to deprivilege the > host kernel, we also need to ensure that the hypercall interface is > reduced so that the EL2 code cannot, for example, be re-initialised using > a new set of vectors. > > Re-order the hypercalls so that only a suffix remains available after > finalisation of pKVM. > > Cc: Marc Zyngier > Cc: Quentin Perret > Signed-off-by: Will Deacon > --- > arch/arm64/include/asm/kvm_asm.h | 43 ++++++++++++++++-------------- > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 26 +++++++++++------- > 2 files changed, 39 insertions(+), 30 deletions(-) [...] > diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c > index 2da6aa8da868..4120e34288e1 100644 > --- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c > +++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c > @@ -165,36 +165,42 @@ typedef void (*hcall_t)(struct kvm_cpu_context *); > #define HANDLE_FUNC(x) [__KVM_HOST_SMCCC_FUNC_##x] = (hcall_t)handle_##x > > static const hcall_t host_hcall[] = { > - HANDLE_FUNC(__kvm_vcpu_run), > + /* ___kvm_hyp_init */ > + HANDLE_FUNC(__kvm_get_mdcr_el2), > + HANDLE_FUNC(__pkvm_init), > + HANDLE_FUNC(__pkvm_create_private_mapping), > + HANDLE_FUNC(__pkvm_cpu_set_vector), > + HANDLE_FUNC(__kvm_enable_ssbs), > + HANDLE_FUNC(__vgic_v3_init_lrs), > + HANDLE_FUNC(__pkvm_prot_finalize), > + > + HANDLE_FUNC(__pkvm_host_share_hyp), > HANDLE_FUNC(__kvm_adjust_pc), > + HANDLE_FUNC(__kvm_vcpu_run), > HANDLE_FUNC(__kvm_flush_vm_context), > HANDLE_FUNC(__kvm_tlb_flush_vmid_ipa), > HANDLE_FUNC(__kvm_tlb_flush_vmid), > HANDLE_FUNC(__kvm_flush_cpu_context), > HANDLE_FUNC(__kvm_timer_set_cntvoff), > - HANDLE_FUNC(__kvm_enable_ssbs), > HANDLE_FUNC(__vgic_v3_get_gic_config), > HANDLE_FUNC(__vgic_v3_read_vmcr), > HANDLE_FUNC(__vgic_v3_write_vmcr), > - HANDLE_FUNC(__vgic_v3_init_lrs), > - HANDLE_FUNC(__kvm_get_mdcr_el2), > HANDLE_FUNC(__vgic_v3_save_aprs), > HANDLE_FUNC(__vgic_v3_restore_aprs), > - HANDLE_FUNC(__pkvm_init), > - HANDLE_FUNC(__pkvm_cpu_set_vector), > - HANDLE_FUNC(__pkvm_host_share_hyp), > - HANDLE_FUNC(__pkvm_create_private_mapping), > - HANDLE_FUNC(__pkvm_prot_finalize), Not that it makes any functional difference, but I was trying to keep this in numerical order and evidently didn't manage it after renumbering __vgic_v3_get_gic_config. Will fix for v2. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel