Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5249278imw; Wed, 20 Jul 2022 01:53:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uZcHC4g0gHamDRlO/37hTSU871p00oYGJ7OTBYKqRpS4M0HtVppCSVHHkIp8f8bqtFUWQ7 X-Received: by 2002:a17:90a:ba04:b0:1f2:1bf9:5d97 with SMTP id s4-20020a17090aba0400b001f21bf95d97mr2566355pjr.35.1658307237990; Wed, 20 Jul 2022 01:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658307237; cv=none; d=google.com; s=arc-20160816; b=qUIcQ/o6GwHTiS7rsWkcbziUz4oZhHCcS1DogIuLmo5CwhAVbMjv2F+CJp4LaID9L/ PiOmwONkGdLUIOQdbQu4e4+NKHay9CknuoDyrZ+4gdsOyLPAimDWzllzmOlfi3Tk4XQO zL+2I/Vi8igHlH+00L2HKZeRO2EgUYcabM+tWWOSMkfkhrRBF/YcbMaubXZdVpBnYbON r09xyQxTfcJnHV0m4ed8tV2rSCapFE9BsdxG7mU5uIvi0aLEqfroFlH/28huyQ5upG++ KKBbdlqbnP11d8OsyDFB/ty2uJ5hQZrwyZBjWIojbywEuaMbMHXjWrKE5Nz5UG3BVeyi aY1w== 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=E33i4x0VDithUN2osgw0KYbVHXG0AF/cZ3F5XHu1rls=; b=X5jeoKzbQbL/Vz2ePyW7Q73egiYEjKM3SaQEUZatj5Hk5UrMnlZWdWwhLJOHi6U4ca qV40JkS6RdYtYPP/jIEhHmwXQQqjpbnnE4rR+lZ8UsruGcLb54rrpud+awTmd8pRD+Vg rWrl9lRqBKQgjzp3u3t367NqBhm8CEg8WGyGKNb8fN5KPIwO95GS3VGUSZrLPxQqQ3Gf pjHn2njAkUUtfPGB2gqKdz80LTui4zfr1erWgCWTY6IpbmZbW85yDYmT4zOAzv+qV7NM H0xQGUknUjxgI9OoXOvlzlxBDDuovlCh+0JSqmxaDEgjCkzzXPKw/vFK1P3nvxomMMVb TB2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iXowriGM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f23-20020a17090ace1700b001efe6abbc37si1766838pju.32.2022.07.20.01.53.42; Wed, 20 Jul 2022 01:53:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iXowriGM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232349AbiGTIrt (ORCPT + 99 others); Wed, 20 Jul 2022 04:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229827AbiGTIrr (ORCPT ); Wed, 20 Jul 2022 04:47:47 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7BC97D75 for ; Wed, 20 Jul 2022 01:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658306865; 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=E33i4x0VDithUN2osgw0KYbVHXG0AF/cZ3F5XHu1rls=; b=iXowriGMWC/6RuLS8T4PrR2qOk1eqXUJOelLqZbCpj18k8hrLK0TjRnGpdsONP4lDnKLv/ SbVsyuCLAuuYgfqiooBliP+kHDBZktQPlUXNnG6jzEQd9YwEVEd5ApwrChLuCRBQ8yQzAQ CecAmqhfmrjXyNkUcwj38ZODwP6CuZ8= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-195-kbdolvFZOPqkcqU9cHKGlQ-1; Wed, 20 Jul 2022 04:47:44 -0400 X-MC-Unique: kbdolvFZOPqkcqU9cHKGlQ-1 Received: by mail-qv1-f70.google.com with SMTP id na10-20020a0562142d4a00b00473fb0f94deso2540999qvb.21 for ; Wed, 20 Jul 2022 01:47:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=E33i4x0VDithUN2osgw0KYbVHXG0AF/cZ3F5XHu1rls=; b=Y6lVGn0TZWjnbB0PlI9AFjcn/B1isf/lDyjFyxbL52FhvioEr2doXn5R2yIf7Gc3xJ bdCZsA2HiwF0ZUjrWzpNcaqH/ckl877KCXHKF7CGDNoiOfAC9gP6Wao9BNCEDp9ghwhG lmN5vQzzIGoxDoGW+FWiuuwqqz+n0H9DpORfnHST/eTimu220SBiA11bRMF+o4XPHiFY UoY+/lCUJ7ft6KOfKRgFyULCkjuWm0XHI5L8PypFMsyw2gPerlpV0EiwCwB67F+TLdlA WQCqktADQoqTtUbczHqHoR3ls6mPUj27UKpiFdl4Ui0V4GOBHWrt9V1PtOXcW47MK9vg gZrA== X-Gm-Message-State: AJIora9BuHjjRE2lT9fJaPtZzsymegg1UAx1NwQNzbaCdnvL4Xz6d35y j9RH8n74y+XQ7O2hBil5y9DEAjgyG0SvzRUjVLd9d2yQBqjiPOE2uhrhsmsmrzJlj9ZRhEtkW3X sq/NpGm+OYymQ6I7oyLmjSFz0 X-Received: by 2002:a05:620a:712:b0:6b5:e58b:7fa1 with SMTP id 18-20020a05620a071200b006b5e58b7fa1mr9995012qkc.116.1658306864178; Wed, 20 Jul 2022 01:47:44 -0700 (PDT) X-Received: by 2002:a05:620a:712:b0:6b5:e58b:7fa1 with SMTP id 18-20020a05620a071200b006b5e58b7fa1mr9995006qkc.116.1658306863971; Wed, 20 Jul 2022 01:47:43 -0700 (PDT) Received: from [10.35.4.238] (bzq-82-81-161-50.red.bezeqint.net. [82.81.161.50]) by smtp.gmail.com with ESMTPSA id i12-20020a37c20c000000b006a6a6f148e6sm15502876qkm.17.2022.07.20.01.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 01:47:43 -0700 (PDT) Message-ID: <80099b7675300ba24743caffaa2255ac00b26b12.camel@redhat.com> Subject: Re: [PATCH v2 00/11] SMM emulation and interrupt shadow fixes From: Maxim Levitsky To: kvm@vger.kernel.org Cc: Sean Christopherson , x86@kernel.org, Kees Cook , Dave Hansen , linux-kernel@vger.kernel.org, "H. Peter Anvin" , Borislav Petkov , Joerg Roedel , Ingo Molnar , Paolo Bonzini , Thomas Gleixner , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson Date: Wed, 20 Jul 2022 11:47:39 +0300 In-Reply-To: References: <20220621150902.46126-1-mlevitsk@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-5.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2022-07-14 at 14:06 +0300, Maxim Levitsky wrote: > On Tue, 2022-06-21 at 18:08 +0300, Maxim Levitsky wrote: > > This patch series is a result of long debug work to find out why > > sometimes guests with win11 secure boot > > were failing during boot. > > > > During writing a unit test I found another bug, turns out > > that on rsm emulation, if the rsm instruction was done in real > > or 32 bit mode, KVM would truncate the restored RIP to 32 bit. > > > > I also refactored the way we write SMRAM so it is easier > > now to understand what is going on. > > > > The main bug in this series which I fixed is that we > > allowed #SMI to happen during the STI interrupt shadow, > > and we did nothing to both reset it on #SMI handler > > entry and restore it on RSM. > > > > Best regards, > >         Maxim Levitsky > > > > Maxim Levitsky (11): > >   KVM: x86: emulator: em_sysexit should update ctxt->mode > >   KVM: x86: emulator: introduce update_emulation_mode > >   KVM: x86: emulator: remove assign_eip_near/far > >   KVM: x86: emulator: update the emulation mode after rsm > >   KVM: x86: emulator: update the emulation mode after CR0 write > >   KVM: x86: emulator/smm: number of GPRs in the SMRAM image depends on > >     the image format > >   KVM: x86: emulator/smm: add structs for KVM's smram layout > >   KVM: x86: emulator/smm: use smram struct for 32 bit smram load/restore > >   KVM: x86: emulator/smm: use smram struct for 64 bit smram load/restore > >   KVM: x86: SVM: use smram structs > >   KVM: x86: emulator/smm: preserve interrupt shadow in SMRAM > > > >  arch/x86/include/asm/kvm_host.h |   6 - > >  arch/x86/kvm/emulate.c          | 305 ++++++++++++++++---------------- > >  arch/x86/kvm/kvm_emulate.h      | 146 +++++++++++++++ > >  arch/x86/kvm/svm/svm.c          |  28 +-- > >  arch/x86/kvm/x86.c              | 162 ++++++++--------- > >  5 files changed, 394 insertions(+), 253 deletions(-) > > > > -- > > 2.26.3 > > > > > A kind ping on these patches. Another kind ping on this patch series. Best regards, Maxim Levitsky > > Best regards, >         Maxim Levitsky >