From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23DDFC31E4B for ; Fri, 14 Jun 2019 13:59:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EC4FA21537 for ; Fri, 14 Jun 2019 13:59:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="ExDF2YU3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728726AbfFNN7G (ORCPT ); Fri, 14 Jun 2019 09:59:06 -0400 Received: from mail.efficios.com ([167.114.142.138]:48010 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728300AbfFNN7G (ORCPT ); Fri, 14 Jun 2019 09:59:06 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id ADE6D251CCD; Fri, 14 Jun 2019 09:59:04 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id rJOHjntNcuT9; Fri, 14 Jun 2019 09:59:04 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 4EA47251CC8; Fri, 14 Jun 2019 09:59:04 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 4EA47251CC8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1560520744; bh=jpmp9DG8eHAyLVISapjfq/tN+v/idvmpwbfusJBMqP4=; h=Date:From:To:Message-ID:MIME-Version; b=ExDF2YU3NUQJA2JcFDQjaJL1g9CCnkPixcgar3BbM9emiOPEPyaUyLowwGJ9pBilS oKpc3GQ4S3kA3Avor0qnfp+nck1hSotR9n11BoNA0nmQDITQW53BtfhVrKZaIRDD8h kkwSz7zkEbhkR3CsBO6PJjWn/AXU1abrrjlolvpcHEEQonPzjSqqc6yHs8xXp4BUue gusO4b/erzcWJ06zLebUyvki5ZHoP+hMlse0PAfCDlaNLNBNJiPWCEGRPnvt6CcEZl rPT2RISu2jlS/WujZUTwxT4/S+PWcCe9nt5o06JnF9zGmUGXPukd2sJoE1B6i5dPVo YU/SE4Aj3kaWA== 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 Mv1VjGbPs8-l; Fri, 14 Jun 2019 09:59:04 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 32072251CBE; Fri, 14 Jun 2019 09:59:04 -0400 (EDT) Date: Fri, 14 Jun 2019 09:59:04 -0400 (EDT) From: Mathieu Desnoyers To: Florian Weimer Cc: carlos , Joseph Myers , Szabolcs Nagy , libc-alpha , Thomas Gleixner , Ben Maurer , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Will Deacon , Dave Watson , Paul Turner , Rich Felker , linux-kernel , linux-api Message-ID: <634912958.3582.1560520744040.JavaMail.zimbra@efficios.com> In-Reply-To: <87ef3wtgs4.fsf@oldenburg2.str.redhat.com> References: <20190503184219.19266-1-mathieu.desnoyers@efficios.com> <87d0jguxdk.fsf@oldenburg2.str.redhat.com> <1779359826.3226.1560518318701.JavaMail.zimbra@efficios.com> <87wohoti47.fsf@oldenburg2.str.redhat.com> <189377747.3315.1560519247118.JavaMail.zimbra@efficios.com> <87imt8tha5.fsf@oldenburg2.str.redhat.com> <26171199.3391.1560520033825.JavaMail.zimbra@efficios.com> <87ef3wtgs4.fsf@oldenburg2.str.redhat.com> Subject: Re: [PATCH 1/5] glibc: Perform rseq(2) registration at C startup and thread creation (v10) 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.12_GA_3803 (ZimbraWebClient - FF67 (Linux)/8.8.12_GA_3794) Thread-Topic: glibc: Perform rseq(2) registration at C startup and thread creation (v10) Thread-Index: bTcDxImi7N70vGPu1EOcYFTLIBF+3A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Jun 14, 2019, at 3:53 PM, Florian Weimer fweimer@redhat.com wrote: > * Mathieu Desnoyers: > >> ----- On Jun 14, 2019, at 3:42 PM, Florian Weimer fweimer@redhat.com wrote: >> >>> * Mathieu Desnoyers: >>> >>>> + /* Publicize rseq registration ownership. This must be performed >>>> + after rtld re-relocation, before invoking constructors of >>>> + preloaded libraries. */ >>>> + rseq_init (); >>> >>> Please add a comment that IFUNC resolvers do not see the initialized >>> value. I think this is okay because we currently do not support access >>> to extern variables in IFUNC resolvers. >> >> Do IFUNC resolvers happen to observe the __rseq_handled address that >> was internal to ld.so ? > > They should observe the correct address, but they can access the > variable before initialization. An initializer in ld.so will not have > an effect if an interposed definition initalized the variable to > something else. > >> If so, we could simply initialize __rseq_handled twice: early before calling >> IFUNC resolvers, and after ld.so re-relocation. > > No, I don't think this will make a difference. So comment it is: /* Publicize rseq registration ownership. This must be performed after rtld re-relocation, before invoking constructors of preloaded libraries. IFUNC resolvers are called before this initialization, so they may not observe the initialized state. */ rseq_init (); Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com