Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9738105imu; Wed, 5 Dec 2018 09:25:58 -0800 (PST) X-Google-Smtp-Source: AFSGD/WMrxb8pse0LhVh+8PFo2v2+NdUNE6dxcN0Q5JDrHDUK61KtjkOSvwnbII/5Ca66z3NsFvO X-Received: by 2002:a17:902:4081:: with SMTP id c1mr25191325pld.87.1544030758393; Wed, 05 Dec 2018 09:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544030758; cv=none; d=google.com; s=arc-20160816; b=AcTuVZt347nDozdAbT6/iX6TYaVgF4rYornZTWcpaaWQ3lq2eZCc+y6KfvZlWfyGZe St9zsWlAbes41v7lolxJ1dquxxYT2pG+GP2ZmwuPxd50vLxTFKVKusboLperChSGgT0W x2Y7TkIpT99CEkqCRfn/AgQzinb3+SynZ7cTNtcJMID74dwfMzVOnJO0hCQHGZy1Tg+Y RRiwdBooG1R9nQ06M3X0rS2RUVUg2u//beoPn5kAjRlUIRZuREtXS7URSffaiIhG1JF6 n0xdqn5GISi2mLWuLBY3qnfNvY3Se7zEIYP8fIyTesGlVJb7tXHwD/GQF9vFSvHlcy4u yXzg== 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=tAO7DXb3rVFPA4jINYxWvYHi+QXJ6YxyFgAnD3Q+47k=; b=LBRZXlX4/lQFG1BFhlMj0+H5IY7TVp4iLhStBufNZ10BZT3yeZHYq0SLSWZqNzxTbH c3LPVVaMgWE2U5ktSkddZqD748zsX+S9rYuUmHXRo+qMCdnDRfits0QTD9Eg8y0/C4RF ExB8bdGkOdTFwn3i44+rAgFf3US+i9PpiHXOnh+MrT1stAEsuPF+ceeRcEYM3St2UoYN 7GeFH9OZokofdvhHeArWLZpUs0KTw/wGVqxMyz6SoVq8eGllEcaL6ljFhQb4ozW2rt7f t/+5vaYQLtwlBE33ZcmO7nVUwusvKr4VjULmvLnQKMNxE2n8ODGTVQh/5sjBA7Isyvv7 slag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=a7uzzRoJ; 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 194si17526651pgg.519.2018.12.05.09.25.41; Wed, 05 Dec 2018 09:25:58 -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; dkim=pass header.i=@efficios.com header.s=default header.b=a7uzzRoJ; 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 S1728083AbeLERYn (ORCPT + 99 others); Wed, 5 Dec 2018 12:24:43 -0500 Received: from mail.efficios.com ([167.114.142.138]:34514 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727628AbeLERYm (ORCPT ); Wed, 5 Dec 2018 12:24:42 -0500 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 265509FE7D; Wed, 5 Dec 2018 12:24:41 -0500 (EST) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id e-wNZEF1XMty; Wed, 5 Dec 2018 12:24:40 -0500 (EST) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 8D25A9FE75; Wed, 5 Dec 2018 12:24:40 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 8D25A9FE75 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1544030680; bh=tAO7DXb3rVFPA4jINYxWvYHi+QXJ6YxyFgAnD3Q+47k=; h=Date:From:To:Message-ID:MIME-Version; b=a7uzzRoJe033C61VJfDOpQuFq7ns0U7TSpWG0CRJLPqE5wwD5toClSSvhHuSUFRcc VeTaGzInbUA4KPjR4vPwIDBc89wZ8h3xuMT53gefMld29Xm7sDi0nd1/IKFWwpCcrr cfEdheHy/yJlmZm4juL/f0E7J1U9xJxKpgeFL2pJ0AuTf/L/uEFvLZxHEeFhFNAJN3 uIfQ8H6kqEtQVpLOlKjDH7zwqXbmtmlN/8G9ThezRIqrF5WUL3bL0dC+W+K0lAHDg7 s90iSf3PGJRXZl0K5I1f8zZNBsENd+L9WIIhnhEEBWlqbQ7kaoGuvEYfWc7+JhU16G d++YACtJGWW+A== 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 sbMC47hApzJb; Wed, 5 Dec 2018 12:24:40 -0500 (EST) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 6DA619FE6E; Wed, 5 Dec 2018 12:24:40 -0500 (EST) Date: Wed, 5 Dec 2018 12:24:40 -0500 (EST) From: Mathieu Desnoyers To: Rich Felker Cc: Florian Weimer , carlos , Joseph Myers , Szabolcs Nagy , libc-alpha , Thomas Gleixner , Ben Maurer , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Will Deacon , Dave Watson , Paul Turner , linux-kernel , linux-api Message-ID: <210288020.19588.1544030680384.JavaMail.zimbra@efficios.com> In-Reply-To: <20181126170758.GP23599@brightrain.aerifal.cx> References: <20181121183936.8176-1-mathieu.desnoyers@efficios.com> <865273158.11687.1542995541389.JavaMail.zimbra@efficios.com> <20181123183558.GM23599@brightrain.aerifal.cx> <1758017676.12041.1543007347347.JavaMail.zimbra@efficios.com> <87bm6cqm31.fsf@oldenburg.str.redhat.com> <688718071.12798.1543247469553.JavaMail.zimbra@efficios.com> <1284855405.12857.1543249851299.JavaMail.zimbra@efficios.com> <20181126170758.GP23599@brightrain.aerifal.cx> Subject: Re: [RFC PATCH v4 1/5] 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.10_GA_3047 (ZimbraWebClient - FF52 (Linux)/8.8.10_GA_3041) Thread-Topic: glibc: Perform rseq(2) registration at nptl init and thread creation Thread-Index: 5b1Qx0E+myfJ6lch14/JRVcvr2UF6g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Nov 26, 2018, at 12:07 PM, Rich Felker dalias@libc.org wrote: > On Mon, Nov 26, 2018 at 11:30:51AM -0500, Mathieu Desnoyers wrote: >> ----- On Nov 26, 2018, at 10:51 AM, Mathieu Desnoyers >> mathieu.desnoyers@efficios.com wrote: >> >> > ----- On Nov 26, 2018, at 3:28 AM, Florian Weimer fweimer@redhat.com wrote: >> > >> >> * Mathieu Desnoyers: >> >> >> >>> Using a "weak" symbol in early adopter libraries is important, so they >> >>> can be loaded together into the same process without causing loader >> >>> errors due to many definitions of the same strong symbol. >> >> >> >> This is not how ELF dynamic linking works. If the symbol name is the >> >> same, one definition interposes the others. >> >> >> >> You need to ensure that the symbol has the same size everywhere, though. >> >> There are some tricky interactions with symbol versions, too. (The >> >> interposing libraries must not use symbol versioning.) >> > >> > I was under the impression that loading the same strong symbol into an >> > application multiple times would cause some kind of warning if non-weak. I did >> > some testing to figure out which case I remembered would cause this. >> > >> > When compiling with "-fno-common", dynamic and static linking work fine, but >> > trying to add multiple instances of a given symbol into a single object fails >> > with: >> > >> > /tmp/ccSakXZV.o:(.bss+0x0): multiple definition of `a' >> > /tmp/ccQBJBOo.o:(.bss+0x0): first defined here >> > >> > Even if the symbol has the same size. >> > >> > So considering that we don't care about compiling into a single object here, >> > and only care about static and dynamic linking of libraries, indeed the "weak" >> > symbol is not useful. >> > >> > So let's make __rseq_abi and __rseq_refcount strong symbols then ? >> >> Actually, looking into ld(1) --warn-common, it looks like "weak" would be >> cleaner >> after all, especially for __rseq_abi which we needs to be initialized to a >> specific >> value, which is therefore not a common symbol. >> >> " --warn-common >> Warn when a common symbol is combined with another common symbol or with a >> symbol definition. Unix >> linkers allow this somewhat sloppy practice, but linkers on some other operating >> systems do not. >> This option allows you to find potential problems from combining global symbols. >> Unfortunately, >> some C libraries use this practice, so you may get some warnings about symbols >> in the libraries as >> well as in your programs." >> >> Thoughts ? > > AFAIK this has nothing to do with dynamic linking. Reading through the ELF specification, it seems to imply that "weak" only affects the link editor behavior when combining relocatable objects, not the behavior of the dynamic linker. Is that what you refer to when you say "weak" has nothing to do with dynamic linking ? If that interpretation is correct, then indeed I should remove the "weak" from the __rseq_abi and __rseq_refcount. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com