]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
riscv: Implement copy_thread_tls
authorAmanieu d'Antras <amanieu@gmail.com>
Thu, 2 Jan 2020 17:24:11 +0000 (18:24 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 7 Jan 2020 12:31:23 +0000 (13:31 +0100)
This is required for clone3 which passes the TLS value through a
struct rather than a register.

Signed-off-by: Amanieu d'Antras <amanieu@gmail.com>
Cc: linux-riscv@lists.infradead.org
Cc: <stable@vger.kernel.org> # 5.3.x
Link: https://lore.kernel.org/r/20200102172413.654385-6-amanieu@gmail.com
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
arch/riscv/Kconfig
arch/riscv/kernel/process.c

index a31169b02ec060757455b46ece6fde94c2c60beb..fa7dc03459e7f1e7168e9dbef0a3ecf14dae175e 100644 (file)
@@ -65,6 +65,7 @@ config RISCV
        select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
        select HAVE_ARCH_MMAP_RND_BITS if MMU
        select ARCH_HAS_GCOV_PROFILE_ALL
+       select HAVE_COPY_THREAD_TLS
 
 config ARCH_MMAP_RND_BITS_MIN
        default 18 if 64BIT
index 95a3031e5c7c9dcfdebaa06ba20f8da31424f905..817cf7b0974ced30d75d536b192b73b4e3c25bdf 100644 (file)
@@ -99,8 +99,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
        return 0;
 }
 
-int copy_thread(unsigned long clone_flags, unsigned long usp,
-       unsigned long arg, struct task_struct *p)
+int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
+       unsigned long arg, struct task_struct *p, unsigned long tls)
 {
        struct pt_regs *childregs = task_pt_regs(p);
 
@@ -121,7 +121,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
                if (usp) /* User fork */
                        childregs->sp = usp;
                if (clone_flags & CLONE_SETTLS)
-                       childregs->tp = childregs->a5;
+                       childregs->tp = tls;
                childregs->a0 = 0; /* Return value of fork() */
                p->thread.ra = (unsigned long)ret_from_fork;
        }