From owner-freebsd-current@FreeBSD.ORG Fri Aug 1 17:19:32 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D889837B401; Fri, 1 Aug 2003 17:19:32 -0700 (PDT) Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id 248E043FBF; Fri, 1 Aug 2003 17:19:32 -0700 (PDT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([12.233.125.100]) by attbi.com (rwcrmhc13) with ESMTP id <2003080200193101500jehoge>; Sat, 2 Aug 2003 00:19:31 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id RAA48070; Fri, 1 Aug 2003 17:19:29 -0700 (PDT) Date: Fri, 1 Aug 2003 17:19:27 -0700 (PDT) From: Julian Elischer To: deischen@freebsd.org In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: current@freebsd.org cc: David Xu cc: Marcel Moolenaar Subject: Re: NVidia glx stuff dies in sysarch(I386_SET_LDT, ...) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2003 00:19:33 -0000 On Fri, 1 Aug 2003, Daniel Eischen wrote: > On Fri, 1 Aug 2003, Julian Elischer wrote: > > > > Here's my first patch.. > > I'd suggest this (along with man page change) to go in first > > for a while before we break people's code. > > > > cvs server: Diffing . > > Index: sys_machdep.c > > =================================================================== > > RCS file: /home/ncvs/src/sys/i386/i386/sys_machdep.c,v > > retrieving revision 1.86 > > diff -u -r1.86 sys_machdep.c > > --- sys_machdep.c 31 Jul 2003 08:20:24 -0000 1.86 > > +++ sys_machdep.c 1 Aug 2003 23:58:29 -0000 > > @@ -410,6 +410,9 @@ > > return(error); > > } > > > > +static int ldt_warnings; > > +#define NUM_LDT_WARNINGS 10 > > + > > static int > > i386_set_ldt(td, args) > > struct thread *td; > > @@ -441,7 +444,7 @@ > > uap->start = NLDT; > > uap->num = MAX_LD - NLDT; > > } > > - if (uap->start < NLDT || uap->num <= 0) > > + if (uap->start <= LUDATA_SEL || uap->num <= 0) > > return (EINVAL); > > mtx_lock_spin(&sched_lock); > > pldt = mdp->md_ldt; > > @@ -460,10 +463,16 @@ > > } > > > > if (!(uap->start == 0 && uap->num == 1)) { > > + /* complain a for a while if using old methods */ > > + if (ldt_warnings++ < NUM_LDT_WARNINGS) { > > + printf("Warning: pid %d used static ldt > > allocation.\n", > > + td->td_proc->p_pid); > > + printf("See the i386_set_ldt man page for more > > info\n"); > > + } > > /* verify range of descriptors to modify */ > > largest_ld = uap->start + uap->num; > > - if (uap->start < NLDT || uap->start >= MAX_LD || > > uap->num < 0 || > > - largest_ld > MAX_LD) { > > + if (uap->start <= LUDATA_SEL || uap->start >= MAX_LD || > > + uap->num < 0 || largest_ld > MAX_LD) { > > return (EINVAL); > > } > > } > > @@ -562,7 +571,7 @@ > > again: > > mtx_lock_spin(&sched_lock); > > dp = &((union descriptor *)(pldt->ldt_base))[NLDT]; > > - for (i = NLDT; i < pldt->ldt_len; ++i) { > > + for (i = LUDATA_SEL + 1; i < pldt->ldt_len; ++i) { > > Looks OK, but if we are doing a dynamic allocation, it might be > better to start at NLDT just to avoid the known problem of someone > using 6... Just a thought. sure.. (though we don't know how many they use.... we just saw the first one fail). of course they only link with linux threads. when they link with us they's use our %gs.. I also noticed that if we disable the 'splat' mode, we'd break sysVR4 binary code as they do that.. (though it's #if 0'd out at the moment) > > -- > Dan Eischen > >