* [PATCH] libdwfl: do not dlopen libdebuginfod.so in --disable-libdebuginfod mode
@ 2020-08-20 20:27 Dmitry V. Levin
2020-08-30 20:40 ` Mark Wielaard
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry V. Levin @ 2020-08-20 20:27 UTC (permalink / raw)
To: elfutils-devel
debuginfod-client.c used to try to dlopen libdebuginfod.so even if
libdebuginfod was completely disabled using --disable-libdebuginfod.
Fix this by disabling build of debuginfod-client.c and disabling all
__libdwfl_debuginfod_* invocations in --disable-libdebuginfod mode.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
ChangeLog | 4 ++++
configure.ac | 5 ++++-
libdwfl/ChangeLog | 13 +++++++++++++
libdwfl/Makefile.am | 5 ++++-
libdwfl/dwfl_build_id_find_elf.c | 2 ++
libdwfl/dwfl_end.c | 2 ++
libdwfl/find-debuginfo.c | 2 ++
7 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c6b526fe..0f00fade 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2020-08-20 Dmitry V. Levin <ldv@altlinux.org>
+
+ * configure.ac (--enable-libdebuginfod): AC_DEFINE ENABLE_LIBDEBUGINFOD.
+
2020-07-17 Mark Wielaard <mark@klomp.org>
* configure.ac: Set -DBAD_FTS=1 also for CXXFLAGS.
diff --git a/configure.ac b/configure.ac
index e2f213ab..f3f1597b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -693,7 +693,10 @@ AS_IF([test "x$enable_libdebuginfod" != "xno"], [
fi
])
-AS_IF([test "x$enable_libdebuginfod" = "xdummy"],AC_DEFINE([DUMMY_LIBDEBUGINFOD],[1],[Build dummy libdebuginfod]))
+AS_IF([test "x$enable_libdebuginfod" = "xyes" || test "x$enable_libdebuginfod" = "xdummy"],
+ [AC_DEFINE([ENABLE_LIBDEBUGINFOD], [1], [Enable libdebuginfod])])
+AS_IF([test "x$enable_libdebuginfod" = "xdummy"],
+ [AC_DEFINE([DUMMY_LIBDEBUGINFOD], [1], [Build dummy libdebuginfod])])
AM_CONDITIONAL([LIBDEBUGINFOD],[test "x$enable_libdebuginfod" = "xyes" || test "x$enable_libdebuginfod" = "xdummy"])
AM_CONDITIONAL([DUMMY_LIBDEBUGINFOD],[test "x$enable_libdebuginfod" = "xdummy"])
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index e59efd77..bf6b3ff6 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,16 @@
+2020-08-20 Dmitry V. Levin <ldv@altlinux.org>
+
+ * Makefile.am (libdwfl_a_SOURCES): Conditionalize
+ debuginfod-client.c on LIBDEBUGINFOD.
+ * dwfl_build_id_find_elf.c (dwfl_build_id_find_elf): Conditionalize
+ __libdwfl_debuginfod_find_executable invocation on
+ ENABLE_LIBDEBUGINFOD.
+ * dwfl_end.c (dwfl_end): Conditionalize __libdwfl_debuginfod_end
+ invocation on ENABLE_LIBDEBUGINFOD.
+ * find-debuginfo.c (dwfl_standard_find_debuginfo): Conditionalize
+ __libdwfl_debuginfod_find_debuginfo invocation on
+ ENABLE_LIBDEBUGINFOD.
+
2020-07-05 Mark Wielaard <mark@klomp.org>
* argp-std.c (parse_opt): Don't assert, but call fail when
diff --git a/libdwfl/Makefile.am b/libdwfl/Makefile.am
index 47bd62a5..1de05492 100644
--- a/libdwfl/Makefile.am
+++ b/libdwfl/Makefile.am
@@ -70,7 +70,7 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \
link_map.c core-file.c open.c image-header.c \
dwfl_frame.c frame_unwind.c dwfl_frame_pc.c \
linux-pid-attach.c linux-core-attach.c dwfl_frame_regs.c \
- gzip.c debuginfod-client.c
+ gzip.c
if BZLIB
libdwfl_a_SOURCES += bzip2.c
@@ -78,6 +78,9 @@ endif
if LZMA
libdwfl_a_SOURCES += lzma.c
endif
+if LIBDEBUGINFOD
+libdwfl_a_SOURCES += debuginfod-client.c
+endif
libdwfl = $(libdw)
libdw = ../libdw/libdw.so
diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
index f685c979..7b604d47 100644
--- a/libdwfl/dwfl_build_id_find_elf.c
+++ b/libdwfl/dwfl_build_id_find_elf.c
@@ -192,12 +192,14 @@ dwfl_build_id_find_elf (Dwfl_Module *mod,
}
else
{
+#ifdef ENABLE_LIBDEBUGINFOD
/* If all else fails and a build-id is available, query the
debuginfo-server if enabled. */
if (fd < 0 && mod->build_id_len > 0)
fd = __libdwfl_debuginfod_find_executable (mod->dwfl,
mod->build_id_bits,
mod->build_id_len);
+#endif
}
if (fd < 0 && errno == 0 && mod->build_id_len > 0)
diff --git a/libdwfl/dwfl_end.c b/libdwfl/dwfl_end.c
index 4f6c722a..b1840191 100644
--- a/libdwfl/dwfl_end.c
+++ b/libdwfl/dwfl_end.c
@@ -39,7 +39,9 @@ dwfl_end (Dwfl *dwfl)
if (dwfl == NULL)
return;
+#ifdef ENABLE_LIBDEBUGINFOD
__libdwfl_debuginfod_end (dwfl->debuginfod);
+#endif
if (dwfl->process)
__libdwfl_process_free (dwfl->process);
diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
index eb68d549..449df5a1 100644
--- a/libdwfl/find-debuginfo.c
+++ b/libdwfl/find-debuginfo.c
@@ -401,6 +401,7 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
free (canon);
}
+#ifdef ENABLE_LIBDEBUGINFOD
/* Still nothing? Try if we can use the debuginfod client.
But note that we might be looking for the alt file.
We use the same trick as dwfl_build_id_find_debuginfo.
@@ -422,6 +423,7 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
if (bits_len > 0)
fd = __libdwfl_debuginfod_find_debuginfo (mod->dwfl, bits, bits_len);
}
+#endif
return fd;
}
--
ldv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libdwfl: do not dlopen libdebuginfod.so in --disable-libdebuginfod mode
2020-08-20 20:27 [PATCH] libdwfl: do not dlopen libdebuginfod.so in --disable-libdebuginfod mode Dmitry V. Levin
@ 2020-08-30 20:40 ` Mark Wielaard
2020-08-30 20:49 ` Dmitry V. Levin
0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2020-08-30 20:40 UTC (permalink / raw)
To: Dmitry V. Levin; +Cc: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 875 bytes --]
Hi Dmitry,
On Thu, Aug 20, 2020 at 11:27:24PM +0300, Dmitry V. Levin wrote:
> debuginfod-client.c used to try to dlopen libdebuginfod.so even if
> libdebuginfod was completely disabled using --disable-libdebuginfod.
>
> Fix this by disabling build of debuginfod-client.c and disabling all
> __libdwfl_debuginfod_* invocations in --disable-libdebuginfod mode.
To be honest I really hope libdebuginfod is only disabled for
bootstrapping reasons and that people will use
--enable-libdebuginfod=dummy.
That said, your patch makes sense if people explicitly choose to
--disable-libdebuginfod and it handles --enable-libdebuginfod=dummy
correctly.
To double check I removed all references to debuginfod_client from
libdwflP.h when libdebuginfod is disabled. And things look fine in
that case too. I think it makes sense to add this to your patch. See
attached.
Thanks,
Mark
[-- Attachment #2: nodebuginfod.patch --]
[-- Type: text/x-diff, Size: 1217 bytes --]
diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h
index 25753de2..ad6779ad 100644
--- a/libdwfl/libdwflP.h
+++ b/libdwfl/libdwflP.h
@@ -40,7 +40,10 @@
#include "../libdw/libdwP.h" /* We need its INTDECLs. */
#include "../libdwelf/libdwelfP.h"
+
+#ifdef ENABLE_LIBDEBUGINFOD
#include "../debuginfod/debuginfod.h"
+#endif
typedef struct Dwfl_Process Dwfl_Process;
@@ -115,8 +118,9 @@ struct Dwfl_User_Core
struct Dwfl
{
const Dwfl_Callbacks *callbacks;
+#ifdef ENABLE_LIBDEBUGINFOD
debuginfod_client *debuginfod;
-
+#endif
Dwfl_Module *modulelist; /* List in order used by full traversals. */
Dwfl_Process *process;
@@ -631,6 +635,7 @@ extern Dwfl_Error __libdw_open_elf (int fd, Elf **elfp) internal_function;
extern bool __libdwfl_dynamic_vaddr_get (Elf *elf, GElf_Addr *vaddrp)
internal_function;
+#ifdef ENABLE_LIBDEBUGINFOD
/* Internal interface to libdebuginfod (if installed). */
int
__libdwfl_debuginfod_find_executable (Dwfl *dwfl,
@@ -642,6 +647,7 @@ __libdwfl_debuginfod_find_debuginfo (Dwfl *dwfl,
size_t build_id_len);
void
__libdwfl_debuginfod_end (debuginfod_client *c);
+#endif
/* These are working nicely for --core, but are not ready to be
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libdwfl: do not dlopen libdebuginfod.so in --disable-libdebuginfod mode
2020-08-30 20:40 ` Mark Wielaard
@ 2020-08-30 20:49 ` Dmitry V. Levin
2020-08-31 8:42 ` Mark Wielaard
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry V. Levin @ 2020-08-30 20:49 UTC (permalink / raw)
To: Mark Wielaard; +Cc: elfutils-devel
Hi Mark,
On Sun, Aug 30, 2020 at 10:40:29PM +0200, Mark Wielaard wrote:
> Hi Dmitry,
>
> On Thu, Aug 20, 2020 at 11:27:24PM +0300, Dmitry V. Levin wrote:
> > debuginfod-client.c used to try to dlopen libdebuginfod.so even if
> > libdebuginfod was completely disabled using --disable-libdebuginfod.
> >
> > Fix this by disabling build of debuginfod-client.c and disabling all
> > __libdwfl_debuginfod_* invocations in --disable-libdebuginfod mode.
>
> To be honest I really hope libdebuginfod is only disabled for
> bootstrapping reasons and that people will use
> --enable-libdebuginfod=dummy.
>
> That said, your patch makes sense if people explicitly choose to
> --disable-libdebuginfod and it handles --enable-libdebuginfod=dummy
> correctly.
>
> To double check I removed all references to debuginfod_client from
> libdwflP.h when libdebuginfod is disabled. And things look fine in
> that case too. I think it makes sense to add this to your patch. See
> attached.
Yes, it definitely makes sense, thanks.
> Thanks,
>
> Mark
> diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h
> index 25753de2..ad6779ad 100644
> --- a/libdwfl/libdwflP.h
> +++ b/libdwfl/libdwflP.h
> @@ -40,7 +40,10 @@
>
> #include "../libdw/libdwP.h" /* We need its INTDECLs. */
> #include "../libdwelf/libdwelfP.h"
> +
> +#ifdef ENABLE_LIBDEBUGINFOD
> #include "../debuginfod/debuginfod.h"
> +#endif
>
> typedef struct Dwfl_Process Dwfl_Process;
>
> @@ -115,8 +118,9 @@ struct Dwfl_User_Core
> struct Dwfl
> {
> const Dwfl_Callbacks *callbacks;
> +#ifdef ENABLE_LIBDEBUGINFOD
> debuginfod_client *debuginfod;
> -
> +#endif
> Dwfl_Module *modulelist; /* List in order used by full traversals. */
>
> Dwfl_Process *process;
> @@ -631,6 +635,7 @@ extern Dwfl_Error __libdw_open_elf (int fd, Elf **elfp) internal_function;
> extern bool __libdwfl_dynamic_vaddr_get (Elf *elf, GElf_Addr *vaddrp)
> internal_function;
>
> +#ifdef ENABLE_LIBDEBUGINFOD
> /* Internal interface to libdebuginfod (if installed). */
> int
> __libdwfl_debuginfod_find_executable (Dwfl *dwfl,
> @@ -642,6 +647,7 @@ __libdwfl_debuginfod_find_debuginfo (Dwfl *dwfl,
> size_t build_id_len);
> void
> __libdwfl_debuginfod_end (debuginfod_client *c);
> +#endif
>
>
> /* These are working nicely for --core, but are not ready to be
--
ldv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libdwfl: do not dlopen libdebuginfod.so in --disable-libdebuginfod mode
2020-08-30 20:49 ` Dmitry V. Levin
@ 2020-08-31 8:42 ` Mark Wielaard
0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2020-08-31 8:42 UTC (permalink / raw)
To: Dmitry V. Levin; +Cc: elfutils-devel
Hi Dmitry,
On Sun, Aug 30, 2020 at 11:49:10PM +0300, Dmitry V. Levin wrote:
> On Sun, Aug 30, 2020 at 10:40:29PM +0200, Mark Wielaard wrote:
> > To double check I removed all references to debuginfod_client from
> > libdwflP.h when libdebuginfod is disabled. And things look fine in
> > that case too. I think it makes sense to add this to your patch. See
> > attached.
>
> Yes, it definitely makes sense, thanks.
OK, pushed to master with that change.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-31 8:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 20:27 [PATCH] libdwfl: do not dlopen libdebuginfod.so in --disable-libdebuginfod mode Dmitry V. Levin
2020-08-30 20:40 ` Mark Wielaard
2020-08-30 20:49 ` Dmitry V. Levin
2020-08-31 8:42 ` Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).