Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp364776pxb; Wed, 6 Oct 2021 06:41:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAgHKcMUHpnT+TaUpSDHWNL+TIorcpues9H203YvdOEZ2Vy6OdoO6S5LceEWNU3zqhc5GH X-Received: by 2002:a17:906:7d42:: with SMTP id l2mr33734880ejp.467.1633527677498; Wed, 06 Oct 2021 06:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633527677; cv=none; d=google.com; s=arc-20160816; b=XsZPsngMmwH02zdh/WmaNAEQ/RNpgFI//9eUW/qhBUsvF4mN+1rnqztpehIV7q9Vzk Ow4xe49+O+7CGdrt3OBp2ycPq+Wb3GpVo97kevx1KEt212KRPJGGila6/C2bCTzk2bgH iTj3U3bFe98z+6DwnIQYsh1CRF4a9IyqUPBaZ6ImJr2mxFf9TNRk4dhpKtllnVZ7BD6s y2BWlZ9T40zP4Wg5nHUvdWbhYAll6oNFgpdtwUhm6aOvlVNecoRz8Pl5HjK0XxGcouv9 8JKfTmoaA9CH1edy5tNL4FdKsCXg3e7bFLvS01RqWwFKM0tzbUjZbHYIR4hqGzgZg9yK Sj/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=v4OPt14HI09D78HsjyWQkPcigjMl6xalqCC+QbfcQbM=; b=oBAN2JlhtGzAvCG6M99qXGkm5ujpvjRh7vddLg1SOiyj9SQruutrngUbFdbqOZ7/te Pt36FU824/fNpXg+8Bl5dPdam3Ioqglypgrxtv0tOScxCxQDwQAQj+0uCiHYl5xxdgou 0Qef+H9VH43Zg8VOKi4+vcq5zg+BHhX4wRsEqSbj3mMt2INPmMmiMZtTpZUz4IzaU//+ pSs+u0Z440KVrOKgUPwDppkh5BGYsWYd4HOTSMepJcNNlg05StpsW28SqkFHITU4fH4v r9jTuvQzzJ8xYlGeZGBlcZegi/IKH+bIctga+t1EKP3ixsOhI6MIS9H1jGmSfOLACQ4m e3ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q0OB3NWf; 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 y17si25952145edm.70.2021.10.06.06.40.52; Wed, 06 Oct 2021 06:41:17 -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=Q0OB3NWf; 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 S238914AbhJFNid (ORCPT + 99 others); Wed, 6 Oct 2021 09:38:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41432 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238807AbhJFNi0 (ORCPT ); Wed, 6 Oct 2021 09:38:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633527394; 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=v4OPt14HI09D78HsjyWQkPcigjMl6xalqCC+QbfcQbM=; b=Q0OB3NWf3/zAly13vX+ATT8rBQpgE4qR+pnH2gqV3FlsGVjZOviutJy21xScfJGwrZviiO gPj42cX1ePQyq5Mh7Ldxshs5Ww8TJKy34CFF2PqN9NaCZK6aYDkY/mx10a0VIYwozcQkF0 Ygai5s70QPC2lRJvUMu/SYutnQ/p2Fc= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-knlV_h46OwWNOysAiQMEiw-1; Wed, 06 Oct 2021 09:36:33 -0400 X-MC-Unique: knlV_h46OwWNOysAiQMEiw-1 Received: by mail-ed1-f71.google.com with SMTP id w6-20020a50d786000000b003dabc563406so2631527edi.17 for ; Wed, 06 Oct 2021 06:36:32 -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:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=v4OPt14HI09D78HsjyWQkPcigjMl6xalqCC+QbfcQbM=; b=I+ZLUwwLmk/qzgOpk+gB0KG+6EmGG4VLXemvjf/qYBq2FUg5f+qSI9P+s0uF3AsNh/ D/d6TN0hPTEb6A5xXrC5lYXdmz7iM+8P3fqQkV0x4lL9BzuPZ96HPdK6iHgKZRkYL8R7 y3ZErwrkV6DTS8kDjcQzj93YIEHRNo8Vmhthe7S+ybGTaB4YyLJ92UOxsJSn3XOkmUEC 2cODSv5yRxI9iDLIKUnW3VHpXZFU0BbxAi4qED94wAJLSt02q4VhRnn1s6AnVGa4uPW0 WQA2X6xQv7i07OjjbNxonIaozMwyKBnLVEfgQYI9iEsjfaekIQJskZkByXmZ/roGGfJO q7ow== X-Gm-Message-State: AOAM530w/a1XnOX77x1GskMydK28rEAm53yycskWINp2VZDZl7wZ16yx ofUjbWwModFCiYKU64/dgPrDNCFw6qZ7yHp5QD2X9zHgmDm4r6x/7ZaRnhoZ47cGkQksTsxPMNK f9+bm1G4KUkjun3D5DIl426W9 X-Received: by 2002:a17:906:70c5:: with SMTP id g5mr33648375ejk.63.1633527391916; Wed, 06 Oct 2021 06:36:31 -0700 (PDT) X-Received: by 2002:a17:906:70c5:: with SMTP id g5mr33648358ejk.63.1633527391741; Wed, 06 Oct 2021 06:36:31 -0700 (PDT) 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 e15sm7581619ejr.58.2021.10.06.06.36.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Oct 2021 06:36:31 -0700 (PDT) Message-ID: Date: Wed, 6 Oct 2021 15:36:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [PATCH MANUALSEL 5.14 4/9] KVM: x86: reset pdptrs_from_userspace when exiting smm Content-Language: en-US To: Sasha Levin , linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Maxim Levitsky , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, kvm@vger.kernel.org References: <20211006133021.271905-1-sashal@kernel.org> <20211006133021.271905-4-sashal@kernel.org> From: Paolo Bonzini In-Reply-To: <20211006133021.271905-4-sashal@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/10/21 15:30, Sasha Levin wrote: > From: Maxim Levitsky > > [ Upstream commit 37687c403a641f251cb2ef2e7830b88aa0647ba9 ] > > When exiting SMM, pdpts are loaded again from the guest memory. > > This fixes a theoretical bug, when exit from SMM triggers entry to the > nested guest which re-uses some of the migration > code which uses this flag as a workaround for a legacy userspace. > > Signed-off-by: Maxim Levitsky > Message-Id: <20210913140954.165665-4-mlevitsk@redhat.com> > Signed-off-by: Paolo Bonzini > Signed-off-by: Sasha Levin > --- > arch/x86/kvm/x86.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index b3f855d48f72..1e7d629bbf36 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -7659,6 +7659,13 @@ static void kvm_smm_changed(struct kvm_vcpu *vcpu, bool entering_smm) > > /* Process a latched INIT or SMI, if any. */ > kvm_make_request(KVM_REQ_EVENT, vcpu); > + > + /* > + * Even if KVM_SET_SREGS2 loaded PDPTRs out of band, > + * on SMM exit we still need to reload them from > + * guest memory > + */ > + vcpu->arch.pdptrs_from_userspace = false; > } > > kvm_mmu_reset_context(vcpu); > Acked-by: Paolo Bonzini