From: Ivan Kozlov <kanichos@yandex.ru>
To: 52693@debbugs.gnu.org
Subject: [bug#52693] [PATCH] gnu: glibc: Handle failure to find $ORIGIN.
Date: Tue, 21 Dec 2021 04:25:50 +0300 [thread overview]
Message-ID: <12919001640049950@myt6-27f58919b1c4.qloud-c.yandex.net> (raw)
Fixes <https://issues.guix.gnu.org/52671>.
* gnu/packages/patches/glibc-dl-cache.patch: Check pointer returned by '_dl_get_origin' for failure indication.
---
gnu/packages/patches/glibc-dl-cache.patch | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gnu/packages/patches/glibc-dl-cache.patch b/gnu/packages/patches/glibc-dl-cache.patch
index 68c3a94846..1535e8e9c9 100644
--- a/gnu/packages/patches/glibc-dl-cache.patch
+++ b/gnu/packages/patches/glibc-dl-cache.patch
@@ -3,10 +3,10 @@ from /etc/ld.so.cache. Also arrange so that this cache takes
precedence over RUNPATH.
diff --git a/elf/dl-cache.c b/elf/dl-cache.c
-index 93d185e788..e0760a1f40 100644
+index 93d185e788..801452692d 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
-@@ -171,6 +171,51 @@ _dl_cache_libcmp (const char *p1, const char *p2)
+@@ -171,6 +171,52 @@ _dl_cache_libcmp (const char *p1, const char *p2)
return *p1 - *p2;
}
@@ -27,7 +27,8 @@ index 93d185e788..e0760a1f40 100644
+ const char *origin = _dl_get_origin ();
+
+ /* Check whether ORIGIN is something like "/gnu/store/…-foo/bin". */
-+ if (strncmp (store, origin, strlen (store)) == 0
++ if (origin != (char *)-1 /* _dl_get_origin reported failure */
++ && strncmp (store, origin, strlen (store)) == 0
+ && origin[sizeof store - 1] == '/')
+ {
+ char *store_item_end = strchr (origin + sizeof store, '/');
@@ -58,7 +59,7 @@ index 93d185e788..e0760a1f40 100644
/* Look up NAME in ld.so.cache and return the file name stored there, or null
if none is found. The cache is loaded if it was not already. If loading
-@@ -190,12 +235,15 @@ _dl_load_cache_lookup (const char *name)
+@@ -190,12 +236,15 @@ _dl_load_cache_lookup (const char *name)
/* Print a message if the loading of libs is traced. */
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
base-commit: 88b4dcdabe512992ae79a50fc333e4e463d91634
--
2.28.0
next reply other threads:[~2021-12-21 1:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-21 1:25 Ivan Kozlov [this message]
2022-01-14 8:20 ` [bug#52693] [PATCH] gnu: glibc: Handle failure to find $ORIGIN Ludovic Courtès
2022-01-14 22:40 ` Maxim Cournoyer
2022-01-17 14:59 ` Ludovic Courtès
2023-01-29 23:34 ` bug#52693: " Ludovic Courtès
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=12919001640049950@myt6-27f58919b1c4.qloud-c.yandex.net \
--to=kanichos@yandex.ru \
--cc=52693@debbugs.gnu.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.