Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp324054iog; Wed, 29 Jun 2022 00:30:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uIvYLj4hDga/Y+N7D1/VaCVnA7DIhNdLoJM+01OPztu1HdY2p45grFVwip9/+aqFdadtuQ X-Received: by 2002:a17:902:6b0c:b0:16a:5973:df32 with SMTP id o12-20020a1709026b0c00b0016a5973df32mr7932620plk.70.1656487842540; Wed, 29 Jun 2022 00:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656487842; cv=none; d=google.com; s=arc-20160816; b=QfTocdr6UhZ0AfUo6bxQXztuj+VNnjUVuYSYdlKc3uS+Imcky8lEbyMLgBzfn9V5v6 c0/AuynL+WLsSjZlqYglLhm4ra0DMOtvvai/r4Ll1PKG3PwcA+mn+AxkFCEnwlD/NPSc Kheov6DhrwXwLSJ6LchyZmkHACNcfFFW9TPySIQ2DZ74dJK14Z19Pr0uwMnrUQPRtkyO Fsj3eFbRU+AoDsgEXBwYIhd9fEdT7vcWtNKEGkto4D8QagHQAGhv03sQPZHk2tnLGWXC LkThJoXgttIReNQt21+rCds2MhSe8fwjci+Qps7ilBeM1FibtUS+VabJSLAm2+c793Be 9sTQ== 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=7fI9ivlo9GVMwAi7+gjgOrAMG5lU56r9U/Z8Jc07VjA=; b=ReV1nJuxs7emfvTB/FTmvd+1EQbbdQFpktF/LTnKXdpzZxigHhNPr+5vY8itWB2jss /OqmpgvgkhDGPclTjHgJ2PJPArL2HvLw8bcV9IHDGjrLn2Lzau7hF93ipa9pzspJ0Lxu gB9GsycBmWzG5VyqjxnhCAKQUXK7F4qvjlUV6hfWJN9eQiJeQjKn4962ZL82E/Ekj+mL x8DhiNXeYgJTr0Fv8bs9uQFzNB5eyzsRLTQEccwLStBIjc29733gCfXNk2YOUSb+9H8Z 7/9C/wCxskH7Heti3jndArxmQmyqAi+jsyw0zZsMeCzlgEvXzCPvpHiot+UPA/Quoas6 SUxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LPDP3g7+; 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 y7-20020a17090322c700b0016a75602af4si21275945plg.597.2022.06.29.00.30.28; Wed, 29 Jun 2022 00:30:42 -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=LPDP3g7+; 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 S231339AbiF2HWA (ORCPT + 99 others); Wed, 29 Jun 2022 03:22:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231208AbiF2HV7 (ORCPT ); Wed, 29 Jun 2022 03:21:59 -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 97EBB1A3AA for ; Wed, 29 Jun 2022 00:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656487317; 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=7fI9ivlo9GVMwAi7+gjgOrAMG5lU56r9U/Z8Jc07VjA=; b=LPDP3g7+5w9CxMxjncl/dSX4ZXEIayzaT+4dLcH+PvNIJvwQT50loUKgQK6TAJ9mFRexFO MHk1WSLE0RtFy3MKre6HTfpRSZEIixwHtwkO33Tu2nd6+3OqLWSPguYmnhaUYLtS9rmElG G9mitH5I73WlNfAnoXCVxqf5crYbK10= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-501-mQBD3f6LO3e1FDojxi7TPg-1; Wed, 29 Jun 2022 03:21:52 -0400 X-MC-Unique: mQBD3f6LO3e1FDojxi7TPg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AFB1D1C0513F; Wed, 29 Jun 2022 07:21:50 +0000 (UTC) Received: from starship (unknown [10.40.194.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF5719D7F; Wed, 29 Jun 2022 07:21:46 +0000 (UTC) Message-ID: <1e96776f5a8dc73e8354cda7697af8a60a1f91ac.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, 29 Jun 2022 10:21:45 +0300 In-Reply-To: <20220621150902.46126-1-mlevitsk@redhat.com> References: <20220621150902.46126-1-mlevitsk@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.11.54.5 X-Spam-Status: No, score=-3.2 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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 very gentle ping on the patch series. Best regards, Maxim Levitsky