From: Stefano Stabellini Subject: Re: [PATCH 3/5] xen: few more xen_ulong_t substitutions Date: Wed, 8 Aug 2012 13:12:42 +0100 Message-ID: References: <1344262325-26598-3-git-send-email-stefano.stabellini@eu.citrix.com> <5020011F0200007800092FD7@nat28.tlf.novell.com> <50212C2B02000078000933CE@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <50212C2B02000078000933CE@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: "Tim Deegan (3P)" , xen-devel , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Tue, 7 Aug 2012, Jan Beulich wrote: > > Considering that each field of a multicall_entry is usually passed as an > > hypercall parameter, they should all remain unsigned long. > > That'll give you subtle bugs I'm afraid: do_memory_op()'s > encoding of a continuation start extent (into the 'cmd' value), > for example, depends on being able to store the full value into > the command field of the multicall structure. The limit checking > of the permitted number of extents therefore is different > between native (ULONG_MAX >> MEMOP_EXTENT_SHIFT) and > compat (UINT_MAX >> MEMOP_EXTENT_SHIFT). I would > neither find it very appealing to have do_memory_op() adjusted > for dealing with this new special case, nor am I sure that's the > only place your approach would cause problems if you excluded > the multicall structure from the model change. Given the way the continuation is implemented, the same problem can also happen on x86. In fact, considering that we don't use any compat code, and that do_memory_op has the following check: /* Is size too large for us to encode a continuation? */ if ( reservation.nr_extents > (ULONG_MAX >> MEMOP_EXTENT_SHIFT) ) return start_extent; it would work as-is for ARM too.