Hi,

while trying to run x286emul with kernel 2.2.10 I discovered a change in
ldt handling of the kernel in arch/i386/kernel/ldt.c :

For a process without ldt, the first modify_ldt(0,...) did return the 
default_ldt containing the lcall7 call gate in slot 0 with kernels 2.0.x and 
2.1.x (at least up to x = 76 ). 

Kernel 2.2.x returns an empty ldt. After loading of the binary by binfmt_xout.c
there is a slot 0 in the ldt but it does not contain the call gate.

I changed arch/i386/kernel/ldt.c to the old behaviour (see patch ) and x286emul 
is working.

Now I wonder, if this is a feature or a bug in kernel 2.2.x and if it is a
feature, is it safe to apply my patch? 

Joerg 
*** arch/i386/kernel/ldt.c      Sun Sep 13 21:16:22 1998
--- ../linux-2.2.10a/arch/i386/kernel/ldt.c     Sun Jul  4 16:07:13 1999
*************** static int read_ldt(void * ptr, unsigned
*** 24,32 ****
  
        if (!ptr)
                return -EINVAL;
-       if (!address)
-               return 0;
        size = LDT_ENTRIES*LDT_ENTRY_SIZE;
        if (size > bytecount)
                size = bytecount;
        return copy_to_user(ptr, address, size) ? -EFAULT : size;
--- 24,36 ----
  
        if (!ptr)
                return -EINVAL;
        size = LDT_ENTRIES*LDT_ENTRY_SIZE;
+       if (!address)
+ /* joerg              return 0; */
+       {
+               address = &default_ldt;
+               size = sizeof(default_ldt);
+       }
        if (size > bytecount)
                size = bytecount;
        return copy_to_user(ptr, address, size) ? -EFAULT : size;
--
------------------------------------------------------------------------------
Joerg Ahrens                                              _/           
Koenigsberger Strasse 32                                _/_/
31226 Peine                                           _/  _/
Tel.: 05171/57308                             _/    _/_/_/_/
e-mail: [EMAIL PROTECTED]                _/_/_/_/      _/
------------------------------------------------------------------------------

Reply via email to