mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <christian.brauner@ubuntu.com>
To: Amanieu d'Antras <amanieu@gmail.com>
Cc: Will Deacon <will@kernel.org>, Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org,
	Christian Brauner <christian@brauner.io>,
	"# 3.4.x" <stable@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	keescook@chromium.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 2/7] arm64: Implement copy_thread_tls
Date: Tue, 7 Jan 2020 10:02:27 +0100	[thread overview]
Message-ID: <20200107090219.jl4py4u2zvofwnbh@wittgenstein> (raw)
In-Reply-To: <CA+y5pbSBYLvZ46nJP0pSYZnRohtPxHitOHPEaLXq23-QrPKk2g@mail.gmail.com>

[Cc Kees in case he knows something about where arch specific tests live
 or whether we have a framework for this]

On Mon, Jan 06, 2020 at 07:03:32PM +0100, Amanieu d'Antras wrote:
> On Mon, Jan 6, 2020 at 6:39 PM Will Deacon <will@kernel.org> wrote:
> > I also ran the native and compat selftests but, unfortunately, they all
> > pass even without this patch. Do you reckon it would be possible to update
> > them to check the tls pointer?
> 
> Here's the program I used for testing on arm64. I considered adding it
> to the selftests but there is no portable way of reading the TLS
> register on all architectures.

I'm not saying you need to do this right now.
It feels like we must've run into the "this is architecture
specific"-and-we-want-to-test-this issue before... Do we have a place
where architecture specific selftests live?

> 
> #include <sys/syscall.h>
> #include <unistd.h>
> #include <stdio.h>
> #include <stdint.h>
> 
> #define __NR_clone3 435
> struct clone_args {
>     uint64_t flags;
>     uint64_t pidfd;
>     uint64_t child_tid;
>     uint64_t parent_tid;
>     uint64_t exit_signal;
>     uint64_t stack;
>     uint64_t stack_size;
>     uint64_t tls;
> };
> 
> #define USE_CLONE3
> 
> int main() {
>     printf("Before fork: tp = %p\n", __builtin_thread_pointer());
> #ifdef USE_CLONE3
>     struct clone_args args = {
>         .flags = CLONE_SETTLS,
>         .tls = (uint64_t)__builtin_thread_pointer(),
>     };
>     int ret = syscall(__NR_clone3, &args, sizeof(args));
> #else
>     int ret = syscall(__NR_clone, CLONE_SETTLS, 0, 0,
> __builtin_thread_pointer(), 0);
> #endif
>     printf("Fork returned %d, tp = %p\n", ret, __builtin_thread_pointer());
> }

  reply	other threads:[~2020-01-07  9:02 UTC|newest]

Thread overview: 31+ 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: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 [this message]
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

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=20200107090219.jl4py4u2zvofwnbh@wittgenstein \
    --to=christian.brauner@ubuntu.com \
    --cc=amanieu@gmail.com \
    --cc=christian@brauner.io \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=will.deacon@arm.com \
    --cc=will@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®