From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 17453 invoked from network); 22 Apr 2020 23:25:47 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with UTF8ESMTPZ; 22 Apr 2020 23:25:47 -0000 Received: (qmail 30406 invoked by uid 550); 22 Apr 2020 23:25:45 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 30373 invoked from network); 22 Apr 2020 23:25:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version :content-transfer-encoding; bh=U1mv0FNc4E6BZJG7lBn/Tke71OohftwNsUYYUtrIYLQ=; b=PeSkixfTdHu6tIC+Qkoh25HrbhECum5/WLqaVBPlNllhiNB5F16lBB99GnffWrELD9 QcMJflwghJJF3LH1BCjNnv5M76yfDHrqA3Pz5kyd0bGCaqBhPth3aZqc5DechcAfcKjA N3j4xYFjrLHotkQzhfi/BuU99WSVlnP6cHXG0jhyLPnEspO9cT41RT9jCJXxVoH0IK+L IJlZxFMpK8ZHlHbNV/oNJtShb539MVlSSjr4Mh8UN2QqeXWIZZKghho9nJNcCWEv96ss QHgCWZudo1ylQC6Ek6L2XmRl2ShrLYVxBMpZ5BMuU/BgKl7RgKnttFkzKYiR6mHc/VWR eaGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-transfer-encoding; bh=U1mv0FNc4E6BZJG7lBn/Tke71OohftwNsUYYUtrIYLQ=; b=I4ybrLFBKIfT5xutn8RIhBn2b+Q2TvcowzA3wlMGqThULhNb/CCEd1mH6rhpD5h6MR RPECUtdafNu+nw7JMNqRM+ied45ixBWTPM502qjhjhiA/KL0UD/gNHzaOUuIC1T+t3nl ZX8RIgf3YbujHKxbd6JZrM1XXC93krYEQgkAcA//fqCIIBN+9YQgh9PWbU0+LGRIhnvY my7eFBi0qqxECTkEAEJrWjXhoG1f569b0nzUNEisoVE5qT4zOwSLwkXqFajaMXdJU28S CivAvAZhqIHP2WGEsIjK9+mo4SPzWeKGKI/InJ6p1kJEm3lkuV8X/QxGIP8OZ9gi4Lo5 HceQ== X-Gm-Message-State: AGi0Pua5GD8T1ACSdT68RvnHxEDANBV+l4N6gDMpdL685yiTIT+XKPCX VLErvC3q1/PvkyqrUtwaLqcnK5jB X-Google-Smtp-Source: APiQypLbmrJ8DwxtEanRo13q/N9jZikWpsWSSLWZ8QU8+l0c0/+v128Ca1IgQrdDv9kvUUr3pYK+sw== X-Received: by 2002:a05:6512:3f4:: with SMTP id n20mr591132lfq.100.1587597933598; Wed, 22 Apr 2020 16:25:33 -0700 (PDT) Date: Thu, 23 Apr 2020 02:25:31 +0300 From: Paul Sokolovsky To: musl@lists.openwall.com Message-ID: <20200423022531.502e9d26@zenbook> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [musl] foreign-dlopen: dlopen() from static binary, again (and not the way you think!) Hello, Just as many (well, few) people I was surprised by the inability to dlopen() from a static binary (https://www.openwall.com/lists/musl/2012/12/08/4 , etc.). I started to hack into musl's dynamic linker, just to find it a bit ... tangled. That of course was nothing compared to taking a standalone ELF loader and trying to deal with glibc's dynamic loader, that was total mess (just look at https://github.com/robgjansen/elf-loader, which tried to do that; tried, because it doesn't work with recent glibc versions, and need constant patching). Oh, forgot to say that I'm not looking for a way to load a particular musl-dynlinked shared library into musl-staticlinked binary. So, arguments like "but you'll need to carry around musl's libc.so" don't apply. What I'm looking for is a way to have a static closed-world application, but let it, at the user's request, to interface with whatever system may be outside. So, seeing what a mess is doing "honest" dynamic loading for real world, and given my usecase, which is about wanting to touch that mess as little as possible with bare hands, I came to a cute blackbox'ish solution to an issue. The rest of the story and proof of concept code is at https://github.com/pfalcon/foreign-dlopen . (Sorry for somewhat tangled message, I made that proof of concept a month ago and it was justing sitting in my github account, so posting mostly for search engines' use, to help people who may come up to similar needs, whenever that may happen.) -- Best regards, Paul mailto:pmiscml@gmail.com