]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dlopen: log debug message when a library is dlopened 32065/head
authorLuca Boccassi <bluca@debian.org>
Wed, 3 Apr 2024 11:07:43 +0000 (12:07 +0100)
committerLuca Boccassi <bluca@debian.org>
Wed, 3 Apr 2024 13:23:04 +0000 (14:23 +0100)
Useful to track what is being used and when

src/basic/dlfcn-util.c
src/shared/bpf-dlopen.c
src/shared/idn-util.c
src/shared/tpm2-util.c
src/shared/userdb.c

index a321df3c672d5c9b9e41de65382d05c087a7d528..8022f552943f47d3d451636d8e943abc21b697e3 100644 (file)
@@ -49,6 +49,8 @@ int dlopen_many_sym_or_warn_sentinel(void **dlp, const char *filename, int log_l
                 return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
                                        "%s is not installed: %s", filename, dlerror());
 
+        log_debug("Loaded '%s' via dlopen()", filename);
+
         va_list ap;
         va_start(ap, log_level);
         r = dlsym_many_or_warnv(dl, log_level, ap);
index 1b4aa903e61b09149575411353683c2bd2728d2a..6d59001b2c7549d233d5f9c1f1e930a62bd3cef2 100644 (file)
@@ -76,6 +76,8 @@ int dlopen_bpf(void) {
                         return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
                                                "neither libbpf.so.1 nor libbpf.so.0 are installed: %s", dlerror());
 
+                log_debug("Loaded 'libbpf.so.0' via dlopen()");
+
                 /* symbols deprecated in 1.0 we use as compat */
                 r = dlsym_many_or_warn(
                                 dl, LOG_DEBUG,
@@ -89,6 +91,8 @@ int dlopen_bpf(void) {
 #endif
                 );
         } else {
+                log_debug("Loaded 'libbpf.so.1' via dlopen()");
+
                 /* symbols available from 0.7.0 */
                 r = dlsym_many_or_warn(
                                 dl, LOG_DEBUG,
index 70f039f82525d33d1920551929d790f9857373c2..6b26f2064a1bd20a494855e2a0e04823428e4e57 100644 (file)
@@ -50,7 +50,10 @@ int dlopen_idn(void) {
                 if (!dl)
                         return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
                                                "libidn support is not installed: %s", dlerror());
-        }
+                log_debug("Loaded 'libidn.so.11' via dlopen()");
+        } else
+                log_debug("Loaded 'libidn.so.12' via dlopen()");
+
 
         r = dlsym_many_or_warn(
                         dl,
index 203cf5fb3adcd5a42eafb5b221c577399df212ed..42975cdb970e46bed36a055c51aedf6dcc181639 100644 (file)
@@ -668,6 +668,8 @@ int tpm2_context_new(const char *device, Tpm2Context **ret_context) {
                 if (!context->tcti_dl)
                         return log_debug_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE), "Failed to load %s: %s", fn, dlerror());
 
+                log_debug("Loaded '%s' via dlopen()", fn);
+
                 func = dlsym(context->tcti_dl, TSS2_TCTI_INFO_SYMBOL);
                 if (!func)
                         return log_debug_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE),
index d262c82d63ba3be9eebb222a1148f63391a2b8a7..75dece3442935ae71f658f23105ff8f31d2e03c0 100644 (file)
@@ -1455,6 +1455,8 @@ int userdb_block_nss_systemd(int b) {
                 return 0;
         }
 
+        log_debug("Loaded '%s' via dlopen()", LIBDIR "/libnss_systemd.so.2");
+
         call = dlsym(dl, "_nss_systemd_block");
         if (!call)
                 /* If the file is installed but lacks the symbol we expect, things are weird, let's complain */