lt_dllopenext() returns invalid handle (was: 1.1.2 is broken if you have closefrom() )
Alan DeKok
aland at nitros9.org
Thu Jun 15 22:30:19 CEST 2006
Frank Cusack <fcusack at fcusack.com> wrote:
> Dunno if you didn't find time, or weren't able to reproduce it
I couldn't bear the though of fighting with that crap again.
Look at the code, it does the following:
...
strcat (tmp, archive_ext);
errors = try_dlopen (&handle, tmp);
if (errors) return 0;
/* If we found FILENAME, stop searching -- whether we were able to
load the file as a module or not. If the file exists but loading
failed, it is better to return an error message here than to
report FILE_NOT_FOUND when the alternatives (foo.so etc) are not
in the module search path. */
if (handle || ((errors > 0) && !file_not_found ()))
{
LT_DLFREE (tmp);
return handle;
}
...
Note that if (errors > 0) AND the file was found, it returns the
handle. i.e. It finds the CURRENT library, but not one that the
current library needs.
The idea of returning the handle if (errors > 0) is something that
is mind-blowingly retarded.
> But anyway, it looks easy to address in freeradius (as opposed to
> ltdl.c) so I'm going to try that.
I don't see how. The problem is that the handle is returned, but is
NOT completely populated. So ltdl_sym() de-references a NULL entry in
the handle, and dies.
Since the handle structure is opaque, it's impossible for FreeRADIUS
to know if the returned handle is OK, is is broken. So I have no idea
how you would handle this in FreeRADIUS.
> It's just a bit iffy since I can't
> actually reproduce the bug, but I figure, FR can't run under this
> condition anyway, the bug is just that it segfault's instead of
> reporting a useful error.
ltdl is helpful here, too. It doesn't keep track of the
dependencies when it's reporting an error. So if you have
rlm_sql_mysql, but not libmysqlclient, it complains that it can't find
rlm_sql_mysql. See the list archives for multipl WTF questions from
users.
Alan DeKok.
More information about the Freeradius-Devel
mailing list