WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Weird overflowing user_desc assignment

To: "Stephen C. Tweedie" <sct@xxxxxxxxxx>
Subject: Re: [Xen-devel] Weird overflowing user_desc assignment
From: Chris Wright <chrisw@xxxxxxxxxxxx>
Date: Wed, 4 Oct 2006 10:28:27 -0700
Cc: Dave Jones <davej@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Delivery-date: Wed, 04 Oct 2006 10:28:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1159982257.7523.24.camel@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1159982257.7523.24.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
* Stephen C. Tweedie (sct@xxxxxxxxxx) 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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>