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=-7.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 3FE33C433E0 for ; Sat, 6 Mar 2021 09:27:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F271765019 for ; Sat, 6 Mar 2021 09:27:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbhCFJ1M (ORCPT ); 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-Google-Smtp-Source: ABdhPJw9/q/9S+4sLU2rGSr6w+yDYGAFfQ+D9c80lfJ+5k/SiOHKsOSUvmPuATMc8lsg7cJLJrdpgA== 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