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 8FAE4C433F5 for ; Thu, 23 Sep 2021 12:36:06 +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 5F56760F70 for ; Thu, 23 Sep 2021 12:36:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5F56760F70 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=8FvpPVflxtutBUZTDerQV63NrMMKhuin1oUOywuRXL0=; b=aUS6K8YSz2kL7C ZCnWnjDRPUkRAKagAnru8vmUeBGGxETv2JAidb8+LTxUR32CjW0f7lkU5JLvEzZxtlzUrt+S6z6ZA Jm06YQHRt9hffsZovBWejyVUQvFeKNYLqbojHjlwIWuxkgD6Vqda2lzLmC1pSaShdNkv25JahLG2Y KM6nhsZZDrIqai2ygN0g30BMfLcwtV1VwM72hf8WvUXBdru68VDmDOwY0HZ53TFPwEwijWsjWaIkC VlPKp7Rur4qqwuln9EojxvySdXQZqCvthdon/Gz8D5TqjPGZYLi0dm0hMucYobx6A5DTVhKaEDIOe SSEIg9oI2uWzNdC9XkFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTNuv-00BQG1-IC; Thu, 23 Sep 2021 12:33:34 +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 1mTNrQ-00BOXe-Er for linux-arm-kernel@lists.infradead.org; Thu, 23 Sep 2021 12:29:57 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id F093360F4C; Thu, 23 Sep 2021 12:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632400195; bh=uqoHNJZa5TDP6HzkFMXYQIAfDgwMyi+BklxRbf1mwI8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Dg8W5tH8ns8G/i3eAoa9nCc8EYzqPl/Z9D/bmN3WkWuhVnXvHTp4pSprko8d40rCc gJ+/d0cMy2/AuiB3eQjMLyCyNYf4HAqFPDkE5snNCJ4Hi5MnFDiVHmgBKobAhBPH2t kGmcRF1gxyYNW47tRURmyguPT1ilxw0uWD1DWEVB8nc2pC4mUb+knHix1V2stGfS3i fRkFPR3rZAMR97GsCCVPmwfY08AHV7lSEXZvaWCJqyRI4+K5uLKs0rScOUCTX/jK/8 QCj3Trok0/3ZsgnA9JYpCFuD643sEWPgr17hudnhI7HimHTTZD3/x7KRk0qtm016QD e3eZnu4lnqrXQ== Date: Thu, 23 Sep 2021 13:29:51 +0100 From: Will Deacon To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Marc Zyngier , Catalin Marinas , kvmarm@lists.cs.columbia.edu Subject: Re: [PATCH 1/5] arm64: Prevent kexec and hibernation if is_protected_kvm_enabled() Message-ID: <20210923122951.GA15860@willie-the-truck> References: <20210923112256.15767-1-will@kernel.org> <20210923112256.15767-2-will@kernel.org> <20210923114506.GB14893@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210923114506.GB14893@C02TD0UTHF1T.local> 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_052956_569007_E68C9CD6 X-CRM114-Status: GOOD ( 28.72 ) 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:45:06PM +0100, Mark Rutland wrote: > On Thu, Sep 23, 2021 at 12:22:52PM +0100, Will Deacon wrote: > > When pKVM is enabled, the hypervisor code at EL2 and its data structures > > are inaccessible to the host kernel and cannot be torn down or replaced > > as this would defeat the integrity properies which pKVM aims to provide. > > Furthermore, the ABI between the host and EL2 is flexible and private to > > whatever the current implementation of KVM requires and so booting a new > > kernel with an old EL2 component is very likely to end in disaster. > > > > In preparation for uninstalling the hyp stub calls which are relied upon > > to reset EL2, disable kexec and hibernation in the host when protected > > KVM is enabled. > > > > Cc: Marc Zyngier > > Cc: Quentin Perret > > Signed-off-by: Will Deacon > > --- > > arch/arm64/kernel/smp.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c > > index 6f6ff072acbd..44369b99a57e 100644 > > --- a/arch/arm64/kernel/smp.c > > +++ b/arch/arm64/kernel/smp.c > > @@ -1128,5 +1128,6 @@ bool cpus_are_stuck_in_kernel(void) > > { > > bool smp_spin_tables = (num_possible_cpus() > 1 && !have_cpu_die()); > > > > - return !!cpus_stuck_in_kernel || smp_spin_tables; > > + return !!cpus_stuck_in_kernel || smp_spin_tables || > > + is_protected_kvm_enabled(); > > } > > IIUC you'll also need to do something to prevent kdump, since even with > CPUs stuck in the kernel that will try to do a kexec on the crashed CPU > and __cpu_soft_restart() won't be able to return to EL2. > > You could fiddle with the BUG_ON() in machine_kexec() to die in this > case too. I wondered about that, and I'm happy to do it if you reckon it's better, but if the host is crashing _anyway_ then I wasn't convinced it was worth the effort. With the approach here, we'll WARN and then enter the kdump kernel at EL1 which maybe might work sometimes possibly? I suppose if the kdump kernel is careful about the memory it accesses, then it has a fighting chance of doing something useful. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel