From patchwork Wed Sep 23 22:45:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 11795763 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D18A92C for ; Wed, 23 Sep 2020 22:45:51 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 342622075B for ; Wed, 23 Sep 2020 22:45:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="g4U9XkH2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 342622075B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ZNrL6ivlCTc3KUoIm8uPlz5022lfa4RmUWwzKbga4jc=; b=g4U9XkH2N+CI1ijrGiFGtIhlrp uOwCQfIXsxwjAN9JDtlyv0nrqLs8US1K8ZqZ4VvyYOzz6utCnpbWuDPI/XYcHXsunAbBo5WzooXLT 32tf7XhrppTl7jNDIeqCRWcAkkneER0sL2xJ9XFk9PsHDvHDYQrbY2S1ky3zX1dclgwqRB/AXX25u kyR44ieAYenVtQdbmWiV5PznmoglqUp4s6QsDQ1NyytsJIks0FD7KMF6tgrJr0n1MTGEvuSrCIXUY 6YpaniyTQg3WHxKwiCEmup9UrpOZ6ycYglI5wDYcai5geTD2b0pM1TPab6T6RohYQHlcT+I86j8jO AlSd4eMQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLDW7-0004SL-RL; Wed, 23 Sep 2020 22:45:39 +0000 Received: from mga01.intel.com ([192.55.52.88]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLDW4-0004R2-80 for linux-arm-kernel@lists.infradead.org; Wed, 23 Sep 2020 22:45:37 +0000 IronPort-SDR: PUMZYk8eo/xfdjbaGWQp5p9q/JPwr/Vt0sh2UFost915mxpinUoFEFOiilFqwKmL1fv3Ga9RNH JV2At7AIOm6g== X-IronPort-AV: E=McAfee;i="6000,8403,9753"; a="179119915" X-IronPort-AV: E=Sophos;i="5.77,295,1596524400"; d="scan'208";a="179119915" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2020 15:45:32 -0700 IronPort-SDR: J1/Cph9zE2IoIv9FqaGC+ceWMFJHwxEkjhilb2ZOjNuk9oeKV7hF68XZI2S5RsFxBN95q0EqeM KiQhOpKHilBg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,295,1596524400"; d="scan'208";a="335660058" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.160]) by fmsmga004.fm.intel.com with ESMTP; 23 Sep 2020 15:45:31 -0700 From: Sean Christopherson To: Paolo Bonzini Subject: [RFC PATCH 0/3] KVM: Introduce "VM bugged" concept Date: Wed, 23 Sep 2020 15:45:27 -0700 Message-Id: <20200923224530.17735-1-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200923_184536_466550_376111B7 X-CRM114-Status: GOOD ( 14.42 ) X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [192.55.52.88 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [192.55.52.88 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wanpeng Li , kvm@vger.kernel.org, David Hildenbrand , linux-mips@vger.kernel.org, Paul Mackerras , Huacai Chen , Claudio Imbrenda , Janosch Frank , Marc Zyngier , Joerg Roedel , Christian Borntraeger , Aleksandar Markovic , Julien Thierry , Suzuki K Poulose , kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jim Mattson , Cornelia Huck , linux-kernel@vger.kernel.org, Sean Christopherson , James Morse , Vitaly Kuznetsov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This series introduces a concept we've discussed a few times in x86 land. The crux of the problem is that x86 has a few cases where KVM could theoretically encounter a software or hardware bug deep in a call stack without any sane way to propagate the error out to userspace. Another use case would be for scenarios where letting the VM live will do more harm than good, e.g. we've been using KVM_BUG_ON for early TDX enabling as botching anything related to secure paging all but guarantees there will be a flood of WARNs and error messages because lower level PTE operations will fail if an upper level operation failed. The basic idea is to WARN_ONCE if a bug is encountered, kick all vCPUs out to userspace, and mark the VM as bugged so that no ioctls() can be issued on the VM or its devices/vCPUs. RFC as I've done nowhere near enough testing to verify that rejecting the ioctls(), evicting running vCPUs, etc... works as intended. Sean Christopherson (3): KVM: Export kvm_make_all_cpus_request() for use in marking VMs as bugged KVM: Add infrastructure and macro to mark VM as bugged KVM: x86: Use KVM_BUG/KVM_BUG_ON to handle bugs that are fatal to the VM arch/x86/kvm/svm/svm.c | 2 +- arch/x86/kvm/vmx/vmx.c | 23 ++++++++++++-------- arch/x86/kvm/x86.c | 4 ++++ include/linux/kvm_host.h | 45 ++++++++++++++++++++++++++++++++-------- virt/kvm/kvm_main.c | 11 +++++----- 5 files changed, 61 insertions(+), 24 deletions(-)