From: Chris Wright Subject: Re: Weird overflowing user_desc assignment Date: Wed, 4 Oct 2006 10:28:27 -0700 Message-ID: <20061004172827.GA9732@sequoia.sous-sol.org> References: <1159982257.7523.24.camel@sisko.scot.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1159982257.7523.24.camel@sisko.scot.redhat.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Stephen C. Tweedie" Cc: Dave Jones , "xen-devel@lists.xensource.com" , Jan Beulich List-Id: xen-devel@lists.xenproject.org * Stephen C. Tweedie (sct@redhat.com) wrote: > static inline void set_32bit_tls(struct task_struct *t, int tls, u32 > addr) > { > struct user_desc ud = { > .base_addr = addr, > .limit = 0xfffff, > .contents = (3 << 3), /* user */ > .seg_32bit = 1, > .limit_in_pages = 1, > .useable = 1, > }; > struct n_desc_struct *desc = (void *)t->thread.tls_array; > desc += tls; > desc->a = LDT_entry_a(&ud); > desc->b = LDT_entry_b(&ud); > } > > where we get an overflow assigning "3 << 3" to ud.contents, which is a > 2-bit bitfield defined in include/asm-x86_64/ldt.h: > > struct user_desc { > ... > unsigned int contents:2; > ... > }; > > Any idea what the intention was here? And why this was never picked up? http://lists.xensource.com/archives/html/xen-devel/2006-02/msg00640.html thanks, -chris