From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by sourceware.org (Postfix) with ESMTPS id 14F413858C1F for ; Mon, 31 Jan 2022 20:10:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 14F413858C1F Received: by mail-yb1-xb32.google.com with SMTP id r65so43978941ybc.11 for ; Mon, 31 Jan 2022 12:10:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=5OKstTsBpEJopkT9V49U0dDZqblC+flj2crLGCSYTzU=; b=Jawbdsvl+dgF9vrxxa2jwGrvvba+af1kGJAkqN0qacgcPCNJydzrrbmyZ7ftxCW4KN TZXmHBGfuyF6JKwEkU9Z5tmDOFiUDiCZFmoUYBQ/op+I3BTRiSxaWZbhVfLv4FrBWdIg njCrerXchewre7DyKDsNXAQij4StlaczzMvJKzCzbjFxRdCeCs4P+CIGvKuvbk6TdmZo vtCHpt3p35z0ZYN+LGcKMyOqW/pjq+dr9WTAOWNCDk4ozlUhFxTVKf+Q8PXmF+gBGP6G 2jGE3P3TfhQJDlQ9N2klfG7P7ESGnbUFg8jeFCeVKGq3sL7bSt6qZkQT28nuXzQcZl7y iYOg== X-Gm-Message-State: AOAM531qVrkOYMUyXaQxwoikcEWqb9OqEOFFZdmkhrezdvP+OMZso38o XjXaPaYLzmFQbnioEW/WejMw4OiYhMidyBHNvv3UVKXmlOCBAw== X-Google-Smtp-Source: ABdhPJyh8EtIjiPoMRR/g5FAXGu7CKj5+cEeonDQ0CIQY5JrVeZMD9orSJ+IxBapa9Ei0MmAjdVav5+m8CsyRkEpsZw= X-Received: by 2002:a5b:44:: with SMTP id e4mr32846123ybp.713.1643659821094; Mon, 31 Jan 2022 12:10:21 -0800 (PST) MIME-Version: 1.0 From: Farid Zakaria Date: Mon, 31 Jan 2022 12:10:10 -0800 Message-ID: Subject: How can I wrap ld-linux or execve into it? To: libc-help@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jan 2022 20:10:23 -0000 Hi, I am looking to perform some functionality before the dynamic linker (linux-ld/ld.so) is invoked. My naive assessment was that I would be able to set in the PT_INTERP section of a binary, my *static binary*, which will then execve into the dynamic linker after doing some precanned actions. Unfortunately, trying this has resulted in some SIGSEGV... I came across https://github.com/Mic92/nix-ld which seems to do something similar, but I was curious why it has to do a lot more to achieve the same effect with a jump. I have also been pointed to LD_AUDIT however I am also interested in having it agnostic to libc (glibc vs. musl) Thank you for any tips, guidance or links you can provide. FZ