Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp10935ybl; Tue, 7 Jan 2020 01:04:24 -0800 (PST) X-Google-Smtp-Source: APXvYqxQTAf6DvsIS9GGhObEXRDOBDnflGh7c5Fe9gN4QzJbQEVSRKVDjuzWPH9RIJi6/PTSy/qR X-Received: by 2002:a05:6830:2099:: with SMTP id y25mr116131375otq.87.1578387864418; Tue, 07 Jan 2020 01:04:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578387864; cv=none; d=google.com; s=arc-20160816; b=x/yvCt1m0vLjuaYrkvl6iThlRO0eoqQpsLZoDRqh40HsA5WwmZGYvjMC18bJy+Bt4N B/i4w28yq69UzvSC6/AF9Nz9hC6k0nJKfqoOxS5WKncJr3AyA98tOmWO22hlO4Z5aE+/ 3Db/QpNd9Zjpj/5V40kFQ8OCPW1jDsX/dW2xRiaL+qHktZ2m2Nuxr4M05SWsfio1GLAk CqSiXsxIsJMCEjhbbFLBJlTr56rxbyW5RKXCnVDKLqHt+EAKO7Clw9VOnIcDVMi+P+Dx 28B0Kk3PY9Q1UoHnKFdAw7v8TZ4gy82dtYT7C/xf1ho1VReepj31e6akII2Ead4uF/aq Pbuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=c7QL50caYRlUaWf0X63hDCx8IdFmhewBoKEMvgKQGLU=; b=ZUBSpAvtEf1G/KN7EmZ/SKpMHl9YwzWWZIiKZp4n839/N/U9xKpOrNSNLGLBqW41CM d+oZtUL1y8kG4D4hrC0lsaiBSh7y+ubYLGJ5djvokjw08vvGPNY2NZVZbkKh/b5UknlF 2AqnLB8aS0YblmPszlhxaQNadyuFuR5fH4MSL1Frj46aOmd9G6YJR39NGHPGXb9Eb/YV W132eG7gliSN8AoOvgGPvNGb/OLiL89Vdqj73kG+OP6Gh35RrWm093i4p4AflH4B5Ujp HKXXaBhM9vOBNaAdhKXzicyEhntGq7WkMnqIAS3T+KqGwzPYYdrIEuZO8IfwxLHKQsJ4 bG1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17si19881159oix.22.2020.01.07.01.04.11; Tue, 07 Jan 2020 01:04:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727277AbgAGJCz (ORCPT + 99 others); Tue, 7 Jan 2020 04:02:55 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:46478 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbgAGJCz (ORCPT ); Tue, 7 Jan 2020 04:02:55 -0500 Received: from ip-109-41-1-227.web.vodafone.de ([109.41.1.227] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ioklG-0004Nl-2G; Tue, 07 Jan 2020 09:02:50 +0000 Date: Tue, 7 Jan 2020 10:02:27 +0100 From: Christian Brauner To: Amanieu d'Antras Cc: Will Deacon , Will Deacon , linux-kernel@vger.kernel.org, Christian Brauner , "# 3.4.x" , Linux ARM , keescook@chromium.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 2/7] arm64: Implement copy_thread_tls Message-ID: <20200107090219.jl4py4u2zvofwnbh@wittgenstein> References: <20200102172413.654385-1-amanieu@gmail.com> <20200102172413.654385-3-amanieu@gmail.com> <20200102180130.hmpipoiiu3zsl2d6@wittgenstein> <20200106173953.GB9676@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [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 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 > #include > #include > #include > > #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()); > }