From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Hajnoczi Subject: Re: [PATCH v3 27/32] nvdimm: support DSM_CMD_IMPLEMENTED function Date: Thu, 15 Oct 2015 17:01:43 +0200 Message-ID: <20151015150143.GC21733@stefanha-thinkpad.redhat.com> References: <1444535584-18220-1-git-send-email-guangrong.xiao@linux.intel.com> <1444535584-18220-28-git-send-email-guangrong.xiao@linux.intel.com> <20151014094134.GC14874@stefanha-thinkpad> <561E6C1F.2000502@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Stefan Hajnoczi , pbonzini@redhat.com, imammedo@redhat.com, gleb@kernel.org, mtosatti@redhat.com, mst@redhat.com, rth@twiddle.net, ehabkost@redhat.com, dan.j.williams@intel.com, kvm@vger.kernel.org, qemu-devel@nongnu.org To: Xiao Guangrong Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42499 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbbJOPzl (ORCPT ); Thu, 15 Oct 2015 11:55:41 -0400 Content-Disposition: inline In-Reply-To: <561E6C1F.2000502@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Oct 14, 2015 at 10:52:15PM +0800, Xiao Guangrong wrote: > On 10/14/2015 05:41 PM, Stefan Hajnoczi wrote: > >On Sun, Oct 11, 2015 at 11:52:59AM +0800, Xiao Guangrong wrote: > >>+ out->len = sizeof(out->status); > > > >out->len is uint16_t, it needs cpu_to_le16(). There may be other > >instances in this patch series. > > > > out->len is internally used only which is invisible to guest OS, i,e, > we write this value and read this value by ourself. I think it is > okay. 'out' points to guest memory. Guest memory is untrusted so QEMU cannot stash values there - an evil guest could modify them. Please put the len variable on the QEMU stack or heap where the guest cannot access it.