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: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, 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 (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id C2B351F8C6 for ; Thu, 12 Aug 2021 10:40:07 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C03FF3833001 for ; Thu, 12 Aug 2021 10:40:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C03FF3833001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628764805; bh=7mNhlG3TO3ww/ymTSoFVLe84H8IuBN9F7x0RQIv+Dvk=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=YMuRt8lVE6kiZy2gOnv9BGarFbaXxqspQo3AVrFmeaEdn9MG2ASiIxGJdzeC4hVId QFWZ21mPYJkYW/0fqAOLxwnwS5Q5mToolvdLW9guUwDkjaV3j9cLdMgwdqX4WMsU9a EMVzB147g71e/85jcY4lrK9NnX6x0f9X3KtGGEHI= Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by sourceware.org (Postfix) with ESMTPS id 790DF3853C1A; Thu, 12 Aug 2021 10:39:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 790DF3853C1A To: Siddhesh Poyarekar , libc-alpha@sourceware.org Subject: Re: [PATCH v3] mtrace: Fix output with PIE and ASLR [BZ #22716] In-Reply-To: <20210812090746.612090-1-siddhesh@sourceware.org> References: <20210812090746.612090-1-siddhesh@sourceware.org> Date: Thu, 12 Aug 2021 12:45:34 +0206 Message-ID: <874kbv9cbd.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: John Ogness via Libc-alpha Reply-To: John Ogness Cc: schwab@linux-m68k.org Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 2021-08-12, Siddhesh Poyarekar wrote: > Record only the relative address of the caller in mtrace file. Use > LD_TRACE_PRELINKING to get the executable as well as binary vs > executable load offsets so that we may compute a base to add to the > relative address in the mtrace file. This allows us to get a valid > address to pass to addr2line in all cases. FWIW, I tested this using an executable with a memory leak that is linked to a shared library that also has a leak. Executable 1 compiled with "-pie -fPIE". Executable 2 compiled with "-no-pie -fno-PIE". Shared library compiled with "-fPIC". Tested both executables in ASLR and non-ASLR environments successfully. The only issue is that obviously trace files from older glibc will not work with this new mtrace and vice versa. But I suppose that is not a concern. John Ogness