Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Aug 2003 18:33:33 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        current@freebsd.org
Subject:   Re: NVidia glx stuff dies in sysarch(I386_SET_LDT, ...)
Message-ID:  <Pine.GSO.4.10.10308011823480.13943-100000@pcnet5.pcnet.com>
In-Reply-To: <Pine.BSF.4.21.0308011511170.46065-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 1 Aug 2003, Julian Elischer wrote:
> 
> On Fri, 1 Aug 2003, Daniel Eischen wrote:
> 
> > On Fri, 1 Aug 2003, Thorsten Greiner wrote:
> > 
> > > * Thorsten Greiner <thorsten.greiner@web.de> [2003-08-01 23:47]:
> > > > I will test wether the problem still occurs with version 1.84 of
> > > > sys_machdep.c and let you know.
> > > 
> > > Yup, reverting to 1.84 unbreaks this for me. Looking at the changes
> > > made it appears to me that the check
> > > 
> > >         if (uap->start < NLDT || uap->num <= 0)
> > >             return (EINVAL);i
> > > 
> > > causes this, because NLDT is 6 and the NVidia stuff passes
> > > uap->start == 6 to this call.
> > 
> > It can't use 6.  FreeBSD reserves 0-16 for its own use.
> > 
> > I think the bug was in the old code allowing this to
> > happen...
> 
> Looking at segments.h.....
> /*
>  * Entries in the Local Descriptor Table (LDT)
>  */
> #define LSYS5CALLS_SEL  0       /* forced by intel BCS */
> #define LSYS5SIGR_SEL   1
> #define L43BSDCALLS_SEL 2       /* notyet */
> #define LUCODE_SEL      3
> #define LSOL26CALLS_SEL 4       /* Solaris >= 2.6 system call gate */
> #define LUDATA_SEL      5
> /* separate stack, es,fs,gs sels ? */
> /* #define      LPOSIXCALLS_SEL 5*/     /* notyet */
> #define LBSDICALLS_SEL  16      /* BSDI system call gate */
> #define NLDT            (LBSDICALLS_SEL + 1)
> 
> it looks like NLDT should be save between from 6 to 15
> (though I wish they'd chosen a different value)
> 
> so we could add:
> 
> if ((uap->start == LBSDICALLS_SEL) || (uap->start <= LUDATA_SEL)) ||
>     (uap->num <= 0))
> ...
> 
> What do you think?

I think it could work, but do we want it to work?  If we
are really reserving the first 17 (16 really, since 0
is invalid), then what are we to do if we want to
use another one?  Do we add NVidia's LDTs to segments.h
so that we, or anyone else, will not use them?

We could make a new syscall and use the old one
for compat behavior, or make it a compile time
option...

If they ever recompile, they really want to be using
the new interface, so I think breaking it by default
would be good.

-- 
Dan Eischen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10308011823480.13943-100000>