linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] Fix CLONE_SETTLS with clone3
@ 2020-01-02 17:24 Amanieu d'Antras
  2020-01-02 17:24 ` [PATCH 1/7] arm64: Move __ARCH_WANT_SYS_CLONE3 definition to uapi headers Amanieu d'Antras
                   ` (9 more replies)
  0 siblings, 10 replies; 31+ messages in thread
From: Amanieu d'Antras @ 2020-01-02 17:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Christian Brauner, stable, Amanieu d'Antras

The clone3 syscall is currently broken when used with CLONE_SETTLS on all
architectures that don't have an implementation of copy_thread_tls. The old
copy_thread function handles CLONE_SETTLS by reading the new TLS value from
pt_regs containing the clone syscall parameters. Since clone3 passes the TLS
value in clone_args, this results in the TLS register being initialized to a
garbage value.

This patch series implements copy_thread_tls on all architectures that currently
define __ARCH_WANT_SYS_CLONE3 and adds a compile-time check to ensure that any
architecture that enables clone3 in the future also implements copy_thread_tls.

I have also included a minor fix for the arm64 uapi headers which caused
__NR_clone3 to be missing from the exported user headers.

I have only tested this on arm64, but the copy_thread_tls implementations for
the various architectures are fairly straightforward.

Amanieu d'Antras (7):
  arm64: Move __ARCH_WANT_SYS_CLONE3 definition to uapi headers
  arm64: Implement copy_thread_tls
  arm: Implement copy_thread_tls
  parisc: Implement copy_thread_tls
  riscv: Implement copy_thread_tls
  xtensa: Implement copy_thread_tls
  clone3: ensure copy_thread_tls is implemented

 arch/arm/Kconfig                     |  1 +
 arch/arm/kernel/process.c            |  6 +++---
 arch/arm64/Kconfig                   |  1 +
 arch/arm64/include/asm/unistd.h      |  1 -
 arch/arm64/include/uapi/asm/unistd.h |  1 +
 arch/arm64/kernel/process.c          | 10 +++++-----
 arch/parisc/Kconfig                  |  1 +
 arch/parisc/kernel/process.c         |  8 ++++----
 arch/riscv/Kconfig                   |  1 +
 arch/riscv/kernel/process.c          |  6 +++---
 arch/xtensa/Kconfig                  |  1 +
 arch/xtensa/kernel/process.c         |  8 ++++----
 kernel/fork.c                        | 10 ++++++++++
 13 files changed, 35 insertions(+), 20 deletions(-)

-- 
2.24.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2020-01-17  0:14 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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:50   ` Christian Brauner
2020-01-02 19:25     ` Arnd Bergmann
2020-01-02 19:32       ` Amanieu d'Antras
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 18:01   ` Christian Brauner
2020-01-06 17:39     ` Will Deacon
2020-01-06 18:03       ` Amanieu d'Antras
2020-01-07  9:02         ` Christian Brauner
2020-01-07 17:45           ` Will Deacon
2020-01-07 18:12             ` Kees Cook
2020-01-07 19:30               ` Christian Brauner
2020-01-07 19:30             ` Christian Brauner
2020-01-02 17:24 ` [PATCH 3/7] arm: " Amanieu d'Antras
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 ` [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-05 15:19   ` Christian Brauner
2020-01-07 12:35     ` Christian Brauner
2020-01-17  0:12       ` Richard Weinberger
2020-01-17  0:14         ` Christian Brauner
2020-01-07 12:34 ` [PATCH 0/7] Fix CLONE_SETTLS with clone3 Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).