From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40c4sn3RF0zF2Tm for ; Thu, 3 May 2018 16:26:21 +1000 (AEST) Date: Thu, 3 May 2018 15:48:26 +1000 From: Paul Mackerras To: wei.guo.simon@gmail.com Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 03/11] KVM: PPC: Fix a mmio_host_swabbed uninitialized usage issue when VMX store Message-ID: <20180503054826.GD6795@fergus.ozlabs.ibm.com> References: <1524657284-16706-1-git-send-email-wei.guo.simon@gmail.com> <1524657284-16706-4-git-send-email-wei.guo.simon@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1524657284-16706-4-git-send-email-wei.guo.simon@gmail.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Wed, Apr 25, 2018 at 07:54:36PM +0800, wei.guo.simon@gmail.com wrote: > From: Simon Guo > > When KVM emulates VMX store, it will invoke kvmppc_get_vmx_data() to > retrieve VMX reg val. kvmppc_get_vmx_data() will check mmio_host_swabbed > to decide which double word of vr[] to be used. But the > mmio_host_swabbed can be uninitiazed during VMX store procedure: > > kvmppc_emulate_loadstore > \- kvmppc_handle_store128_by2x64 > \- kvmppc_get_vmx_data > > This patch corrects this by using kvmppc_need_byteswap() to choose > double word of vr[] and initialized mmio_host_swabbed to avoid invisble > trouble. > > Signed-off-by: Simon Guo The patch is correct, but I think the patch description needs to say that vcpu->arch.mmio_host_swabbed is not meant to be used at all for emulation of store instructions, and this patch makes that true for VMX stores. Paul.