Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5581418pxj; Wed, 23 Jun 2021 04:40:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGkdLUFOJdYBXrw9bOU0ThFSMbooayt+ikAlshdRRWCrWN0xeTFNqRAsspTDNK7DMl2DHH X-Received: by 2002:a05:6e02:1a26:: with SMTP id g6mr2633581ile.200.1624448426144; Wed, 23 Jun 2021 04:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624448426; cv=none; d=google.com; s=arc-20160816; b=0J2ajyusCLQ8XZS4SPDDe4Njx0TtdV/NOMfch0sK7AQMNpF/6L8f9l1Q5sqGOR1Aii 9gr9jV+1gHdnPWwqMUlbKcKA9dTxeqKsNf3uLF4HTt6pXI/Rv5UG4SIiy7050Mpa0ErR fu/ayWu/3RD7YNrjZfhnU/vLZUBcjQ6wN1wDjJ7+WOfIZ4eon5Gqmm8CrlSKwuZu2aPJ LQxVuEjE39lO2nFWG38PDQRwHrlm/kCCfua8FpqE3aKZhx2GlW25VerpIZsknMkS4cPw JDvCc9RXx7QQvnOb/jraumiTirb+eRGbSOtHFukRhNwoMpn9C5Vfb4DbT6tKmGHYpp8X jUfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=FJel3gfJEP2aIFpIS4J7bMYGEGndk6SG2vHn3PnMyD0=; b=oNhpU211xC4iwsXgWrOb2DALYGwXmqN/zeS5QrkDZJQVkJzDuE3gHzjCavUSBCWJX8 j19LdL7ErBOCmVtGs+QH+hmb6dVKXL1EJu1Yo+J6Aar4SiJisWU3u0zS17jnXOIPWIZt ze0RlkV7GYsp4LkLYTEJPo+48hZ+yOysEo0jvKAgdB27SlFlQUmioVvsTpcbkVsglPFu QFePR4V0lyaaiaipkrKpScqnRdyjl+xEquaq+7AGpRbDwT8oEoyTFHatY26emNA7n2Un 5q5NbCPf1Fp1qeqWbiHprxumO1KcxvRUOxd2Gson9e7D6cPeNvP/j7S5G8bgyxcGZ/Sk BbCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LySqkMzq; 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 w10si2436707jao.68.2021.06.23.04.40.14; Wed, 23 Jun 2021 04:40:26 -0700 (PDT) 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=LySqkMzq; 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 S230130AbhFWLmB (ORCPT + 99 others); Wed, 23 Jun 2021 07:42:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26762 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230061AbhFWLl7 (ORCPT ); Wed, 23 Jun 2021 07:41:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624448382; 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=FJel3gfJEP2aIFpIS4J7bMYGEGndk6SG2vHn3PnMyD0=; b=LySqkMzqabvT5ruZesmkivk+3ppJt0htWFgd0bQZJCNpyug90ktDTfMEP2qXL6eis+0DRP jJW5+zF7jiChhhA+LHccsMexN3Zkwe37VxU/Eu/Jm7O3+KRcrO58cAeykLoWT4CjpOKWM7 OR6Xn8yyyntgvmAdTnnXINaZKCo6JMg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-oSvjkb10NouFD1FeQIIa6Q-1; Wed, 23 Jun 2021 07:39:41 -0400 X-MC-Unique: oSvjkb10NouFD1FeQIIa6Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F09F91084F4B; Wed, 23 Jun 2021 11:39:39 +0000 (UTC) Received: from starship (unknown [10.40.192.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 583C25C1CF; Wed, 23 Jun 2021 11:39:35 +0000 (UTC) Message-ID: <2eaa94bcc697fec92d994146f7c69625b6a84cd0.camel@redhat.com> Subject: Re: [PATCH RFC] KVM: nSVM: Fix L1 state corruption upon return from SMM From: Maxim Levitsky To: Paolo Bonzini , Vitaly Kuznetsov , kvm@vger.kernel.org Cc: Sean Christopherson , Wanpeng Li , Jim Mattson , Cathy Avery , Emanuele Giuseppe Esposito , linux-kernel@vger.kernel.org Date: Wed, 23 Jun 2021 14:39:34 +0300 In-Reply-To: References: <20210623074427.152266-1-vkuznets@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2021-06-23 at 11:39 +0200, Paolo Bonzini wrote: > On 23/06/21 09:44, Vitaly Kuznetsov wrote: > > - RFC: I'm not 100% sure my 'smart' idea to use currently-unused HSAVE area > > is that smart. Also, we don't even seem to check that L1 set it up upon > > nested VMRUN so hypervisors which don't do that may remain broken. A very > > much needed selftest is also missing. > > It's certainly a bit weird, but I guess it counts as smart too. It > needs a few more comments, but I think it's a good solution. > > One could delay the backwards memcpy until vmexit time, but that would > require a new flag so it's not worth it for what is a pretty rare and > already expensive case. > > Paolo > I wonder what would happen if SMM entry is triggered by L1 (say with ICR), on a VCPU which is in L2. Such exit should go straight to L1 SMM mode. I will very very soon, maybe even today start testing SMM with my migration tests and such. I hope I will find more bugs in this area. Thanks for fixing this issue! Best regards, Maxim Levitsky