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-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 0BAD41F4B4 for ; Wed, 7 Oct 2020 21:01:13 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 98F023857C49; Wed, 7 Oct 2020 21:01:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 98F023857C49 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1602104471; bh=VzW7vjV59hIEzAr7PSqXV9GbDSMw02nVkiYr71+ZJQo=; h=To:References:Subject:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=v6DuhyH2sfUcZu9HJyYl0jKfwl7PvRHdKbsa0jX20zvWTaX8f6udOQkIAiS+JU8nt XE8i8yox+cwObRh57DL5Vy0ufNhH7WDSU276s9joAzuguVx0SHIrSXsAPulMjn8Dt7 xzBlL5OSaeUZ9yP9+Jjy93XHk4QrVFiTcPrIVKTg= Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by sourceware.org (Postfix) with ESMTPS id E02D53858D35 for ; Wed, 7 Oct 2020 21:01:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E02D53858D35 Received: by mail-qv1-xf41.google.com with SMTP id cy2so2003562qvb.0 for ; Wed, 07 Oct 2020 14:01:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:references:cc:from:autocrypt:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=VzW7vjV59hIEzAr7PSqXV9GbDSMw02nVkiYr71+ZJQo=; b=ehGFrB7WtZHtCg3g2fk0MnfMEJfpxEx1dZ0RtA1wu/3wJ8gPb19DFjfaBcYv93tOG8 rDx9aejbtMwbMpmLEv7zfx76+9i3ldmxNkfLKXzXBnLVrVlUgbZJsC1Bjg5Ny/vBoVV+ jH2YHohG1k6WKtxjEhguiuV4m9BqQxam2ky3IG/O+eMM6nqxC/RZB85fcCVfXapTAXdt IhUnEpQDIXGAnZwFwrYPkXL4LGwhcOlr9yZiBC/7nqaCrWjFNlN13D4jtxViQm0S5Vp3 5c0MI6onKJdUtAUC7WfDBNC/42px/AOgaflsHMEqF2Sp8xD5rT+5SroG3p5yIVFwAIwh Lffg== X-Gm-Message-State: AOAM532lQIysyCiOGej3TbgswhjoggP+Ka6uniuaqyRNQOSFyM4d/KBQ Ac4xna/h0DDhyc6hfppoa7E/kWElJrjbig== X-Google-Smtp-Source: ABdhPJw95WtsmkhTtOY8xXmxyHkAnJoMY4JEeavM1Xx6Xjzp+zL4TBoEWV0OO49wv36yLli4Ji7jxQ== X-Received: by 2002:a0c:c709:: with SMTP id w9mr5013338qvi.26.1602104467375; Wed, 07 Oct 2020 14:01:07 -0700 (PDT) Received: from [192.168.1.4] ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id z3sm2288295qkf.92.2020.10.07.14.01.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Oct 2020 14:01:06 -0700 (PDT) To: libc-alpha@sourceware.org, Michael Clark References: <20201006054255.1676065-1-michaeljclark@mac.com> <20201006235648.1811725-1-michaeljclark@mac.com> Autocrypt: addr=adhemerval.zanella@linaro.org; prefer-encrypt=mutual; keydata= mQINBFcVGkoBEADiQU2x/cBBmAVf5C2d1xgz6zCnlCefbqaflUBw4hB/bEME40QsrVzWZ5Nq 8kxkEczZzAOKkkvv4pRVLlLn/zDtFXhlcvQRJ3yFMGqzBjofucOrmdYkOGo0uCaoJKPT186L NWp53SACXguFJpnw4ODI64ziInzXQs/rUJqrFoVIlrPDmNv/LUv1OVPKz20ETjgfpg8MNwG6 iMizMefCl+RbtXbIEZ3TE/IaDT/jcOirjv96lBKrc/pAL0h/O71Kwbbp43fimW80GhjiaN2y WGByepnkAVP7FyNarhdDpJhoDmUk9yfwNuIuESaCQtfd3vgKKuo6grcKZ8bHy7IXX1XJj2X/ BgRVhVgMHAnDPFIkXtP+SiarkUaLjGzCz7XkUn4XAGDskBNfbizFqYUQCaL2FdbW3DeZqNIa nSzKAZK7Dm9+0VVSRZXP89w71Y7JUV56xL/PlOE+YKKFdEw+gQjQi0e+DZILAtFjJLoCrkEX w4LluMhYX/X8XP6/C3xW0yOZhvHYyn72sV4yJ1uyc/qz3OY32CRy+bwPzAMAkhdwcORA3JPb kPTlimhQqVgvca8m+MQ/JFZ6D+K7QPyvEv7bQ7M+IzFmTkOCwCJ3xqOD6GjX3aphk8Sr0dq3 4Awlf5xFDAG8dn8Uuutb7naGBd/fEv6t8dfkNyzj6yvc4jpVxwARAQABtElBZGhlbWVydmFs IFphbmVsbGEgTmV0dG8gKExpbmFybyBWUE4gS2V5KSA8YWRoZW1lcnZhbC56YW5lbGxhQGxp bmFyby5vcmc+iQI3BBMBCAAhBQJXFRpKAhsDBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJ EKqx7BSnlIjv0e8P/1YOYoNkvJ+AJcNUaM5a2SA9oAKjSJ/M/EN4Id5Ow41ZJS4lUA0apSXW NjQg3VeVc2RiHab2LIB4MxdJhaWTuzfLkYnBe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1aoMPg97iUgDV5mlNef77lWE8vxmlY0FBWIXuZ yv0XYxf1WF6dRizwFFbxvUZzIJp3spAao7jLsQj1DbD2s5+S1BW09A0mI/1DjB6EhNN+4bDB SJCOv/ReK3tFJXuj/HbyDrOdoMt8aIFbe7YFLEExHpSk+HgN05Lg5TyTro8oW7TSMTk+8a5M kzaH4UGXTTBDP/g5cfL3RFPl79ubXwARAQABiQIfBBgBCAAJBQJXFRpKAhsMAAoJEKqx7BSn lIjvI/8P/jg0jl4Tbvg3B5kT6PxJOXHYu9OoyaHLcay6Cd+ZrOd1VQQCbOcgLFbf4Yr+rE9l mYsY67AUgq2QKmVVbn9pjvGsEaz8UmfDnz5epUhDxC6yRRvY4hreMXZhPZ1pbMa6A0a/WOSt AgFj5V6Z4dXGTM/lNManr0HjXxbUYv2WfbNt3/07Db9T+GZkpUotC6iknsTA4rJi6u2ls0W9 1UIvW4o01vb4nZRCj4rni0g6eWoQCGoVDk/xFfy7ZliR5B+3Z3EWRJcQskip/QAHjbLa3pml xAZ484fVxgeESOoaeC9TiBIp0NfH8akWOI0HpBCiBD5xaCTvR7ujUWMvhsX2n881r/hNlR9g fcE6q00qHSPAEgGr1bnFv74/1vbKtjeXLCcRKk3Ulw0bY1OoDxWQr86T2fZGJ/HIZuVVBf3+ gaYJF92GXFynHnea14nFFuFgOni0Mi1zDxYH/8yGGBXvo14KWd8JOW0NJPaCDFJkdS5hu0VY 7vJwKcyHJGxsCLU+Et0mryX8qZwqibJIzu7kUJQdQDljbRPDFd/xmGUFCQiQAncSilYOcxNU EMVCXPAQTteqkvA+gNqSaK1NM9tY0eQ4iJpo+aoX8HAcn4sZzt2pfUB9vQMTBJ2d4+m/qO6+ cFTAceXmIoFsN8+gFN3i8Is3u12u8xGudcBPvpoy4OoG Subject: Re: [PATCH v2] ldd: revise trace output for left-aligned relative addresses Message-ID: Date: Wed, 7 Oct 2020 18:01:04 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201006235648.1811725-1-michaeljclark@mac.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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: Adhemerval Zanella via Libc-alpha Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On 06/10/2020 20:56, Michael Clark via Libc-alpha wrote: > This change updates ld.so trace for left-aligned relative addresses. > The primary goal of this change is to increase `ldd` readability by: I am not sure if we want to extend the loader to expose debug format printing where it could be archive by extending the elf/ldd.bash.in itself to handle it. In fact, I would like to avoid such extra complexity on a core component of the program loading. > > - modifying trace output to use relative addresses by default. You can get similar information with setarch -R, which disable ASLR. > - adding an alternative trace output mode with left-aligned addresses. And you can do it with some pos-processing tool (elf/ldd.bash.in, although I give you it might be cumbersome to accomplish with sheel script). > > The relative addresses are composed by subtracting the ELF ehdr address > which makes the output constant under address space layout randomization. > This should be a safe change because the default format is preserved. > > The intention is to make `ldd` easier to cross reference with objdump. > Also, log files including `ldd` output will contain less differences as > the vdso is the only address that changes when using relative addresses. > Which information exactly are you trying to match from what you read reading the ELF information through objdump? Afaik without prelink sections, it does not give any information whether loader might place the DSO segments. > * Aligned output * > > The new trace format is enabled with `LD_TRACE_ADDR_ALIGN=1`, otherwise > the default `ldd` trace format is selected by default for compatibility. > > * Relative addresses * > > `ldd` load addresses are displayed relative to the ld.so executable header > address. Relative addresses are enabled by default, given the output mimics > systems without ASLR, thus there should be minimal compatibility issues. > There is also an option to negate addresses as an aid in interpreting them, > seeing library addresses relative to the loader with negative offsets. > > The changes adds three new ld.so flags accessible via environment variables: > > - `LD_TRACE_ADDR_ALIGN=1` - Show addresses left-aligned > - `LD_TRACE_ADDR_ABSOLUTE=1` - Show absolute addresses (backwards compat) > - `LD_TRACE_ADDR_NEGATE=1` - Show negated addresses (combination option) What I would like is in fact to move lld support *out* of the loader, where it would require to process anything more the strictly required and without commit any system resource (such as mmap). It will result in slight less complex code and attack surface. Carlos O'Donnel has stated a project to accomplish it some time ago [1], but I haven't heard yet if it has been released. Maybe it something we can work on glibc side as well. > > Changelog > > * v1 - initial version > * v2 - change address alignment variable name to LD_TRACE_ADDR_ALIGN=1 > > Signed-off-by: Michael Clark We do not use DCO, but rather Copyright assignment. And for the size of the proposed change I think we you will need proper paper sorted out (I am not sure if you already have done it). [1] https://pagure.io/eu-ldd