Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp340685pxb; Sat, 6 Mar 2021 01:30:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzp2iGhhELLMZ7n7qawCtduL3Yr9sEo0euB2Y2G/xVqN1sCeTj7EdFDmFYNfpcMKv8WRFpY X-Received: by 2002:aa7:c9d1:: with SMTP id i17mr12700241edt.46.1615023057819; Sat, 06 Mar 2021 01:30:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615023057; cv=none; d=google.com; s=arc-20160816; b=IliE4d1lJ5NY6hupz7G6ki8CcIMtuVhPHfEiOSCbyEsjrKdZIFuDckwi3TCsomLwQF /Vluu/os2FBzd7nWUFp48ONvQbh6yKD6XyN8xoqGF+05E7xUNyM+k+y6GOA2Gnj3Svjp J/a92CV8mSp5aPZcFedhQgdURiRK2Rtz8II8RrBu3GZMJIhVosDIBQvVBMj5PTZiGazN WdgcdU5Q0mbfZ/AhzfN1KyOvkw+dgwpC3Frf2tw2zgviZMzLejVLHivcdnhGkcSzlxdz MiI/SIWWZnXWUJeStupqyEamVhtVxsKL/brY+RVfJZWWClaA7LlX1ht2Y0EvxTCQDk4z 7rOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=e5O/LpcxMMdquDVNYjg2lF3OYstWuYNsRwulGsHakfc=; b=tzRSTsec1MVqdDBdVnR74YXco3nDLDjTskLBtz6ozDR1NStaHPi5pNyh6s/aINiioa KT5yuJfbuOGagzlCvwqO2wREEhuChfn6tsNvhju61i08a1uYkIwWpS+656WItoY1z7Jb Uj29J4JQhQuAVLf9JAwmJCBLaYrk+3DJniKfJRmH6pAusYyXWBVc7YlOVq4PP1LnxeWU 56KpuvsMsvdq3pbF4CmdT9QU869pWJvd7wXeS55S2515lxscDROhNYddcSt8lj7k+qBY kwWwJN35lWdkUKAMH6jtBspnKwDjTSMAaSeiIBVfR+O09QJdMuHAzUSGkVsLZnfE31tc h3rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=blbWV8cU; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q4si3098271edh.345.2021.03.06.01.30.24; Sat, 06 Mar 2021 01:30:57 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=blbWV8cU; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbhCFJ1M (ORCPT + 99 others); Sat, 6 Mar 2021 04:27:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47022 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229738AbhCFJ1E (ORCPT ); Sat, 6 Mar 2021 04:27:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615022821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e5O/LpcxMMdquDVNYjg2lF3OYstWuYNsRwulGsHakfc=; b=blbWV8cU3prZoc4ZWouEcs9cXArZ+MHCuP/f7ygGNUs7gR4wPjxq6LGluQaxsr6zqttR9k Z4d3umG2MkTAZFEtpBGO6FnQz3my3ee33zMY1nG5Rs+9hpYRXYH+9EUsTk2em58wGJlwbk iraBKs4ayU8TddT1ynP8QoSC07EIWYI= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-XJvPEE7wPb6HxrZpRC6sjw-1; Sat, 06 Mar 2021 04:26:59 -0500 X-MC-Unique: XJvPEE7wPb6HxrZpRC6sjw-1 Received: by mail-wr1-f69.google.com with SMTP id h5so2260776wrr.17 for ; Sat, 06 Mar 2021 01:26:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=e5O/LpcxMMdquDVNYjg2lF3OYstWuYNsRwulGsHakfc=; b=lK7f2VYAko91xQbnrETa5JUGZ0jI5Euqb5DmLusIwYfrxNeNmKOKC7pPlKg8Aqra+8 KtuvFm2pl5COcEhlSTRLGAYA/Gd+TZiCh4rEgLcn3UR3TuxGk6Kr/AawW9vF7FgKc2TZ ZJ2jVZkfBliFg+BEYXnMX/T3GDntr3JeNn3RNUWDaEOWnXtqoOg9bigk8se7ckzrci4q eBTNew9I9PJ0jHcDBiBFWlkB+GDKLVkR0hwbODzJE3aqka8o+otgvnZxNIrPtodVyw9H W8fT2Voyg+WPrxDf784MS+/RwDMXGRtXJao/7OMf9u5kwGK3SIBRA5C+zVp6KjwYFQSK GK3Q== X-Gm-Message-State: AOAM531ryms8wMwl2+DXTxZ+5w9BMmtsguEA1hZExghpBZ5llxTBQIua RFXtGxlZ9NeAeWThM5OmEyEUpmjjfcs7L6IpcAt4qqguX29+2t3hjtMFx2iXRE20vm4wv8av2uI Sp4vBPhIeXzeKLDb30GeiVFMZ X-Received: by 2002:a5d:4002:: with SMTP id n2mr3398523wrp.148.1615022818013; Sat, 06 Mar 2021 01:26:58 -0800 (PST) X-Received: by 2002:a5d:4002:: with SMTP id n2mr3398516wrp.148.1615022817864; Sat, 06 Mar 2021 01:26:57 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e? ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id o14sm7710140wri.48.2021.03.06.01.26.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Mar 2021 01:26:57 -0800 (PST) Subject: Re: [PATCH 03/28] KVM: nSVM: inject exceptions via svm_check_nested_events To: Sean Christopherson Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, vkuznets@redhat.com, mlevitsk@redhat.com, Jim Mattson References: From: Paolo Bonzini Message-ID: Date: Sat, 6 Mar 2021 10:26:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/03/21 02:39, Sean Christopherson wrote: > Unless KVM (L0) knowingly wants to override L1, e.g. KVM_GUESTDBG_* cases, KVM > shouldn't do a damn thing except forward the exception to L1 if L1 wants the > exception. > > ud_interception() and gp_interception() do quite a bit before forwarding the > exception, and in the case of #UD, it's entirely possible the #UD will never get > forwarded to L1. #GP is even more problematic because it's a contributory > exception, and kvm_multiple_exception() is not equipped to check and handle > nested intercepts before vectoring the exception, which means KVM will > incorrectly escalate a #GP->#DF and #GP->#DF->Triple Fault instead of exiting > to L1. That's a wee bit problematic since KVM also has a soon-to-be-fixed bug > where it kills L1 on a Triple Fault in L2... I agree with the #GP problem, but this is on purpose. For example, if L1 CPUID has MOVBE and it is being emulated via #UD, L1 would be right to set MOVBE in L2's CPUID and expect it not to cause a #UD. The same is true for the VMware #GP interception case. Maxim is also working on this, the root cause is that kvm_multiple_exception()'s escalation of contributory exceptions to #DF and triple fault is incorrect in the case of nested virtualization. Paolo