]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
x86: opt into HAVE_COPY_THREAD_TLS, for both 32-bit and 64-bit
authorJosh Triplett <josh@joshtriplett.org>
Tue, 30 Jun 2015 22:00:00 +0000 (15:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 Jul 2015 02:45:01 +0000 (19:45 -0700)
For 32-bit userspace on a 64-bit kernel, this requires modifying
stub32_clone to actually swap the appropriate arguments to match
CONFIG_CLONE_BACKWARDS, rather than just leaving the C argument for tls
broken.

Patch co-authored by Josh Triplett and Thiago Macieira.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Thiago Macieira <thiago.macieira@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/x86/Kconfig
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c

index 47365c7b9f47b0f15cf00a2eae901ed0cbc5474e..55bced17dc95a475194f624d0e259fcaee3f8c8a 100644 (file)
@@ -88,6 +88,7 @@ config X86
        select HAVE_CMPXCHG_DOUBLE
        select HAVE_CMPXCHG_LOCAL
        select HAVE_CONTEXT_TRACKING            if X86_64
+       select HAVE_COPY_THREAD_TLS
        select HAVE_C_RECORDMCOUNT
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DEBUG_STACKOVERFLOW
index c09c99ccf3e33fc5afff500b6310e2e6f9150526..f73c962fe636a268851e1c61e97b55c075ebb687 100644 (file)
@@ -128,8 +128,8 @@ void release_thread(struct task_struct *dead_task)
        release_vm86_irqs(dead_task);
 }
 
-int copy_thread(unsigned long clone_flags, unsigned long sp,
-       unsigned long arg, struct task_struct *p)
+int copy_thread_tls(unsigned long clone_flags, unsigned long sp,
+       unsigned long arg, struct task_struct *p, unsigned long tls)
 {
        struct pt_regs *childregs = task_pt_regs(p);
        struct task_struct *tsk;
@@ -184,7 +184,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
         */
        if (clone_flags & CLONE_SETTLS)
                err = do_set_thread_area(p, -1,
-                       (struct user_desc __user *)childregs->si, 0);
+                       (struct user_desc __user *)tls, 0);
 
        if (err && p->thread.io_bitmap_ptr) {
                kfree(p->thread.io_bitmap_ptr);
index 843f92e4c7110cd621fb94dfca8cb980044fa32d..71d7849a07f7ca93b126bf081464012c7a91c9a6 100644 (file)
@@ -150,8 +150,8 @@ static inline u32 read_32bit_tls(struct task_struct *t, int tls)
        return get_desc_base(&t->thread.tls_array[tls]);
 }
 
-int copy_thread(unsigned long clone_flags, unsigned long sp,
-               unsigned long arg, struct task_struct *p)
+int copy_thread_tls(unsigned long clone_flags, unsigned long sp,
+               unsigned long arg, struct task_struct *p, unsigned long tls)
 {
        int err;
        struct pt_regs *childregs;
@@ -207,10 +207,10 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
 #ifdef CONFIG_IA32_EMULATION
                if (is_ia32_task())
                        err = do_set_thread_area(p, -1,
-                               (struct user_desc __user *)childregs->si, 0);
+                               (struct user_desc __user *)tls, 0);
                else
 #endif
-                       err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8);
+                       err = do_arch_prctl(p, ARCH_SET_FS, tls);
                if (err)
                        goto out;
        }