Date: Thu, 29 Jun 2023 14:14:10 +0200 From: Willem Jan Withagen <wjw@digiware.nl> To: Dimitry Andric <dim@FreeBSD.org> Cc: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>, current@freebsd.org Subject: Re: __cxa_thread_call_dtors: dtr 0x........ from unloaded dso, skipping Message-ID: <333315bb-4502-f54e-482f-33b914a542f4@digiware.nl> In-Reply-To: <363E70BD-DD8C-4038-B11C-536FD604B233@FreeBSD.org> References: <46pq4r4n-p46r-47nn-r1ss-7r2984891pn7@yvfgf.mnoonqbm.arg> <16A8852E-DEA9-408E-80BC-94322FB2415E@FreeBSD.org> <p2p1n65r-511q-9oos-6369-0qnq2q7os4q7@yvfgf.mnoonqbm.arg> <0A55614E-3577-4933-9CCD-4D723DFA86E8@FreeBSD.org> <08035b3a-7356-efc8-616b-cbf46c1904e7@digiware.nl> <CDF72440-A1AE-4278-B110-897655BCF9E8@FreeBSD.org> <9e0a27a0-acb3-d30c-14db-ea59042d435b@digiware.nl> <363E70BD-DD8C-4038-B11C-536FD604B233@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 29-6-2023 14:01, Dimitry Andric wrote: > Actually I had that in my Ceph-ports as well, and chose to ignore it.... > Looked into the difference between FreeBSD and Linux. > Linux prevents that message by counting the number of loads, and only unloads > when the counter hits zero. FreeBSD just seems to unload, and report illegal access. >>> There is no "loading" and "unloading" going on, since this is about a >>> static executable. What happened was that __cxa_thread_call_dtors() was >>> giving a misleading message, because _rtld_addr_phdr() always returned >>> 0. Kostik has now made it so _rtld_addr_phdr() does the right thing for >>> static executables. >> So the "feature" I described is still in there? >> Any chance of that getting fixed? > I'm not sure which "feature" you mean. The only thing that is happening > in this particular case is that a static executable uses threads, and > when those threads exit, their destructors should be called. > > If you are talking about dynamic executables, then something entirely > different may be going on. And there might certainly be bugs in there. Oke, you are right. This about dynamic loadable libraries. What happens is dat several libraries are loaded multiple times by code either in the main program and/or other libraries... And on shutdown all those loads are matched with unloads. Needless to say that that can create a mess, if only when a library was already unloaded by another part of the code/library, and then _exit() wants to unload that library because it has registered itself to be unload at end_of_running. So most of my time, the exec space was not overwritten (since we are shutting down) but still the unloader reports that there are illegal accesses to already unloaded code. In most of the cases with Ceph, this is the auto generated destroy code for all kinds of C++ objects. Like I wrote: Linux works around this, by reference counting how many loads were done. And by unloading the counter is decreased, getting the real unload only when the counter hits zero. I was looking into how to fix this, but then got distracted by $work, so I never really got into anything that looks like a fix. --WjW
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?333315bb-4502-f54e-482f-33b914a542f4>