From 9558bcc5bfe6c0bf5f62bf96b313ff81a1201e40 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 9 Dec 2019 20:07:02 +0100 Subject: [PATCH] 0.178-5 - Add elfutils-0.178-debuginfod-no-cache.patch. --- elfutils-0.178-debuginfod-no-cache.patch | 67 ++++++++++++++++++++++++ elfutils.spec | 7 ++- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 elfutils-0.178-debuginfod-no-cache.patch diff --git a/elfutils-0.178-debuginfod-no-cache.patch b/elfutils-0.178-debuginfod-no-cache.patch new file mode 100644 index 0000000..a05336b --- /dev/null +++ b/elfutils-0.178-debuginfod-no-cache.patch @@ -0,0 +1,67 @@ +commit d8bad02afc7b7f30402b4e0e458df874a6d600da +Author: Mark Wielaard +Date: Mon Dec 9 19:38:19 2019 +0100 + + debuginfod: Check the DEBUGINFOD_URLS environment variable early in client. + + If the debuginfod-client isn't configured we should do as little + as possible. Simply return early with ENOSYS if no servers are + configured. This means we won't check + + This does change the behavior of the debuginfod_find calls slightly. + Previously we would setup and check the cache if the given build-id + was valid. Which might have provided a result if an earlier client + had run with the same cache and valid server URLs which knew about + that particular build-id. Now we don't return any cached results + unless at least one server is configured. + + This prevents selinux errors when the library is used in a confined + setup. + + Signed-off-by: Mark Wielaard + +diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c +index 302ea2dc..ab7b4e13 100644 +--- a/debuginfod/debuginfod-client.c ++++ b/debuginfod/debuginfod-client.c +@@ -301,6 +301,16 @@ debuginfod_query_server (debuginfod_client *c, + char target_cache_tmppath[PATH_MAX*5]; + char suffix[PATH_MAX*2]; + char build_id_bytes[MAX_BUILD_ID_BYTES * 2 + 1]; ++ int rc; ++ ++ /* Is there any server we can query? If not, don't do any work, ++ just return with ENOSYS. Don't even access the cache. */ ++ urls_envvar = getenv(server_urls_envvar); ++ if (urls_envvar == NULL || urls_envvar[0] == '\0') ++ { ++ rc = -ENOSYS; ++ goto out; ++ } + + /* Copy lowercase hex representation of build_id into buf. */ + if ((build_id_len >= MAX_BUILD_ID_BYTES) || +@@ -373,7 +383,7 @@ debuginfod_query_server (debuginfod_client *c, + /* XXX combine these */ + snprintf(interval_path, sizeof(interval_path), "%s/%s", cache_path, cache_clean_interval_filename); + snprintf(maxage_path, sizeof(maxage_path), "%s/%s", cache_path, cache_max_unused_age_filename); +- int rc = debuginfod_init_cache(cache_path, interval_path, maxage_path); ++ rc = debuginfod_init_cache(cache_path, interval_path, maxage_path); + if (rc != 0) + goto out; + rc = debuginfod_clean_cache(c, cache_path, interval_path, maxage_path); +@@ -390,14 +400,6 @@ debuginfod_query_server (debuginfod_client *c, + return fd; + } + +- +- urls_envvar = getenv(server_urls_envvar); +- if (urls_envvar == NULL || urls_envvar[0] == '\0') +- { +- rc = -ENOSYS; +- goto out; +- } +- + if (getenv(server_timeout_envvar)) + server_timeout = atoi (getenv(server_timeout_envvar)); + diff --git a/elfutils.spec b/elfutils.spec index 5ef8b60..68f35f0 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,6 +1,6 @@ Name: elfutils Version: 0.178 -%global baserelease 4 +%global baserelease 5 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -55,6 +55,7 @@ BuildRequires: curl # Patches Patch1: elfutils-0.178-pt-gnu-prop.patch +Patch2: elfutils-0.178-debuginfod-no-cache.patch %description Elfutils is a collection of utilities, including stack (to show @@ -247,6 +248,7 @@ such servers to download those files on demand. # Apply patches %patch1 -p1 -b .pt-gnu-prop +%patch2 -p1 -b .debuginfod-client-cache # In case the above patches added any new test scripts, make sure they # are executable. @@ -424,6 +426,9 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Mon Dec 9 2019 Mark Wielaard - 0.178-5 +- Add elfutils-0.178-debuginfod-no-cache.patch. + * Thu Nov 28 2019 Mark Wielaard - 0.178-4 - Define %%{depsuffix} before use.