Messages in this thread |  | | Subject | Re: LDT currently unused? | From | Florian Weimer <> | Date | 13 Jul 1996 08:54:33 +0200 |
| |
Hi!
>>>>> "HL" == Hans Lermen <lermen@elserv.ffm.fgan.de> writes:
HL> On 10 Jul 1996, Florian Weimer wrote: >> I'm currently developing an application which needs call gates to >> kernel mode. These call gates are stored in the LDT of a certain >> process at a fixed position (currently, the first six descriptors >> are used by my program). Do I have to expect any conflicts with >> existing software? Are there any libraries which use the LDT?
HL> 1. LDT is _NOT_ 'unused'. The kernel uses the first 3 ones in the HL> default LDT. 'Wine' as well as 'DOSemu' use LDT-entries above HL> those. The default LDT is static, if you create your own entries, HL> the kernel will allocate a private 8K LDT for the process, taking HL> over the contents of the default LDT.
In 2.0.4, default_ldt contains only one entry. Do I have to copy this one to the new LDT? The kernel doesn't seem to do that.
HL> 2. The syscall you need to fiddle with LTD-stuff is sys_modify_ldt HL> (No.123). You have to use it directly (no lib-function HL> available)) by defining:
I use this syscall to clear the first entry of the LDT. The process gets its own LDT then. (I couldn't figure out how to do this from the kernel module.)
HL> 3. Though the CPU allowes you to have them in the LDT, Call-Gates HL> are refused by sys_modify_ldt (ldt_info.contents == 3), which will HL> return -EINVAL, if you anyway want to create one.
I've written a kernel module that implements a special character device. If a process (which must have its own LDT) opens it, the kernel module puts the call gates into the LDT of that process, directly writing to current->ldt[] and bypassing the kernel security checks.
Is it possible to do this without a device, i. e. call the function which sets up the LDT directly?
Regards Florian
|  |