From patchwork Fri Jun 23 16:26:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 780083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3wvP4P3Pxgz9sNZ for ; Sat, 24 Jun 2017 02:27:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="RaJxjc5R"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; q=dns; s=default; b=ky9G 4RYWUxskSRzxugSN9zfg70xIEmgzMDzwPUlh4hWcHF0vQ7hQ6VdK0bzxSNxSvXiH 1QrW/VxtCSKz9yGyoAu0rccKI1U2hwxx0EsbJOnmWKUI+FzzQNS9gzCaft0gTlbc ozV+w3Xv/QYQi98+KN7UzErzbh0s5bnI58xpbnM= 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:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; s=default; bh=9lmKc7WUrb dmKWBYp158NylETFc=; b=RaJxjc5Rha3ZKw5uD6SyDI1cYkdAFQu7Fid1mj+RkY YRX6PcozLwNBYnxxiIT4c645d6+mwN7PKrlzjyWP4VFL+v6quxgR7JdPl6c40xM3 glizqCpJM4+oYB3vHsG1qOtd6BrJ6mBqWlloFfS1eCT/Mn9/YcY2Atxx10Jp49q0 w= Received: (qmail 8454 invoked by alias); 23 Jun 2017 16:27:01 -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 Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 8372 invoked by uid 89); 23 Jun 2017 16:27:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-oi0-f45.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gsxuRnIawkdtYLomtGE1Xypnc1f5pzYwJXkyArxsC6s=; b=Y0mwV826XHi5DenURE8BBEEpZqKpB7RplBrqwJyOxe3FyyLYtEkk4Cwh6pP5Lx72k7 u6kd6jIIK4Rzkb0/r7Qav9hiC57r4e6SA6ElSpk+rC3fGeu7sZFcjo5NTbbI9MJTgPPm z+iXAkfSOeE7chK6vxy2daJEqnGVy1qOEELszfOrNL1GJL6Asz9wnzgfOZ1++axxJqQJ NNU5yUgrEC8fhrYnhZD8j/hHgQ54vBqssagHOTS0OosMdJaf2LI0XjGgVU9/E36UyUaW 8L1gH8nkm5A/F0VzNtVkZvWnVqDON1/BktQDywyFj3j/PPDQJgsy1lSWhaXB5BJ7EKk4 fKQA== X-Gm-Message-State: AKS2vOygm8jQkg/IQIkRpC0ZNrEmiD1cw0R/ZtoXKgedX5f/vLpVDxje d1PztttXUhiLD5m7vA78mGEFxo8UpQ== X-Received: by 10.202.63.133 with SMTP id m127mr4424568oia.55.1498235217217; Fri, 23 Jun 2017 09:26:57 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <20170623161158.GA5384@gmail.com> From: "H.J. Lu" Date: Fri, 23 Jun 2017 09:26:56 -0700 Message-ID: Subject: Re: [PATCH] Avoid .symver on common symbols [BZ #21666] To: Florian Weimer Cc: GNU C Library On Fri, Jun 23, 2017 at 9:17 AM, Florian Weimer wrote: > On 06/23/2017 06:11 PM, H.J. Lu wrote: >> +/* Define the variables used for the interface. Avoid .symver on common >> + symbol, which just creates a new common symbol, not an alias. */ >> +char *loc1 = NULL; >> +char *loc2 = NULL; > > I think __attribute__ ((nocommon)) without the initializer would be more > explicit. We already use that for _res in resolv/res_libc.c. Done. > Does this result in a visible difference for applications? If yes, > please file a bug for this and reference it in the ChangeLog and commit > message. It will be very hard to tell since these symbols were exported from libc.so by accident and we only keep them in libc.so for backward binary compatibility. Application can no longer reference them from libc.so. > Why didn't our test suite catch it? We never tried to catch errors like this. Here is the updated patch. OK for master? Thanks. From 67145d84d9719d270f63f4399e337a4bdcb778f5 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 23 Jun 2017 09:03:19 -0700 Subject: [PATCH] Avoid .symver on common symbols [BZ #21666] The .symver directive on common symbol just creates a new common symbol, not an alias and the newer assembler with the bug fix for https://sourceware.org/bugzilla/show_bug.cgi?id=21661 will issue an error. Before the fix, we got $ readelf -sW libc.so | grep "loc[12s]" 5109: 00000000003a0608 8 OBJECT LOCAL DEFAULT 36 loc1 5188: 00000000003a0610 8 OBJECT LOCAL DEFAULT 36 loc2 5455: 00000000003a0618 8 OBJECT LOCAL DEFAULT 36 locs 6575: 00000000003a05f0 8 OBJECT GLOBAL DEFAULT 36 locs@GLIBC_2.2.5 7156: 00000000003a05f8 8 OBJECT GLOBAL DEFAULT 36 loc1@GLIBC_2.2.5 7312: 00000000003a0600 8 OBJECT GLOBAL DEFAULT 36 loc2@GLIBC_2.2.5 in libc.so. The versioned loc1, loc2 and locs have the wrong addresses. After the fix, we got $ readelf -sW libc.so | grep "loc[12s]" 6570: 000000000039e3b8 8 OBJECT GLOBAL DEFAULT 34 locs@GLIBC_2.2.5 7151: 000000000039e3c8 8 OBJECT GLOBAL DEFAULT 34 loc1@GLIBC_2.2.5 7307: 000000000039e3c0 8 OBJECT GLOBAL DEFAULT 34 loc2@GLIBC_2.2.5 [BZ #21666] * misc/regexp.c (loc1): Add __attribute__ ((nocommon)); (loc2): Likewise. (locs): Likewise. --- misc/regexp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/misc/regexp.c b/misc/regexp.c index 19d76c0..eaea7c3 100644 --- a/misc/regexp.c +++ b/misc/regexp.c @@ -29,14 +29,15 @@ #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23) -/* Define the variables used for the interface. */ -char *loc1; -char *loc2; +/* Define the variables used for the interface. Avoid .symver on common + symbol, which just creates a new common symbol, not an alias. */ +char *loc1 __attribute__ ((nocommon)); +char *loc2 __attribute__ ((nocommon)); compat_symbol (libc, loc1, loc1, GLIBC_2_0); compat_symbol (libc, loc2, loc2, GLIBC_2_0); /* Although we do not support the use we define this variable as well. */ -char *locs; +char *locs __attribute__ ((nocommon)); compat_symbol (libc, locs, locs, GLIBC_2_0); -- 2.9.4