All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amanieu d'Antras <amanieu@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Christian Brauner <christian@brauner.io>,
	stable@vger.kernel.org, Amanieu d'Antras <amanieu@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/7] arm: Implement copy_thread_tls
Date: Thu,  2 Jan 2020 18:24:09 +0100	[thread overview]
Message-ID: <20200102172413.654385-4-amanieu@gmail.com> (raw)
In-Reply-To: <20200102172413.654385-1-amanieu@gmail.com>

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-arm-kernel@lists.infradead.org
Cc: <stable@vger.kernel.org> # 5.3.x
---
 arch/arm/Kconfig          | 1 +
 arch/arm/kernel/process.c | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ba75e3661a41..96dab76da3b3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -72,6 +72,7 @@ config ARM
 	select HAVE_ARM_SMCCC if CPU_V7
 	select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32
 	select HAVE_CONTEXT_TRACKING
+	select HAVE_COPY_THREAD_TLS
 	select HAVE_C_RECORDMCOUNT
 	select HAVE_DEBUG_KMEMLEAK
 	select HAVE_DMA_CONTIGUOUS if MMU
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index cea1c27c29cb..46e478fb5ea2 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -226,8 +226,8 @@ void release_thread(struct task_struct *dead_task)
 asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
 
 int
-copy_thread(unsigned long clone_flags, unsigned long stack_start,
-	    unsigned long stk_sz, struct task_struct *p)
+copy_thread_tls(unsigned long clone_flags, unsigned long stack_start,
+	    unsigned long stk_sz, struct task_struct *p, unsigned long tls)
 {
 	struct thread_info *thread = task_thread_info(p);
 	struct pt_regs *childregs = task_pt_regs(p);
@@ -261,7 +261,7 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,
 	clear_ptrace_hw_breakpoint(p);
 
 	if (clone_flags & CLONE_SETTLS)
-		thread->tp_value[0] = childregs->ARM_r3;
+		thread->tp_value[0] = tls;
 	thread->tp_value[1] = get_tpuser();
 
 	thread_notify(THREAD_NOTIFY_COPY, thread);
-- 
2.24.1


WARNING: multiple messages have this Message-ID (diff)
From: Amanieu d'Antras <amanieu@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	Amanieu d'Antras <amanieu@gmail.com>,
	stable@vger.kernel.org, Christian Brauner <christian@brauner.io>
Subject: [PATCH 3/7] arm: Implement copy_thread_tls
Date: Thu,  2 Jan 2020 18:24:09 +0100	[thread overview]
Message-ID: <20200102172413.654385-4-amanieu@gmail.com> (raw)
In-Reply-To: <20200102172413.654385-1-amanieu@gmail.com>

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-arm-kernel@lists.infradead.org
Cc: <stable@vger.kernel.org> # 5.3.x
---
 arch/arm/Kconfig          | 1 +
 arch/arm/kernel/process.c | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ba75e3661a41..96dab76da3b3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -72,6 +72,7 @@ config ARM
 	select HAVE_ARM_SMCCC if CPU_V7
 	select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32
 	select HAVE_CONTEXT_TRACKING
+	select HAVE_COPY_THREAD_TLS
 	select HAVE_C_RECORDMCOUNT
 	select HAVE_DEBUG_KMEMLEAK
 	select HAVE_DMA_CONTIGUOUS if MMU
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index cea1c27c29cb..46e478fb5ea2 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -226,8 +226,8 @@ void release_thread(struct task_struct *dead_task)
 asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
 
 int
-copy_thread(unsigned long clone_flags, unsigned long stack_start,
-	    unsigned long stk_sz, struct task_struct *p)
+copy_thread_tls(unsigned long clone_flags, unsigned long stack_start,
+	    unsigned long stk_sz, struct task_struct *p, unsigned long tls)
 {
 	struct thread_info *thread = task_thread_info(p);
 	struct pt_regs *childregs = task_pt_regs(p);
@@ -261,7 +261,7 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,
 	clear_ptrace_hw_breakpoint(p);
 
 	if (clone_flags & CLONE_SETTLS)
-		thread->tp_value[0] = childregs->ARM_r3;
+		thread->tp_value[0] = tls;
 	thread->tp_value[1] = get_tpuser();
 
 	thread_notify(THREAD_NOTIFY_COPY, thread);
-- 
2.24.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-01-02 17:24 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-02 17:24 [PATCH 0/7] Fix CLONE_SETTLS with clone3 Amanieu d'Antras
2020-01-02 17:24 ` [PATCH 1/7] arm64: Move __ARCH_WANT_SYS_CLONE3 definition to uapi headers Amanieu d'Antras
2020-01-02 17:24   ` Amanieu d'Antras
2020-01-02 17:50   ` Christian Brauner
2020-01-02 17:50     ` Christian Brauner
2020-01-02 19:25     ` Arnd Bergmann
2020-01-02 19:25       ` Arnd Bergmann
2020-01-02 19:32       ` Amanieu d'Antras
2020-01-02 19:32         ` Amanieu d'Antras
2020-01-02 19:59         ` Arnd Bergmann
2020-01-02 19:59           ` Arnd Bergmann
2020-01-02 17:24 ` [PATCH 2/7] arm64: Implement copy_thread_tls Amanieu d'Antras
2020-01-02 17:24   ` Amanieu d'Antras
2020-01-02 18:01   ` Christian Brauner
2020-01-02 18:01     ` Christian Brauner
2020-01-06 17:39     ` Will Deacon
2020-01-06 17:39       ` Will Deacon
2020-01-06 18:03       ` Amanieu d'Antras
2020-01-06 18:03         ` Amanieu d'Antras
2020-01-07  9:02         ` Christian Brauner
2020-01-07  9:02           ` Christian Brauner
2020-01-07 17:45           ` Will Deacon
2020-01-07 17:45             ` Will Deacon
2020-01-07 18:12             ` Kees Cook
2020-01-07 18:12               ` Kees Cook
2020-01-07 19:30               ` Christian Brauner
2020-01-07 19:30                 ` Christian Brauner
2020-01-07 19:30             ` Christian Brauner
2020-01-07 19:30               ` Christian Brauner
2020-01-02 17:24 ` Amanieu d'Antras [this message]
2020-01-02 17:24   ` [PATCH 3/7] arm: " Amanieu d'Antras
2020-01-02 18:02   ` Christian Brauner
2020-01-02 18:02     ` Christian Brauner
2020-01-02 17:24 ` [PATCH 4/7] parisc: " Amanieu d'Antras
2020-01-02 17:24 ` [PATCH 5/7] riscv: " Amanieu d'Antras
2020-01-02 17:24   ` Amanieu d'Antras
2020-01-02 17:24 ` [PATCH 6/7] xtensa: " Amanieu d'Antras
2020-01-02 17:24 ` [PATCH 7/7] clone3: ensure copy_thread_tls is implemented Amanieu d'Antras
2020-01-02 18:09   ` Christian Brauner
2020-01-02 18:19     ` Amanieu d'Antras
2020-01-02 18:24       ` Christian Brauner
2020-01-02 18:11 ` [PATCH 0/7] Fix CLONE_SETTLS with clone3 Christian Brauner
2020-01-04 12:39 ` [PATCH] um: Implement copy_thread_tls Amanieu d'Antras
2020-01-04 12:39   ` Amanieu d'Antras
2020-01-05 15:19   ` Christian Brauner
2020-01-07 12:35     ` Christian Brauner
2020-01-07 12:35       ` Christian Brauner
2020-01-17  0:12       ` Richard Weinberger
2020-01-17  0:12         ` Richard Weinberger
2020-01-17  0:14         ` Christian Brauner
2020-01-17  0:14           ` Christian Brauner
2020-01-07 12:34 ` [PATCH 0/7] Fix CLONE_SETTLS with clone3 Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200102172413.654385-4-amanieu@gmail.com \
    --to=amanieu@gmail.com \
    --cc=christian@brauner.io \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.