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.6 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 417C5C48BC2 for ; Wed, 23 Jun 2021 20:38:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29172611AD for ; Wed, 23 Jun 2021 20:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229907AbhFWUkS (ORCPT ); Wed, 23 Jun 2021 16:40:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59844 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbhFWUkQ (ORCPT ); Wed, 23 Jun 2021 16:40:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624480678; 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=Yzpn4h8z/3EwHO6Y56HGAwADTZHOyWPR+DhZ1Kza9PU=; b=A7tOsqDnXj2Z4YTbsRILncaIELIYxPQrKbFKCFwAHsdBdV2dITzANnAMtyrGBWHbYXtffb p/yIIQ1IWgQN1BJ1lRY10pQdEnhnsRRZgyRd59CZNDgMCD0k2SfajPGSGXIrMz47yQyFD7 KzwnQbqXoBOh2MNXaQizdkhqyI/6ols= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-480-GPbAbd7OM-ay8wIV5dKG2g-1; Wed, 23 Jun 2021 16:37:56 -0400 X-MC-Unique: GPbAbd7OM-ay8wIV5dKG2g-1 Received: by mail-wr1-f72.google.com with SMTP id g8-20020a5d54080000b0290124a2d22ff8so888748wrv.4 for ; Wed, 23 Jun 2021 13:37:56 -0700 (PDT) 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=Yzpn4h8z/3EwHO6Y56HGAwADTZHOyWPR+DhZ1Kza9PU=; b=ddMm+YavF52EaMvI3n6Q2jerTT+zbDNSxa5wHhkXFRC86Xe8/mX2qUzthhWo89aKFV xcHAtcyHTK9iklL8ldVMsP6I9UcSNB2qUPHG+P1uLImvwvx/dv0f2Ocna1F+ByXycYAd RpwyGKYe5UB8N1t6XE4km7Gp3Rqn1m+FdiKO/xDEtXbO8YPT7Pz0yatfulk+ZCCrKQFU mjhJipiMTfoPAi97ULW2jHbkMwSPUK8DoeQn2WcMQc+5QEWI6oFv2zsyf7kObz5H9QKI cIH1SLrAJU4qF4o87ICoN7BCy9hP3FsLblr6HHERB85qTw5BxBH5pu9cxd8dS+AQJecS bZ0g== X-Gm-Message-State: AOAM533hSFLyASgSgsWACg7FY2J6N/M1ndUwhdXj0m8Ap/hDgT5wNbdC AEOvB6wUUEsos4GaroHlMc6laZzjxbqjNcGfQZj8Zb1fVfuS2POjIZoDQj2KWhyv3ruZKJLbCzz I6Gr5h2nlxJEIyfGQxbpAhmZT X-Received: by 2002:adf:b19a:: with SMTP id q26mr2227906wra.401.1624480675467; Wed, 23 Jun 2021 13:37:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF6HnFGwdSZyTZFUWJepWew1VorokOc1Gz3flZnu6SWH+qKjTuAaiD7ri24gdTzUxsbnMLug== X-Received: by 2002:adf:b19a:: with SMTP id q26mr2227882wra.401.1624480675256; Wed, 23 Jun 2021 13:37:55 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id w13sm1133784wrc.31.2021.06.23.13.37.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jun 2021 13:37:54 -0700 (PDT) Subject: Re: [PATCH RFC] KVM: nSVM: Fix L1 state corruption upon return from SMM To: Sean Christopherson , Maxim Levitsky Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Cathy Avery , Emanuele Giuseppe Esposito , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <20210623074427.152266-1-vkuznets@redhat.com> <53a9f893cb895f4b52e16c374cbe988607925cdf.camel@redhat.com> <87pmwc4sh4.fsf@vitty.brq.redhat.com> <5fc502b70a89e18034716166abc65caec192c19b.camel@redhat.com> From: Paolo Bonzini Message-ID: <82327cd1-92ca-9f6b-3af0-8215e9d21eae@redhat.com> Date: Wed, 23 Jun 2021 22:37:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/06/21 18:21, Sean Christopherson wrote: > On Wed, Jun 23, 2021, Sean Christopherson wrote: >> And I believe this hackery is necessary only because nested_svm_vmexit() isn't >> following the architcture in the first place. I.e. using vmcb01 to restore >> host state is flat out wrong. > > Ah, that's not true, using vmcb01 is allowed by "may store some or all host state > in hidden on-chip memory". And also, "Different implementations may choose to save the hidden parts of the host’s segment registers as well as the selectors". > From a performance perspective, I do like the SMI/RSM shenanigans. I'm not > totally opposed to the trickery since I think it will break a guest if and only > if the L1 guest is also violating the APM. And we're not fudging the spec thaat > much :-) Yeah, that was my reasoning as well. Any reference to "hidden on-chip memory", plus the forbidding modifications of the host save area, sort of implies that the processor can actually flush that hidden on-chip memory for whatever reason (such as on some sleep states?!?). Paolo