From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 6F69E1F462 for ; Wed, 12 Jun 2019 14:36:10 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:message-id:in-reply-to :references:subject:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=WKEaJSYrmoEzsJJP JXJ0QrYB4m1GIXQ6UXx6aajmPkdXKCVz3TfJaeOHV4pf8b0M6Z1VTAQjaQwjXvmQ QmEYEpBPpdWAYNTVrpUHZWCRugLEu9+qITBgdi2zmkOksD9kISK1elKMLCq44X81 sK1+hABz50bFSd0VHvVhu6BKv44= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:message-id:in-reply-to :references:subject:mime-version:content-type :content-transfer-encoding; s=default; bh=qWH6fdA3t1Bf/kGwldZYKn SSenA=; b=uQuoyj08O3NHlVBhxROxoFZA+lRhfEp7EgotRaPwAfbNj7ZnED2zkw 4zI1OZB5O9xT9cJkGpRrQ6s37hsNnZ26NU+rEjh/zui4GmxU3Y097mzzMeGTyJoE FN77D6Hm+9b7dkw1nSNNVQB7/OscReN8vQrLbhlXNukVc3Uxs24zA= Received: (qmail 29867 invoked by alias); 12 Jun 2019 14:36:07 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 29859 invoked by uid 89); 12 Jun 2019 14:36:07 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail.efficios.com DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 5599B24942E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1560350163; bh=CQJvFqLWHjpXxyGISC4bp4dzIRicyxqlzHNr21zpE6c=; h=Date:From:To:Message-ID:MIME-Version; b=q33EV28kaNy1/vmwbhSQwXx5/2HYtlLIrgzGsf17zDqgBPwm+IgEW5rqsJWmfAWI9 nFa53eojvq5rojoCsVg3pdaYCesQAEsSSWolBHdDaR40KlaoSPOtR7PojlDH0uHiMW fwn5MfPk/sIQysQe0J2I2FPqVXOlVzIBVmiOpOCLlcJN130xde0kaPlT8SuNY83tSO 5Iipld3BzRO5V/FA/lnKTC6o5hsWI0lJ7iaddqf1GaYnprFBYANpExfZnQ7Pw9iIMO /tWdrX2lJVRXxstD27aqInD6EO7tHO7rfLeAsLe5cjb9/mfQnxCZGGKojz4TxOvGoD 4jRHQSEjds9wA== Date: Wed, 12 Jun 2019 10:36:03 -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: <512441263.43096.1560350163180.JavaMail.zimbra@efficios.com> In-Reply-To: <87blz27uio.fsf@oldenburg2.str.redhat.com> References: <20190503184219.19266-1-mathieu.desnoyers@efficios.com> <87muj2k4ov.fsf@oldenburg2.str.redhat.com> <1528929896.22217.1559326257155.JavaMail.zimbra@efficios.com> <87o93d4lqb.fsf@oldenburg2.str.redhat.com> <117220011.27079.1559663870037.JavaMail.zimbra@efficios.com> <87wohzorj0.fsf@oldenburg2.str.redhat.com> <1329439108.43041.1560348962006.JavaMail.zimbra@efficios.com> <87blz27uio.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 ----- On Jun 12, 2019, at 4:22 PM, Florian Weimer fweimer@redhat.com wrote: > * Mathieu Desnoyers: > >>> It's the registration from libc.so which needs some care. In >>> particular, we must not override an existing registration. >> >> OK, so it could check if __rseq_abi.cpu_id is -1, and only >> perform registration if it is the case. Or do you have another >> approach in mind ? > > No, __rseq_abi will not be shared with the outer libc, so the inner libc > will always see -1 there, even if the outer libc has performed > registration. > > libio/vtables.c has some example what you can do: > > /* In case this libc copy is in a non-default namespace, we always > need to accept foreign vtables because there is always a > possibility that FILE * objects are passed across the linking > boundary. */ > { > Dl_info di; > struct link_map *l; > if (!rtld_active () > || (_dl_addr (_IO_vtable_check, &di, &l, NULL) != 0 > && l->l_ns != LM_ID_BASE)) > return; > } > > _IO_vtable_check would have to be replaced with your own function; the > actual function doesn't really matter. > > The rtld_active check covers the static dlopen case, where > rtld_active () is false in the inner libc. Then out of curiosity, would it also work if I check for if (!__libc_multiple_libcs) in LIBC_START_MAIN ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com