From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122835 invoked by alias); 10 Jun 2019 13:08:00 -0000 Mailing-List: contact libc-help-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: libc-help-owner@sourceware.org Received: (qmail 122825 invoked by uid 89); 10 Jun 2019 13:08:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=who's, whos, claim, HContent-Transfer-Encoding:8bit X-HELO: muller.mulle-kybernetik.com Received: from muller.mulle-kybernetik.com (HELO muller.mulle-kybernetik.com) (78.46.34.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Jun 2019 13:07:58 +0000 Received: (qmail 90691 invoked from network); 10 Jun 2019 15:07:56 +0200 Received: from unknown (HELO ?192.168.2.34?) (nat@78.46.34.175) by mail.mulle-kybernetik.com with ESMTPS (ECDHE-RSA-AES128-SHA encrypted); 10 Jun 2019 15:07:56 +0200 Subject: Re: Problem with atexit and _dl_fini To: libc-help@sourceware.org References: <87blzypg5j.fsf@mid.deneb.enyo.de> <0a7c2435-43f8-8dfb-83ab-22ceff7ca51c@mulle-kybernetik.com> From: Nat! Cc: Adhemerval Zanella Message-ID: <9497a5c2-0dc8-18fe-6120-deb551f7ddd8@mulle-kybernetik.com> Date: Mon, 10 Jun 2019 13:08:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2019-06/txt/msg00007.txt.bz2 On 10.06.19 13:48, Adhemerval Zanella wrote: > > On 09/06/2019 17:59, Nat! wrote: >> Another datapoint to support my claim that _dl-fini breaks atexit. This time its very easy to reproduce ;) >> >> Here 's the README.md from the Github Repo https://github.com/mulle-nat/atexit-breakage-linux >> >> >> ``` >> >> # Shows another breakage involving `atexit` on linux >> >> Here the `atexit` callback is invoked mistakenly multiple times. > This 'example' does not really show the issue because ldd script issues > the loader multiple times, see below. You can check exactly what ldd is > doing by calling with sh -x. I agree it doesn't show the same issue, but it shows that something else is going very wrong. :) Or are you happy, that atexit is called multiple times ? Who's calling exit here anyway ? Check out the debugger output too (see updated README.md) > > I will try to use your instruction to run on docker to see what exactly > is happening in your environment. That's not necessary anymore. I managed to make it reproducible in a much simpler form just now. The ld-so-breakage project is basically a recreation of the original "docker" scenario written from scratch. I try to explain in the README , what is going on. But if there are questions hit me up (maybe as an issue ?) :     https://github.com/mulle-nat/ld-so-breakage The "another datapoint" project shows how constructor/destructor don't pair up:     https://github.com/mulle-nat/atexit-breakage-linux And as a random bonus this project indicates to me that LD_PRELOAD doesn't do what its supposed to either:     https://github.com/mulle-nat/LD_PRELOAD-breakage-linux In total I think the state of affairs is pretty dismal. I didn't expect that much basic stuff not working on linux. With hindsight, I probably have wasted _weeks_ on these problems. I still maintain that the concept to let `atexit` callbacks not run by `exit` is broken. An `atexit` callback is not the same as an `__attribute__((destructor))__`. Ciao    Nat!