From: "Dmitry V. Levin" <ldv@altlinux.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH v2 4/3] debuginfod: create libdebuginfod files using a race-free method
Date: Sun, 6 Dec 2020 17:44:46 +0300 [thread overview]
Message-ID: <20201206144445.GA28423@altlinux.org> (raw)
In-Reply-To: <20201206135412.GB27807@altlinux.org>
Before this change, both the soname and the fully versioned
libdebuginfod file name were created after libdebuginfod.so, opening
a race for all libdebuginfod users that have Makefile dependencies
on libdebuginfod.so but actually use libdebuginfod.so.1 or the fully
versioned libdebuginfod file name.
After this change, the libdebuginfod.so symlink is created the last
of all libdebuginfod files, closing the race.
---
debuginfod/ChangeLog | 4 ++++
debuginfod/Makefile.am | 12 ++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 27abdfda..03eabb6b 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,5 +1,9 @@
2020-12-06 Dmitry V. Levin <ldv@altlinux.org>
+ * Makefile.am [LIBDEBUGINFOD]: Create the fully versioned
+ libdebuginfod file name first, turn the soname and libdebuginfod.so
+ into symlinks.
+
* Makefile.am (LIBDEBUGINFOD_FULL_NAME): New variable.
(libdebuginfod.so): Use it to create the fully versioned file name.
(install, uninstall): Replace libdebuginfod-$(PACKAGE_VERSION).so with
diff --git a/debuginfod/Makefile.am b/debuginfod/Makefile.am
index 7df66125..b667ad6d 100644
--- a/debuginfod/Makefile.am
+++ b/debuginfod/Makefile.am
@@ -101,21 +101,25 @@ else
libdebuginfod_so_LDLIBS = $(libcurl_LIBS) $(fts_LIBS)
endif
LIBDEBUGINFOD_FULL_NAME = libdebuginfod-$(PACKAGE_VERSION).so
-libdebuginfod.so: $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS)
+$(LIBDEBUGINFOD_FULL_NAME): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS)
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
-Wl,--soname,$(LIBDEBUGINFOD_SONAME) \
-Wl,--version-script,$<,--no-undefined \
-Wl,--whole-archive $(libdebuginfod_so_LIBS) -Wl,--no-whole-archive \
$(libdebuginfod_so_LDLIBS)
@$(textrel_check)
- $(AM_V_at)ln -fs $@ $(LIBDEBUGINFOD_FULL_NAME)
- $(AM_V_at)ln -fs $@ $(LIBDEBUGINFOD_SONAME)
+
+$(LIBDEBUGINFOD_SONAME): $(LIBDEBUGINFOD_FULL_NAME)
+ ln -fs $< $@
+
+libdebuginfod.so: $(LIBDEBUGINFOD_SONAME)
+ ln -fs $< $@
endif
if LIBDEBUGINFOD
install: install-am libdebuginfod.so
$(mkinstalldirs) $(DESTDIR)$(libdir)
- $(INSTALL_PROGRAM) libdebuginfod.so $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_FULL_NAME)
+ $(INSTALL_PROGRAM) $(LIBDEBUGINFOD_FULL_NAME) $(DESTDIR)$(libdir)/
ln -fs $(LIBDEBUGINFOD_FULL_NAME) $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME)
ln -fs $(LIBDEBUGINFOD_FULL_NAME) $(DESTDIR)$(libdir)/libdebuginfod.so
--
ldv
next prev parent reply other threads:[~2020-12-06 14:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-30 9:00 [PATCH] debuginfod: export DEBUGINFOD_SONAME macro in debuginfod.h Dmitry V. Levin
2020-12-06 12:06 ` Mark Wielaard
2020-12-06 12:28 ` Dmitry V. Levin
2020-12-06 13:32 ` Frank Ch. Eigler
2020-12-06 13:34 ` Dmitry V. Levin
2020-12-06 13:54 ` [PATCH v2 1/3] " Dmitry V. Levin
2020-12-06 13:54 ` [PATCH v2 2/3] debuginfod: create the fully versioned libdebuginfod file name during build Dmitry V. Levin
2020-12-06 14:44 ` Dmitry V. Levin [this message]
2020-12-06 13:54 ` [PATCH v2 3/3] libdwfl: do not fall back to dlopen of libdebuginfod.so Dmitry V. Levin
2020-12-08 12:02 ` [PATCH] debuginfod: export DEBUGINFOD_SONAME macro in debuginfod.h Mark Wielaard
2020-12-08 13:30 ` Dmitry V. Levin
2020-12-08 15:15 ` Dmitry V. Levin
2020-12-08 23:07 ` Mark Wielaard
2020-12-08 23:20 ` Dmitry V. Levin
2020-12-09 0:12 ` [PATCH v3 1/3] " Dmitry V. Levin
2020-12-09 22:06 ` Mark Wielaard
2020-12-09 0:13 ` [PATCH v3 2/3] debuginfod: create libdebuginfod.so.1 before libdebuginfod.so Dmitry V. Levin
2020-12-09 0:30 ` Dmitry V. Levin
2020-12-09 22:12 ` Mark Wielaard
2020-12-09 0:13 ` [PATCH v3 3/3] libdwfl: switch to DEBUGINFOD_SONAME, remove libdebuginfod.so fallback Dmitry V. Levin
2020-12-09 22:43 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201206144445.GA28423@altlinux.org \
--to=ldv@altlinux.org \
--cc=elfutils-devel@sourceware.org \
--cc=mark@klomp.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).