Cui, Dexuan
2007-May-13 07:49 UTC
[Xen-devel] [PATCH] Fix write parameter masking for 32-bit guests.
Changeset 15046:e527b4ff1948 breaks 32-bit HVM guest: when req->size is 4, "1UL << 32" returns 1 in IA32 system, so the mask becomes 0 wrongly. The attached patch fixes this by using 64-bit left-shift. Signed-off-by: Dexuan Cui <dexuan.cui@intel.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Cui, Dexuan
2007-May-13 08:47 UTC
RE: [Xen-devel] [PATCH] Fix write parameter masking for 32-bit guests.
Well, the method in the previous mail may be a little complex -- I think the simplest way is: - if (!req->data_is_ptr && (req->dir == IOREQ_WRITE) && (req->size != sizeof(req->data))) + if (!req->data_is_ptr && (req->dir == IOREQ_WRITE) && (req->size != sizeof(long))) Since sizeof(long) = 4 in 32-bit platform, and = 8 in 64-bit platform, the code here can work properly in 32/64-bit platforms. -- Dexuan -----Original Message----- From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Cui, Dexuan Sent: 2007年5月13日 15:49 To: xen-devel@lists.xensource.com Cc: Keir Fraser Subject: [Xen-devel] [PATCH] Fix write parameter masking for 32-bit guests. Changeset 15046:e527b4ff1948 breaks 32-bit HVM guest: when req->size is 4, "1UL << 32" returns 1 in IA32 system, so the mask becomes 0 wrongly. The attached patch fixes this by using 64-bit left-shift. Signed-off-by: Dexuan Cui <dexuan.cui@intel.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2007-May-13 09:05 UTC
Re: [Xen-devel] [PATCH] Fix write parameter masking for 32-bit guests.
Okay, see c/s 15053. Thanks, Keir On 13/5/07 09:47, "Cui, Dexuan" <dexuan.cui@intel.com> wrote:> Well, the method in the previous mail may be a little complex -- I think the > simplest way is: > > - if (!req->data_is_ptr && (req->dir == IOREQ_WRITE) && (req->size !> sizeof(req->data))) > + if (!req->data_is_ptr && (req->dir == IOREQ_WRITE) && (req->size !> sizeof(long))) > > Since sizeof(long) = 4 in 32-bit platform, and = 8 in 64-bit platform, the > code here can work properly in 32/64-bit platforms. > > -- Dexuan > > > -----Original Message----- > From: xen-devel-bounces@lists.xensource.com > [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Cui, Dexuan > Sent: 2007年5月13日 15:49 > To: xen-devel@lists.xensource.com > Cc: Keir Fraser > Subject: [Xen-devel] [PATCH] Fix write parameter masking for 32-bit guests. > > Changeset 15046:e527b4ff1948 breaks 32-bit HVM guest: when req->size is > 4, "1UL << 32" returns 1 in IA32 system, so the mask becomes 0 wrongly. > The attached patch fixes this by using 64-bit left-shift. > > Signed-off-by: Dexuan Cui <dexuan.cui@intel.com> > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel