This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
LDT initialization after fork() for LinuxThreads?
- To: libc-alpha at sources dot redhat dot com
- Subject: LDT initialization after fork() for LinuxThreads?
- From: Wolfram Gloger <Wolfram dot Gloger at dent dot med dot uni-muenchen dot de>
- Date: Wed, 27 Jun 2001 16:46:46 +0200 (MDT)
Hi,
Maybe I'm missing something obvious, or I just don't understand the
LDT stuff sufficiently.
But, my tests indicate that modified LDT entries aren't inherited
across fork(). So, aren't we missing something like the untested
patch below, since __pthread_reset_main_thread() doesn't do any
INIT_THREAD_SELF?
Regards,
Wolfram.
--- linuxthreads/ptfork.c~ Sun Jan 7 05:35:20 2001
+++ linuxthreads/ptfork.c Wed Jun 27 16:36:10 2001
@@ -78,6 +78,7 @@
pid_t __fork(void)
{
+ pthread_descr self = THREAD_SELF;
pid_t pid;
pthread_mutex_lock(&pthread_atfork_lock);
@@ -89,6 +90,9 @@
pid = __libc_fork();
if (pid == 0) {
+#ifdef INIT_THREAD_SELF
+ INIT_THREAD_SELF(self, self->p_nr);
+#endif
__pthread_reset_main_thread();
__fresetlockfiles();