mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
dlfcn: Failures after dlmopen should not terminate process [BZ #24772]
Commit 9e78f6f6e7
("Implement
_dl_catch_error, _dl_signal_error in libc.so [BZ #16628]") has the
side effect that distinct namespaces, as created by dlmopen, now have
separate implementations of the rtld exception mechanism. This means
that the call to _dl_catch_error from libdl in a secondary namespace
does not actually install an exception handler because the
thread-local variable catch_hook in the libc.so copy in the secondary
namespace is distinct from that of the base namepace. As a result, a
dlsym/dlopen/... failure in a secondary namespace terminates the process
with a dynamic linker error because it looks to the exception handler
mechanism as if no handler has been installed.
This commit restores GLRO (dl_catch_error) and uses it to set the
handler in the base namespace.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
@ -248,4 +248,16 @@ _dl_receive_error (receiver_fct fct, void (*operate) (void *), void *args)
|
||||
catch_hook = old_catch;
|
||||
receiver = old_receiver;
|
||||
}
|
||||
|
||||
/* Forwarder used for initializing GLRO (_dl_catch_error). */
|
||||
int
|
||||
_rtld_catch_error (const char **objname, const char **errstring,
|
||||
bool *mallocedp, void (*operate) (void *),
|
||||
void *args)
|
||||
{
|
||||
/* The reference to _dl_catch_error will eventually be relocated to
|
||||
point to the implementation in libc.so. */
|
||||
return _dl_catch_error (objname, errstring, mallocedp, operate, args);
|
||||
}
|
||||
|
||||
#endif /* DL_ERROR_BOOTSTRAP */
|
||||
|
Reference in New Issue
Block a user