bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnumach ChangeLog i386/i386/gdt.h i386/i386/pcb... [gnumach-1-branch


From: Jeroen Dekkers
Subject: Re: gnumach ChangeLog i386/i386/gdt.h i386/i386/pcb... [gnumach-1-branch]
Date: Mon, 06 Nov 2006 21:50:33 +0100
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/21.4 (x86_64-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Sun,  5 Nov 2006 19:59:44 -0800 (PST),
Roland McGrath wrote:
> 
> > #v+
> > 2006-01-26  Jeroen Dekkers  <jeroen@dekkers.cx>
> > 
> >         * i386/i386/locore.S (trap_push_segs): Switch fs and gs to kernel
> >         data segment too.
> >         (syscall_entry_2): Likewise.
> >         * i386/i386/user_ldt.c (i386_set_ldt): Always copy the master LDT
> >         when there is no old user LDT.
> > #v-
> > 
> > So, I guess we want to keep this installed?  We installed it that that
> > time, because it prevented GNU Mach from crashing when using the `ld.so'
> > of a tls enabled glibc.
> 
> I never reviewed that.  Someone explain it.

Thomas asked me on IRC if I could comment on this. This is what I
remember and what I understand from reading my old mails and the code
in question:

The if statement is bogus. Threads share a default LDT. This is the
master LDT and has the call gate for system calls and the CS and DS
segment descriptors. When we add a segment register we have to make a
new LDT specific to the thread. When doing this we need to copy the
entries from master LDT into the thread's new LDT or else we won't
have a segment descriptor for CS and DS and we won't have the call
gate.

The if check looks whether the thread of which we modify the LDT is
the current thread and only copies the master LDT when that's the
case. So if the thread isn't a current thread we will have an LDT
without a CS/DS descriptor and call gate. A nice and not so easy to
debug crash is the result when we switch to that thread later on.

So we definitely want to keep this installed.

Jeroen Dekkers




reply via email to

[Prev in Thread] Current Thread [Next in Thread]