]> git.hungrycats.org Git - linux/commitdiff
Don't clear pcb.unique if CLONE_SETTLS is not set.
authorRichard Henderson <rth@dot.sfbay.redhat.com>
Sun, 3 Nov 2002 10:03:39 +0000 (02:03 -0800)
committerRichard Henderson <rth@are.twiddle.net>
Sun, 3 Nov 2002 10:03:39 +0000 (02:03 -0800)
arch/alpha/kernel/process.c

index 233fa4ce00af3a69587d24a011e2581085d73202..fd2920817515f587ec005ee3f130e6a14624ca8a 100644 (file)
@@ -315,7 +315,13 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 
        /* Set a new TLS for the child thread?  Peek back into the
           syscall arguments that we saved on syscall entry.  */
-       childti->pcb.unique = (clone_flags & CLONE_SETTLS ? regs->r19 : 0);
+       /* Note: if CLONE_SETTLS is not set, then we must inherit the
+          value from the parent, which will have been set by the block
+          copy in dup_task_struct.  This is non-intuitive, but is
+          required for proper operation in the case of a threaded
+          application calling fork.  */
+       if (clone_flags & CLONE_SETTLS)
+               childti->pcb.unique = regs->r19;
 
        return 0;
 }