From b04b0d0bedcb5c8ef212f96f2ba7634392106970 Mon Sep 17 00:00:00 2001 From: Klaus Wenninger Date: Tue, 19 Mar 2024 19:22:58 +0100 Subject: [PATCH] test: get libaio symbols via dlsym(RTLD_NEXT, ...) disable lazy-binding for that --- tests/regressions.sh | 2 +- tests/sbd-testbed.c | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/regressions.sh b/tests/regressions.sh index d131b70..cd900ce 100755 --- a/tests/regressions.sh +++ b/tests/regressions.sh @@ -33,7 +33,7 @@ : ${SBD_TRANSLATE_AIO:= "no"} sbd() { - LD_PRELOAD=${SBD_PRELOAD} SBD_DEVICE="${SBD_DEVICE}" SBD_PRELOAD_LOG=${SBD_PRELOAD_LOG} SBD_WATCHDOG_DEV=/dev/watchdog setsid ${SBD_BINARY} -p ${SBD_PIDFILE} "$@" + LD_BIND_NOW=yes LD_PRELOAD=${SBD_PRELOAD} SBD_DEVICE="${SBD_DEVICE}" SBD_PRELOAD_LOG=${SBD_PRELOAD_LOG} SBD_WATCHDOG_DEV=/dev/watchdog setsid ${SBD_BINARY} -p ${SBD_PIDFILE} "$@" } sbd_sleep() { diff --git a/tests/sbd-testbed.c b/tests/sbd-testbed.c index 91920f2..12f068a 100644 --- a/tests/sbd-testbed.c +++ b/tests/sbd-testbed.c @@ -154,17 +154,11 @@ init (void) orig_fopen = (orig_fopen_f_type)dlsym_fatal(RTLD_NEXT,"fopen"); orig_fclose = (orig_fclose_f_type)dlsym_fatal(RTLD_NEXT,"fclose"); - handle = dlopen("libaio.so.1", RTLD_NOW); - if (!handle) { - fprintf(stderr, "Failed opening libaio.so.1\n"); - exit(1); - } - orig_io_setup = (orig_io_setup_f_type)dlsym_fatal(handle,"io_setup"); - orig_io_destroy = (orig_io_destroy_f_type)dlsym_fatal(handle,"io_destroy"); - orig_io_submit = (orig_io_submit_f_type)dlsym_fatal(handle,"io_submit"); - orig_io_getevents = (orig_io_getevents_f_type)dlsym_fatal(handle,"io_getevents"); - orig_io_cancel = (orig_io_cancel_f_type)dlsym_fatal(handle,"io_cancel"); - dlclose(handle); + orig_io_setup = (orig_io_setup_f_type)dlsym_fatal(RTLD_NEXT,"io_setup"); + orig_io_destroy = (orig_io_destroy_f_type)dlsym_fatal(RTLD_NEXT,"io_destroy"); + orig_io_submit = (orig_io_submit_f_type)dlsym_fatal(RTLD_NEXT,"io_submit"); + orig_io_getevents = (orig_io_getevents_f_type)dlsym_fatal(RTLD_NEXT,"io_getevents"); + orig_io_cancel = (orig_io_cancel_f_type)dlsym_fatal(RTLD_NEXT,"io_cancel"); value = getenv("SBD_PRELOAD_LOG"); if (value) { @@ -203,7 +197,7 @@ init (void) } } -// ***** end - handling of watchdog & block-devices **** +// ***** handling of watchdog & block-devices **** static gboolean watchdog_timeout_notify(gpointer data)