From b2964eb1d9a6b8ab1250e8a881cf406182da5875 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 21 Apr 2021 19:49:51 +0200 Subject: dlfcn: Failures after dlmopen should not terminate process [BZ #24772] Commit 9e78f6f6e7134a5f299cc8de77370218f8019237 ("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 --- dlfcn/dlerror.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dlfcn') diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c index 48b4c25bea..947b7c10c6 100644 --- a/dlfcn/dlerror.c +++ b/dlfcn/dlerror.c @@ -167,8 +167,10 @@ _dlerror_run (void (*operate) (void *), void *args) result->errstring = NULL; } - result->errcode = _dl_catch_error (&result->objname, &result->errstring, - &result->malloced, operate, args); + result->errcode = GLRO (dl_catch_error) (&result->objname, + &result->errstring, + &result->malloced, + operate, args); /* If no error we mark that no error string is available. */ result->returned = result->errstring == NULL; -- cgit 1.4.1