From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40810 invoked by alias); 7 Mar 2018 20:25:30 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 40772 invoked by uid 89); 7 Mar 2018 20:25:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,KAM_SHORT,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=lone, doubts, Hx-languages-length:2767, Hx-spam-relays-external:209.85.161.196 X-HELO: mail-yw0-f196.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=A++LeTbLGAnJPPw0nJDfXNJ0fztol8bEMYsYUTOMtvY=; b=frjUmmbn7jeh+W4bVDH1AUju698EJ7numLNdDHAIv3VWvqzTBqY6FtlMPzprQ1SrDA pOvbK7qXypTFMRCVaU0oYd/QHRcUQ3gzMEDyiKUO4tAW0REU3SE93aancqb3L9U0bVRd M1vO8kyU6Gk4FQG4XGQWiraIJlYGcA6mNoXY0S5wqh5GcxaULKMXGL4g5pzUeyYHymxb xG+gb2HpNtG6Zju3086MQPE9VWBCBrPkWWpS/JXxpBgK4HZxl7XRWExs7L0WKsKRwvRb fUHEbY0KBKXM42aBWkveooSWjsx5eTW+co2DxKyJTM/wJ6H2G/qo4nxeGmGVijM/9H6V 8ZKQ== X-Gm-Message-State: APf1xPDyNkWzrgYCxzZvfBaiCpPhqFYHRqlg7A+2arABodO5KNy4k1Q8 cj5/WWl64FqvGh/rX2TtJ+vbs3rP+/c= X-Google-Smtp-Source: AG47ELu2gb3HCw/umSZFR9GCoUyj7LK+UwuW5Gq5/WJjUMc6kO2euPFjCUgRVM2eRbtPFLpuTypXQQ== X-Received: by 10.129.82.201 with SMTP id g192mr14716638ywb.337.1520454322640; Wed, 07 Mar 2018 12:25:22 -0800 (PST) Subject: Re: [PATCH v2 2/2] elf: Correct absolute (SHN_ABS) symbol run-time calculation [BZ #19818] To: libc-alpha@sourceware.org References: Cc: Andreas Schwab , Florian Weimer From: Adhemerval Zanella Message-ID: Date: Wed, 07 Mar 2018 20:25:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-03/txt/msg00199.txt.bz2 On 20/02/2018 15:38, Maciej W. Rozycki wrote: > Do not relocate absolute symbols by the base address. Such symbols have > SHN_ABS as the section index and their value is not supposed to be > affected by relocation as per the ELF gABI[1]: > > "SHN_ABS > The symbol has an absolute value that will not change because of > relocation." > > The reason for our non-conformance here seems to be an old SysV linker > bug causing symbols like _DYNAMIC to be incorrectly emitted as absolute > symbols[2]. However in a previous discussion it was pointed that this > is seriously flawed by preventing the lone purpose of the existence of > absolute symbols from being used[3]: > > "On the contrary, the only interpretation that makes sense to me is that > it will not change because of relocation at link time or at load time. > Absolute symbols, from the days of the earliest linking loaders, have > been used to represent addresses that are outside the address space of > the module (e.g., memory-mapped addresses or kernel gateway pages). > They've even been used to represent true symbolic constants (e.g., > system entry point numbers, sizes, version numbers). There's no other > way to represent a true absolute symbol, while the meaning you seek is > easily represented by giving the symbol a non-negative st_shndx value." > > and we ought to stop supporting our current broken interpretation. > > Update processing for dladdr(3) and dladdr1(3) so that SHN_ABS symbols > are ignored, because under the corrected interpretation they do not > represent addresses within a mapped file and therefore are not supposed > to be considered. > > References: > > [1] "System V Application Binary Interface - DRAFT - 19 October 2010", > The SCO Group, Section "Symbol Table", > > > [2] Alan Modra, "Absolute symbols" > > > [3] Cary Coutant, "Re: Absolute symbols" > > > [BZ #19818] > * sysdeps/generic/ldsodefs.h (SYMBOL_ADDRESS): Handle SHN_ABS > symbols. > * elf/dl-addr.c (determine_info): Ignore SHN_ABS symbols. > * elf/tst-absolute-sym.c: New file. > * elf/tst-absolute-sym-lib.c: New file. > * elf/tst-absolute-sym-lib.lds: New file. > * elf/Makefile (tests): Add `tst-absolute-sym'. > (modules-names): Add `tst-absolute-sym-lib'. > (LDLIBS-tst-absolute-sym-lib.so): New variable. > ($(objpfx)tst-absolute-sym-lib.so): New dependency. > ($(objpfx)tst-absolute-sym): New dependency. The patch and rationale looks reasonable, Andrea and Florian do you still have objections or doubts about the patch?