Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5937644ybi; Wed, 12 Jun 2019 11:02:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxlSuRygitk5zqVZIGtqg+kESR9sN3waYN0K5Kgt8La+cFWbB2ZyZkV4XvBNvpK1y5Q5G/ X-Received: by 2002:a65:6543:: with SMTP id a3mr24580422pgw.300.1560362529280; Wed, 12 Jun 2019 11:02:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560362529; cv=none; d=google.com; s=arc-20160816; b=Yfi7zmWByebtvmP+7eCZHZpw44M+UL8IGTrjblUe+Kj778T2K38bW4oCo6SavBBBCY ToGlFwPrC5/I0YqaFtfUuWGNkuON6u7g+iu7SdQrAloiRVPcOpENe/3gWevE4Oi1xmTR HKqAu7HHpJg9tRJ0L/Vxuf98R3JTDC7tAaj4wtd7Wu7CyYG54qujvR0+O8EMl1bFCQCi WlaTWQmlU1WOit0MXbnQVHMHxhlKacRcjNKjuNyo+NoAloiRBtMP6d+O9WGc/wixk2Uu OKrubIdaTGWMYOszrQ32EDnOUbuueR/tNnBbFKhYcTYBb94bWwuRhTQMcN0P3xPRkuB2 Dx9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=BhfD0B5FBoUcCeRzjY78JPqJtpVzGVT8DNlFSOl6bUI=; b=idnmlU33fC1+qtwQ01u9rMg87pVrnICw+pJqN4X5TwCBwDpSKTDp1qN1H+7k+BcIdA pb4EczZFj+SwoE5hcmTnr2CICgMl4Ghw7mQufrMRKgUmuiVQcestfikwrtFIFd/UDXDK /xdhMWTVGcpftikkUgPWwe8PaxVhMlbHyrm/mmT/LilgnvnOH42KK6PDsurfYHqmj0pq Lh+Q4fFT8dl7lLHFsgXBPvgiM+sdq8PFDFYoXp1Hs3bYfP06bS8ooWmCHusIKIBYs4Ch S+jUmmoPUtMiPgGjrSsjYJsqbaIaRyluQd4EqTQr6oDl7ACijvo1lMvpZI9X9sriFzPf 6/PQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 136si395812pfz.67.2019.06.12.11.01.54; Wed, 12 Jun 2019 11:02:09 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409336AbfFLOXF (ORCPT + 99 others); Wed, 12 Jun 2019 10:23:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36884 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726533AbfFLOXF (ORCPT ); Wed, 12 Jun 2019 10:23:05 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8AA23003AEC; Wed, 12 Jun 2019 14:23:04 +0000 (UTC) Received: from oldenburg2.str.redhat.com (unknown [10.36.118.125]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77A8C5D9CA; Wed, 12 Jun 2019 14:22:57 +0000 (UTC) From: Florian Weimer To: Mathieu Desnoyers 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 Subject: Re: [PATCH 1/5] glibc: Perform rseq(2) registration at C startup and thread creation (v10) References: <20190503184219.19266-1-mathieu.desnoyers@efficios.com> <875zprm4jo.fsf@oldenburg2.str.redhat.com> <732661684.21584.1559314109886.JavaMail.zimbra@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> Date: Wed, 12 Jun 2019 16:22:55 +0200 In-Reply-To: <1329439108.43041.1560348962006.JavaMail.zimbra@efficios.com> (Mathieu Desnoyers's message of "Wed, 12 Jun 2019 10:16:02 -0400 (EDT)") Message-ID: <87blz27uio.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 12 Jun 2019 14:23:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * 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. Thanks, Florian