Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4584536pxj; Wed, 12 May 2021 08:41:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzorAVpOWEOLIIyE5udvOQz2prpGDuqOPQVgTPRkhEoYvaDPRSOauXZWF6uIeqc8Q7DmSJo X-Received: by 2002:aa7:c9cb:: with SMTP id i11mr44687385edt.331.1620834093998; Wed, 12 May 2021 08:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834093; cv=none; d=google.com; s=arc-20160816; b=byAjbb+IUPd2VmjOKAxX620C4MU4GIcrGtY2gL30+nMvtZsX357FwWAfqGtdKDWIqe cdly60hRgei/XyniLFQ0LqCeVIwMPxHjY9OAPwlJp9iWNKJCdnO+LXVdmSPaiJTIm8P0 /ibsDiNDFXXE96Jf+kRETrWQgHPZvcS3S6HNhzaKJ9EKt8r/UDwxjTSDkn3wZ8GFFfkK 6IidBIzwKndD32NlM+KKh0tgWg9FpppS+KbnGGnAf70H78b8pxr1cD7SHYyR7AZGnZr1 1nGU6akJbgZcZCHDc4VW+wxlZALBjrk/b/SCWihAW7/fuoar9ggGAqAPjDdlHtBicLSZ MvDg== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=VVxYJCj6q4S68WuoYuMsDziKj7O+NIJDQ6e2VLt5Yco=; b=dcd73FD2XP4cDP4SXtfsmpMfQC4uIczuMjg4OZQOVH4MNvh5+yEgxWJxurL4pXkjA5 ALPUc2knLToFxggV7s42ei2UKOtH4/esIKkEkfYe9JHT2bT/ew46iJ+09KHt8ewMoUop 0nv77Qr9iuKnuXWWfcsAWuRmYLhxi0Y9jq07UvhrKY14OMjoEG2roMipk9h0jKywJLrf N5gRHT8tdJWiSHz0Z6kZzAR4jGcNHhJhgAXQhrDzSN8L2SWb93FtHfEOFGBqe5NSGIf6 w9GpklqSmuz2G3qVZfDrGjU/2c/CgxB6Mzy1T05bWjTwfuDkcIiDz2IGUTt5CyKNFgI7 DTng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o1wAxpRu; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si233606ejp.276.2021.05.12.08.41.09; Wed, 12 May 2021 08:41:33 -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=@linuxfoundation.org header.s=korg header.b=o1wAxpRu; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236434AbhELPhy (ORCPT + 99 others); Wed, 12 May 2021 11:37:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:50766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234410AbhELPQs (ORCPT ); Wed, 12 May 2021 11:16:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8602461987; Wed, 12 May 2021 15:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832009; bh=fnjachLncNmpCE5VDeUIUTcG+3pLqnO+f6QKj2P9gxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o1wAxpRuobVRLkekV71CXS/iWthih1RXX7r9v2CCyB6eRfHz548+SvhfD+v7108zp IUqJfjY6VLY2poTKeathF1SdpLXgZA+VqIiugf9FPoy597j8a8KUSSDTBnd3PB0vog ozafpsO2KM8b6m76EgrQGqUkO3QCboZVR9EE3iSI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier Subject: [PATCH 5.10 103/530] KVM: arm64: Fully zero the vcpu state on reset Date: Wed, 12 May 2021 16:43:33 +0200 Message-Id: <20210512144823.186529334@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marc Zyngier commit 85d703746154cdc6794b6654b587b0b0354c97e9 upstream. On vcpu reset, we expect all the registers to be brought back to their initial state, which happens to be a bunch of zeroes. However, some recent commit broke this, and is now leaving a bunch of registers (such as the FP state) with whatever was left by the guest. My bad. Zero the reset of the state (32bit SPSRs and FPSIMD state). Cc: stable@vger.kernel.org Fixes: e47c2055c68e ("KVM: arm64: Make struct kvm_regs userspace-only") Signed-off-by: Marc Zyngier Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kvm/reset.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/arch/arm64/kvm/reset.c +++ b/arch/arm64/kvm/reset.c @@ -291,6 +291,11 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu /* Reset core registers */ memset(vcpu_gp_regs(vcpu), 0, sizeof(*vcpu_gp_regs(vcpu))); + memset(&vcpu->arch.ctxt.fp_regs, 0, sizeof(vcpu->arch.ctxt.fp_regs)); + vcpu->arch.ctxt.spsr_abt = 0; + vcpu->arch.ctxt.spsr_und = 0; + vcpu->arch.ctxt.spsr_irq = 0; + vcpu->arch.ctxt.spsr_fiq = 0; vcpu_gp_regs(vcpu)->pstate = pstate; /* Reset system registers */