From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC][PATCH 3/5] ksm source code Date: Thu, 24 Jan 2008 21:41:06 +0200 Message-ID: <4798E9D2.8030503@qumranet.com> References: <4794C477.3090708@qumranet.com> <20080124072432.GQ3627@sequoia.sous-sol.org> <4798554D.1010300@qumranet.com> <20080124175132.GR3627@sequoia.sous-sol.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel , andrea-atKUWr5tajBWk0Htik3J/w@public.gmane.org, yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org To: Chris Wright Return-path: In-Reply-To: <20080124175132.GR3627-JyIX8gxvWYPr2PDY2+4mTGD2FQJk+8+b@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Chris Wright wrote: >>> struct ksm_memory_region { >>> __u32 npages; /* number of pages to share */ >>> __u64 addr; /* the begining of the virtual address */ >>> }; >>> >> why isnt it compat safe? >> > > 32-bit has more relaxed alignment requirement for __u64 (4 bytes) > than 64-bit (8 bytes). choices are reverse the order or add padding > (can test by compiling structure in 32 and 64 bit). > Reversing the order isn't good enough, since the structure size would be different, and that is embedded in the ioctl number. Padding is necessary. [wishlist: struct { ... } __attribute__((abi_x86_64));] -- Any sufficiently difficult bug is indistinguishable from a feature. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/