Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4130imm; Thu, 20 Sep 2018 13:05:21 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda93zBshSaaVoLz7rWWH53XUVbX9bd9IvDn+I3NMFRkCwY6jomMLiRl4dTdUNgZQPYeQ82q X-Received: by 2002:a17:902:968d:: with SMTP id n13-v6mr8545013plp.33.1537473921599; Thu, 20 Sep 2018 13:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537473921; cv=none; d=google.com; s=arc-20160816; b=ZcRa5JH2K+hQJC+m984Qtvw6FT7/+mAz83TldqAp3JZPrEWj0fJR0OG21XVFfmFn/r zLAAp6BR3+Oofju+uKV5TGACrEfmgtJ6XxaiGjcxGqbI+rrCg4f7C+oJ8E1Nv5adFAdL NY1yr8VC94gy2ADp6i+iCQZbkDgTiJVYt0+ADKWxB0eEBNaqPLZM+3wVKShNsDKCVagf qSdT2yrcHRVYNF9pxcSbHbEYFxv1i29HJRlrZNQOVluBSiobSLLnyxGXz2oJp0aaaGKQ sRrzX9cDiBrFv1u1B14kcqdgtPiSkaEva4c3aD9s51M3QMfafCvxHBFKXoOSVc3WRPdz TY1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=FKDbtBMGdRMQP1pI9M4peWUO1d5nRjqSunZvZ14ozLQ=; b=du5QX3OoZIs4W7qtbD5457UvWWrkggXXkG+KVnDFqvPvYvKrZ4oqlBXeh45PvhTD60 4vVXIDaEM052yBLJM7PUAaQk9miMnAIFCkahQj5GPhMF967gdMOhDIofYDgjbP87dI5z OzGjbkx+hNODNSdozqbd8KuRlztfTmQCKORXOm/VILrq4EBTUN4TI4Gy9S14SHv7UU4C 2d1qgVF03MNYBXXTdoua9R6RKwvuSE+1oQsIf5SmcmQEqjIKvMLMbCnZoxbeJI8lbAN8 bEH457RTMgJFAPATSrkfYte9+9DLMCRfWcS4NMBIC1233PT7E65HRgwaGftb9HL2FoU8 fD3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=jWzqXWo1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5-v6si24614363pgi.211.2018.09.20.13.05.05; Thu, 20 Sep 2018 13:05:21 -0700 (PDT) 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; dkim=pass header.i=@efficios.com header.s=default header.b=jWzqXWo1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388553AbeIUBtj (ORCPT + 99 others); Thu, 20 Sep 2018 21:49:39 -0400 Received: from mail.efficios.com ([167.114.142.138]:53992 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388176AbeIUBtj (ORCPT ); Thu, 20 Sep 2018 21:49:39 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 174D7240AFB; Thu, 20 Sep 2018 16:04:28 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id Jd6WDegwnGXP; Thu, 20 Sep 2018 16:04:27 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 2283B240AF7; Thu, 20 Sep 2018 16:04:27 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 2283B240AF7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1537473867; bh=FKDbtBMGdRMQP1pI9M4peWUO1d5nRjqSunZvZ14ozLQ=; h=Date:From:To:Message-ID:MIME-Version; b=jWzqXWo1JAAr6PUqf6mWYE3jnzfJ0BBVVGRL5S4u9iGtSB0NMpW2KnmZGA1ocDqYp jjfgetrYf1YPVMKuyyCO2NB7mp49jMo1sP0dvhIIXcZziLGj9xhMRx0g/n2NClKqvk fGDf7DO36eT880iksvLpaHa07wbm/Gk5LW3biszinZN51V0GOn1dqCjikz5qtPlmsC qmir8xzDSXJB/GWKZyoFFD7GSra3XX37eIoVibVI6uHyT4zVjeMmm0OBEe8attXpXl Y6ajiMC5I1EJXN/3KxLiM/lYKt4kUgkrKtMxAtXMb2bz3cjluf6+uyAAgXWr6CJtmi B9p4jF5QyidcA== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id tfReVVDItLcw; Thu, 20 Sep 2018 16:04:27 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 0882D240AF0; Thu, 20 Sep 2018 16:04:27 -0400 (EDT) Date: Thu, 20 Sep 2018 16:04:26 -0400 (EDT) From: Mathieu Desnoyers To: Joseph Myers Cc: carlos , Florian Weimer , Thomas Gleixner , Ben Maurer , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Will Deacon , Dave Watson , Paul Turner , libc-alpha , linux-kernel , linux-api Message-ID: <381061785.8994.1537473866841.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20180919144438.1066-1-mathieu.desnoyers@efficios.com> Subject: Re: [RFC PATCH] glibc: Perform rseq(2) registration at nptl init and thread creation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.138] X-Mailer: Zimbra 8.8.9_GA_3019 (ZimbraWebClient - FF52 (Linux)/8.8.9_GA_3019) Thread-Topic: glibc: Perform rseq(2) registration at nptl init and thread creation Thread-Index: psWJMi4/wKh/74j4G/pR5+hFK1ZtpQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Sep 19, 2018, at 12:37 PM, Joseph Myers joseph@codesourcery.com wrote: > On Wed, 19 Sep 2018, Mathieu Desnoyers wrote: > >> Here is a rough prototype registering rseq(2) TLS for each thread >> (including main), and unregistering for each thread (excluding >> main). "rseq" stands for Restartable Sequences. > > A final patch would need to add documentation and tests and a NEWS entry > and fix various coding style issues. Sure, > >> diff --git a/nptl/Versions b/nptl/Versions >> index e7f691da7a..7316c2815d 100644 >> --- a/nptl/Versions >> +++ b/nptl/Versions >> @@ -275,6 +275,7 @@ libpthread { >> mtx_init; mtx_lock; mtx_timedlock; mtx_trylock; mtx_unlock; mtx_destroy; >> call_once; cnd_broadcast; cnd_destroy; cnd_init; cnd_signal; >> cnd_timedwait; cnd_wait; tss_create; tss_delete; tss_get; tss_set; >> + __rseq_abi; __rseq_refcount; > > That's the GLIBC_2.28 section, but 2.28 is already out. New symbols would > need to go in GLIBC_2.29 or later (and the ABI test baselines would all > need updating). OK > >> diff --git a/sysdeps/unix/sysv/linux/rseq.h b/sysdeps/unix/sysv/linux/rseq.h > > This looks like it's coming from the Linux kernel. Can't the relevant > uapi header just be used directly without copying into glibc (with due > care to ensure that glibc still builds if the kernel headers used for the > build are too old - you need such conditionals anyway if they don't define > the relevant syscall number)? Something like this in pthreadP.h ? +#ifdef __NR_rseq +#include +#else +#include +#endif /* __NR_rseq. */ where sysdeps/unix/sysv/linux/rseq-internal.h contains the linux implementation of rseq_register_current_thread () and rseq_unregister_current_thread (), and sysdeps/nptl/rseq-internal.h contains stubs. Am I on the right track ? Thanks, Mathieu > > -- > Joseph S. Myers > joseph@codesourcery.com -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com