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

Reply via email to