import elfutils-0.180-1.el8

This commit is contained in:
CentOS Sources 2020-11-03 06:51:45 -05:00 committed by Andrew Lukoshko
parent c54d079c18
commit 7fe8c60c3e
9 changed files with 10 additions and 957 deletions

View File

@ -1 +1 @@
5f52d04105a89e50caf69cea40629c323c1eccd9 SOURCES/elfutils-0.178.tar.bz2
c1ed871515b0f7fcdf2d94fea23e4b8ba67e8fe3 SOURCES/elfutils-0.180.tar.bz2

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/elfutils-0.178.tar.bz2
SOURCES/elfutils-0.180.tar.bz2

View File

@ -1,62 +0,0 @@
commit 4a90cb11140a6bb3712228861a32e4035013ad85
Author: Mark Wielaard <mark@klomp.org>
Date: Thu Dec 5 15:03:54 2019 +0100
libdwfl: Find and handle compressed vmlinuz image.
Both the dwfl_linux_kernel_find_elf callback and the
dwfl_linux_kernel_report_offline reporting function only handled
vmlinix images possibly compressed with .gz, .bz2 or .xz extension.
They did not find or handle the much more common vmlinuz compressed
images.
It is not completely clear why we didn't up to now. Support for
compressed ELF files was added in 2009 and the code was updated to
to try to find the .gz, .bz2 or .xz extension variants in 2011.
But not the vmlinuz named variant.
Reported-by: Aaron Merey <amerey@redhat.com>
Tested-by: Frank Ch. Eigler <fche@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index d46ab5aa..48fb1ff0 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -174,6 +174,8 @@ kernel_release (void)
static int
find_kernel_elf (Dwfl *dwfl, const char *release, char **fname)
{
+ /* First try to find an uncompressed vmlinux image. Possibly
+ including debuginfo. */
if ((release[0] == '/'
? asprintf (fname, "%s/vmlinux", release)
: asprintf (fname, "/boot/vmlinux-%s", release)) < 0)
@@ -188,6 +190,27 @@ find_kernel_elf (Dwfl *dwfl, const char *release, char **fname)
fd = try_kernel_name (dwfl, fname, true);
}
+ /* There might be a compressed vmlinuz image. Probably without
+ debuginfo, but try to find it under the debug path also, just in
+ case. */
+ if (fd < 0)
+ {
+ free (*fname);
+ if ((release[0] == '/'
+ ? asprintf (fname, "%s/vmlinuz", release)
+ : asprintf (fname, "/boot/vmlinuz-%s", release)) < 0)
+ return -1;
+
+ fd = try_kernel_name (dwfl, fname, true);
+ if (fd < 0 && release[0] != '/')
+ {
+ free (*fname);
+ if (asprintf (fname, MODULEDIRFMT "/vmlinuz", release) < 0)
+ return -1;
+ fd = try_kernel_name (dwfl, fname, true);
+ }
+ }
+
return fd;
}

View File

@ -1,53 +0,0 @@
commit 374fbed3da0197f794a904e78e75e961c7e2e92c
Author: Mark Wielaard <mark@klomp.org>
Date: Wed Dec 4 00:39:26 2019 +0100
debuginfod: Fix implicit conversion from 'CURLcode' to 'CURLMcode'
GCC10 warns when converting the value of one enum type into another:
debuginfod-client.c:530:24: error: implicit conversion from CURLcode
to CURLMcode [-Werror=enum-conversion]
530 | curl_res = curl_easy_getinfo(target_handle,
| ^
libcurl has different error code enums. The "easy" interfaces return
a CURLcode error. The "multi" interface functions return a CURLMcode.
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 6e62b86c..302ea2dc 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -509,8 +509,6 @@ debuginfod_query_server (debuginfod_client *c,
long loops = 0;
do
{
- CURLMcode curl_res;
-
if (c->progressfn) /* inform/check progress callback */
{
loops ++;
@@ -518,6 +516,7 @@ debuginfod_query_server (debuginfod_client *c,
long pb = 0;
if (target_handle) /* we've committed to a server; report its download progress */
{
+ CURLcode curl_res;
#ifdef CURLINFO_SIZE_DOWNLOAD_T
curl_off_t dl;
curl_res = curl_easy_getinfo(target_handle,
@@ -564,10 +563,10 @@ debuginfod_query_server (debuginfod_client *c,
if (data[i].handle != target_handle)
curl_multi_remove_handle(curlm, data[i].handle);
- curl_res = curl_multi_perform(curlm, &still_running);
- if (curl_res != CURLM_OK)
+ CURLMcode curlm_res = curl_multi_perform(curlm, &still_running);
+ if (curlm_res != CURLM_OK)
{
- switch (curl_res)
+ switch (curlm_res)
{
case CURLM_CALL_MULTI_PERFORM: continue;
case CURLM_OUT_OF_MEMORY: rc = -ENOMEM; break;

View File

@ -1,67 +0,0 @@
commit d8bad02afc7b7f30402b4e0e458df874a6d600da
Author: Mark Wielaard <mark@klomp.org>
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 <mark@klomp.org>
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));

View File

@ -1,593 +0,0 @@
commit 76ad56c430f0b85c47115688c511d9bd4fa671d4
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Wed Dec 4 15:51:12 2019 -0500
debuginfod: usability tweaks, incl. $DEBUGINFOD_PROGRESS client support
This facility allows a default progress-printing function to be
installed if the given environment variable is set. Some larger usage
experience (systemtap fetching kernels) indicates the default timeout
is too short, so forked it into a connection timeout (default short)
and a transfer timeout (default unlimited).
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index ab7b4e1..9a4a0e0 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -40,6 +40,7 @@
#include "config.h"
#include "debuginfod.h"
+#include "system.h"
#include <assert.h>
#include <dirent.h>
#include <stdio.h>
@@ -98,16 +99,16 @@ static const time_t cache_default_max_unused_age_s = 604800; /* 1 week */
static const char *cache_default_name = ".debuginfod_client_cache";
static const char *cache_path_envvar = DEBUGINFOD_CACHE_PATH_ENV_VAR;
-/* URLs of debuginfods, separated by url_delim.
- This env var must be set for debuginfod-client to run. */
+/* URLs of debuginfods, separated by url_delim. */
static const char *server_urls_envvar = DEBUGINFOD_URLS_ENV_VAR;
static const char *url_delim = " ";
static const char url_delim_char = ' ';
-/* Timeout for debuginfods, in seconds.
- This env var must be set for debuginfod-client to run. */
+/* Timeout for debuginfods, in seconds. */
static const char *server_timeout_envvar = DEBUGINFOD_TIMEOUT_ENV_VAR;
-static int server_timeout = 5;
+static const long default_connect_timeout = 5;
+static const long default_transfer_timeout = -1; /* unlimited */
+
/* Data associated with a particular CURL easy handle. Passed to
the write callback. */
@@ -400,8 +401,18 @@ debuginfod_query_server (debuginfod_client *c,
return fd;
}
- if (getenv(server_timeout_envvar))
- server_timeout = atoi (getenv(server_timeout_envvar));
+ long connect_timeout = default_connect_timeout;
+ long transfer_timeout = default_transfer_timeout;
+ const char* timeout_envvar = getenv(server_timeout_envvar);
+ if (timeout_envvar != NULL)
+ {
+ long ct, tt;
+ rc = sscanf(timeout_envvar, "%ld,%ld", &ct, &tt);
+ if (rc >= 1)
+ connect_timeout = ct;
+ if (rc >= 2)
+ transfer_timeout = tt;
+ }
/* make a copy of the envvar so it can be safely modified. */
server_urls = strdup(urls_envvar);
@@ -493,7 +504,10 @@ debuginfod_query_server (debuginfod_client *c,
CURLOPT_WRITEFUNCTION,
debuginfod_write_callback);
curl_easy_setopt(data[i].handle, CURLOPT_WRITEDATA, (void*)&data[i]);
- curl_easy_setopt(data[i].handle, CURLOPT_TIMEOUT, (long) server_timeout);
+ if (connect_timeout >= 0)
+ curl_easy_setopt(data[i].handle, CURLOPT_CONNECTTIMEOUT, connect_timeout);
+ if (transfer_timeout >= 0)
+ curl_easy_setopt(data[i].handle, CURLOPT_TIMEOUT, transfer_timeout);
curl_easy_setopt(data[i].handle, CURLOPT_FILETIME, (long) 1);
curl_easy_setopt(data[i].handle, CURLOPT_FOLLOWLOCATION, (long) 1);
curl_easy_setopt(data[i].handle, CURLOPT_FAILONERROR, (long) 1);
@@ -511,11 +525,32 @@ debuginfod_query_server (debuginfod_client *c,
long loops = 0;
do
{
+ /* Wait 1 second, the minimum DEBUGINFOD_TIMEOUT. */
+ curl_multi_wait(curlm, NULL, 0, 1000, NULL);
+
+ /* If the target file has been found, abort the other queries. */
+ if (target_handle != NULL)
+ for (int i = 0; i < num_urls; i++)
+ if (data[i].handle != target_handle)
+ curl_multi_remove_handle(curlm, data[i].handle);
+
+ CURLMcode curlm_res = curl_multi_perform(curlm, &still_running);
+ if (curlm_res != CURLM_OK)
+ {
+ switch (curlm_res)
+ {
+ case CURLM_CALL_MULTI_PERFORM: continue;
+ case CURLM_OUT_OF_MEMORY: rc = -ENOMEM; break;
+ default: rc = -ENETUNREACH; break;
+ }
+ goto out1;
+ }
+
if (c->progressfn) /* inform/check progress callback */
{
loops ++;
long pa = loops; /* default params for progress callback */
- long pb = 0;
+ long pb = 0; /* transfer_timeout tempting, but loops != elapsed-time */
if (target_handle) /* we've committed to a server; report its download progress */
{
CURLcode curl_res;
@@ -535,6 +570,8 @@ debuginfod_query_server (debuginfod_client *c,
pa = (dl > LONG_MAX ? LONG_MAX : (long)dl);
#endif
+ /* NB: If going through deflate-compressing proxies, this
+ number is likely to be unavailable, so -1 may show. */
#ifdef CURLINFO_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
curl_off_t cl;
curl_res = curl_easy_getinfo(target_handle,
@@ -555,27 +592,6 @@ debuginfod_query_server (debuginfod_client *c,
if ((*c->progressfn) (c, pa, pb))
break;
}
-
- /* Wait 1 second, the minimum DEBUGINFOD_TIMEOUT. */
- curl_multi_wait(curlm, NULL, 0, 1000, NULL);
-
- /* If the target file has been found, abort the other queries. */
- if (target_handle != NULL)
- for (int i = 0; i < num_urls; i++)
- if (data[i].handle != target_handle)
- curl_multi_remove_handle(curlm, data[i].handle);
-
- CURLMcode curlm_res = curl_multi_perform(curlm, &still_running);
- if (curlm_res != CURLM_OK)
- {
- switch (curlm_res)
- {
- case CURLM_CALL_MULTI_PERFORM: continue;
- case CURLM_OUT_OF_MEMORY: rc = -ENOMEM; break;
- default: rc = -ENETUNREACH; break;
- }
- goto out1;
- }
} while (still_running);
/* Check whether a query was successful. If so, assign its handle
@@ -674,9 +690,9 @@ debuginfod_query_server (debuginfod_client *c,
curl_multi_cleanup(curlm);
unlink (target_cache_tmppath);
+ close (fd); /* before the rmdir, otherwise it'll fail */
(void) rmdir (target_cache_dir); /* nop if not empty */
free(data);
- close (fd);
out0:
free (server_urls);
@@ -685,6 +701,22 @@ debuginfod_query_server (debuginfod_client *c,
return rc;
}
+
+/* Activate a basic form of progress tracing */
+static int
+default_progressfn (debuginfod_client *c, long a, long b)
+{
+ (void) c;
+
+ dprintf(STDERR_FILENO,
+ "Downloading from debuginfod %ld/%ld%s", a, b,
+ ((a == b) ? "\n" : "\r"));
+ /* XXX: include URL - stateful */
+
+ return 0;
+}
+
+
/* See debuginfod.h */
debuginfod_client *
debuginfod_begin (void)
@@ -693,7 +725,12 @@ debuginfod_begin (void)
size_t size = sizeof (struct debuginfod_client);
client = (debuginfod_client *) malloc (size);
if (client != NULL)
- client->progressfn = NULL;
+ {
+ if (getenv(DEBUGINFOD_PROGRESS_ENV_VAR))
+ client->progressfn = default_progressfn;
+ else
+ client->progressfn = NULL;
+ }
return client;
}
diff --git a/debuginfod/debuginfod.h b/debuginfod/debuginfod.h
index 6b1b1cc..33fae86 100644
--- a/debuginfod/debuginfod.h
+++ b/debuginfod/debuginfod.h
@@ -33,6 +33,7 @@
#define DEBUGINFOD_URLS_ENV_VAR "DEBUGINFOD_URLS"
#define DEBUGINFOD_CACHE_PATH_ENV_VAR "DEBUGINFOD_CACHE_PATH"
#define DEBUGINFOD_TIMEOUT_ENV_VAR "DEBUGINFOD_TIMEOUT"
+#define DEBUGINFOD_PROGRESS_ENV_VAR "DEBUGINFOD_PROGRESS"
/* Handle for debuginfod-client connection. */
typedef struct debuginfod_client debuginfod_client;
diff --git a/doc/debuginfod-find.1 b/doc/debuginfod-find.1
index a759ecb..023acbb 100644
--- a/doc/debuginfod-find.1
+++ b/doc/debuginfod-find.1
@@ -119,9 +119,13 @@ debuginfod instances. Alternate URL prefixes are separated by space.
.TP 21
.B DEBUGINFOD_TIMEOUT
-This environment variable governs the timeout for each debuginfod HTTP
-connection. A server that fails to respond within this many seconds
-is skipped. The default is 5.
+This environment variable governs the timeouts for each debuginfod
+HTTP connection. One or two comma-separated numbers may be given.
+The first is the number of seconds for the connection establishment
+(CURLOPT_CONNECTTIMEOUT), and the default is 5. The second is the
+number of seconds for the transfer completion (CURLOPT_TIMEOUT), and
+the default is no timeout. (Zero or negative also means "no
+timeout".)
.TP 21
.B DEBUGINFOD_CACHE_PATH
diff --git a/doc/debuginfod_find_debuginfo.3 b/doc/debuginfod_find_debuginfo.3
index be8eed0..ea8c616 100644
--- a/doc/debuginfod_find_debuginfo.3
+++ b/doc/debuginfod_find_debuginfo.3
@@ -163,9 +163,21 @@ debuginfod instances. Alternate URL prefixes are separated by space.
.TP 21
.B DEBUGINFOD_TIMEOUT
-This environment variable governs the timeout for each debuginfod HTTP
-connection. A server that fails to respond within this many seconds
-is skipped. The default is 5.
+This environment variable governs the timeouts for each debuginfod
+HTTP connection. One or two comma-separated numbers may be given.
+The first is the number of seconds for the connection establishment
+(CURLOPT_CONNECTTIMEOUT), and the default is 5. The second is the
+number of seconds for the transfer completion (CURLOPT_TIMEOUT), and
+the default is no timeout. (Zero or negative also means "no
+timeout".)
+
+.TP 21
+.B DEBUGINFOD_PROGRESS
+This environment variable governs the default progress function. If
+set, and if a progressfn is not explicitly set, then the library will
+configure a default progressfn. This function will append a simple
+progress message periodically to the given file. Consider using
+"/dev/stderr" on platforms that support it. The default is nothing.
.TP 21
.B DEBUGINFOD_CACHE_PATH
diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh
index 6533996..4cf6138 100755
--- a/tests/run-debuginfod-find.sh
+++ b/tests/run-debuginfod-find.sh
@@ -89,7 +89,7 @@ wait_ready $PORT1 'ready' 1
export DEBUGINFOD_URLS=http://127.0.0.1:$PORT1/ # or without trailing /
# Be patient when run on a busy machine things might take a bit.
-export DEBUGINFOD_TIMEOUT=10
+export DEBUGINFOD_TIMEOUT=1,10
# We use -t0 and -g0 here to turn off time-based scanning & grooming.
# For testing purposes, we just sic SIGUSR1 / SIGUSR2 at the process.
@@ -153,8 +153,11 @@ cmp $filename F/prog2
cat vlog
grep -q Progress vlog
tempfiles vlog
-filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $BUILDID2`
+filename=`testrun env DEBUGINFOD_PROGRESS=1 ${abs_top_builddir}/debuginfod/debuginfod-find executable $BUILDID2 2>vlog2`
cmp $filename F/prog2
+cat vlog2
+grep -q Downloading vlog2
+tempfiles vlog2
filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find source $BUILDID2 ${PWD}/prog2.c`
cmp $filename ${PWD}/prog2.c
commit 288c76775f2d27976eb269e568b53c742d973dbc
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Mon Jan 6 04:29:21 2020 -0500
debuginfod: pass a distro-summary User-Agent request header
It may be useful for a debuginfod server operator to know what kinds
of clients make webapi requests. This is mainly as a
telemetry/diagnostic (though the data cannot be really trusted). It
may also be useful to automate downloading of distro packages to a
debuginfod server in the case of an unknown hex buildid. doc/testing
not affected as these are diagnostics.
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 9a4a0e0..66ccb21 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1,5 +1,5 @@
/* Retrieve ELF / DWARF / source files from the debuginfod.
- Copyright (C) 2019 Red Hat, Inc.
+ Copyright (C) 2019-2020 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -58,6 +58,7 @@
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/utsname.h>
#include <curl/curl.h>
/* If fts.h is included before config.h, its indirect inclusions may not
@@ -279,6 +280,87 @@ debuginfod_clean_cache(debuginfod_client *c,
#define MAX_BUILD_ID_BYTES 64
+static void
+add_extra_headers(CURL *handle)
+{
+ /* Compute a User-Agent: string to send. The more accurately this
+ describes this host, the likelier that the debuginfod servers
+ might be able to locate debuginfo for us. */
+
+ char* utspart = NULL;
+ struct utsname uts;
+ int rc = 0;
+ rc = uname (&uts);
+ if (rc == 0)
+ rc = asprintf(& utspart, "%s/%s", uts.sysname, uts.machine);
+ if (rc < 0)
+ utspart = NULL;
+
+ FILE *f = fopen ("/etc/os-release", "r");
+ if (f == NULL)
+ f = fopen ("/usr/lib/os-release", "r");
+ char *id = NULL;
+ char *version = NULL;
+ if (f != NULL)
+ {
+ while (id == NULL || version == NULL)
+ {
+ char buf[128];
+ char *s = &buf[0];
+ if (fgets (s, sizeof(buf), f) == NULL)
+ break;
+
+ int len = strlen (s);
+ if (len < 3)
+ continue;
+ if (s[len - 1] == '\n')
+ {
+ s[len - 1] = '\0';
+ len--;
+ }
+
+ char *v = strchr (s, '=');
+ if (v == NULL || strlen (v) < 2)
+ continue;
+
+ /* Split var and value. */
+ *v = '\0';
+ v++;
+
+ /* Remove optional quotes around value string. */
+ if (*v == '"' || *v == '\'')
+ {
+ v++;
+ s[len - 1] = '\0';
+ }
+ if (strcmp (s, "ID") == 0)
+ id = strdup (v);
+ if (strcmp (s, "VERSION_ID") == 0)
+ version = strdup (v);
+ }
+ fclose (f);
+ }
+
+ char *ua = NULL;
+ rc = asprintf(& ua, "%s/%s,%s,%s/%s",
+ PACKAGE_NAME, PACKAGE_VERSION,
+ utspart ?: "",
+ id ?: "",
+ version ?: "");
+ if (rc < 0)
+ ua = NULL;
+
+ if (ua)
+ curl_easy_setopt(handle, CURLOPT_USERAGENT, (void*) ua); /* implicit strdup */
+
+ free (ua);
+ free (id);
+ free (version);
+ free (utspart);
+}
+
+
+
/* Query each of the server URLs found in $DEBUGINFOD_URLS for the file
with the specified build-id, type (debuginfo, executable or source)
and filename. filename may be NULL. If found, return a file
@@ -514,7 +596,7 @@ debuginfod_query_server (debuginfod_client *c,
curl_easy_setopt(data[i].handle, CURLOPT_NOSIGNAL, (long) 1);
curl_easy_setopt(data[i].handle, CURLOPT_AUTOREFERER, (long) 1);
curl_easy_setopt(data[i].handle, CURLOPT_ACCEPT_ENCODING, "");
- curl_easy_setopt(data[i].handle, CURLOPT_USERAGENT, (void*) PACKAGE_STRING);
+ add_extra_headers(data[i].handle);
curl_multi_add_handle(curlm, data[i].handle);
server_url = strtok_r(NULL, url_delim, &strtok_saveptr);
commit b8d85ed024a745cff05e56c6337d95d654d5294a
Author: Mark Wielaard <mark@klomp.org>
Date: Thu Jan 2 17:02:42 2020 +0100
debuginfod: Use DEBUGINFOD_TIMEOUT as seconds to get at least 100K.
Use just one timeout using CURLOPT_LOW_SPEED_TIME (default 90 seconds)
and CURLOPT_LOW_SPEED_LIMIT (100K).
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 66ccb21..e5a2e82 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -105,10 +105,9 @@ static const char *server_urls_envvar = DEBUGINFOD_URLS_ENV_VAR;
static const char *url_delim = " ";
static const char url_delim_char = ' ';
-/* Timeout for debuginfods, in seconds. */
+/* Timeout for debuginfods, in seconds (to get at least 100K). */
static const char *server_timeout_envvar = DEBUGINFOD_TIMEOUT_ENV_VAR;
-static const long default_connect_timeout = 5;
-static const long default_transfer_timeout = -1; /* unlimited */
+static const long default_timeout = 90;
/* Data associated with a particular CURL easy handle. Passed to
@@ -483,18 +482,10 @@ debuginfod_query_server (debuginfod_client *c,
return fd;
}
- long connect_timeout = default_connect_timeout;
- long transfer_timeout = default_transfer_timeout;
+ long timeout = default_timeout;
const char* timeout_envvar = getenv(server_timeout_envvar);
if (timeout_envvar != NULL)
- {
- long ct, tt;
- rc = sscanf(timeout_envvar, "%ld,%ld", &ct, &tt);
- if (rc >= 1)
- connect_timeout = ct;
- if (rc >= 2)
- transfer_timeout = tt;
- }
+ timeout = atoi (timeout_envvar);
/* make a copy of the envvar so it can be safely modified. */
server_urls = strdup(urls_envvar);
@@ -586,10 +577,15 @@ debuginfod_query_server (debuginfod_client *c,
CURLOPT_WRITEFUNCTION,
debuginfod_write_callback);
curl_easy_setopt(data[i].handle, CURLOPT_WRITEDATA, (void*)&data[i]);
- if (connect_timeout >= 0)
- curl_easy_setopt(data[i].handle, CURLOPT_CONNECTTIMEOUT, connect_timeout);
- if (transfer_timeout >= 0)
- curl_easy_setopt(data[i].handle, CURLOPT_TIMEOUT, transfer_timeout);
+ if (timeout > 0)
+ {
+ /* Make sure there is at least some progress,
+ try to get at least 100K per timeout seconds. */
+ curl_easy_setopt (data[i].handle, CURLOPT_LOW_SPEED_TIME,
+ timeout);
+ curl_easy_setopt (data[i].handle, CURLOPT_LOW_SPEED_LIMIT,
+ 100 * 1024L);
+ }
curl_easy_setopt(data[i].handle, CURLOPT_FILETIME, (long) 1);
curl_easy_setopt(data[i].handle, CURLOPT_FOLLOWLOCATION, (long) 1);
curl_easy_setopt(data[i].handle, CURLOPT_FAILONERROR, (long) 1);
diff --git a/doc/debuginfod-find.1 b/doc/debuginfod-find.1
index 023acbb..e71ca29 100644
--- a/doc/debuginfod-find.1
+++ b/doc/debuginfod-find.1
@@ -119,13 +119,10 @@ debuginfod instances. Alternate URL prefixes are separated by space.
.TP 21
.B DEBUGINFOD_TIMEOUT
-This environment variable governs the timeouts for each debuginfod
-HTTP connection. One or two comma-separated numbers may be given.
-The first is the number of seconds for the connection establishment
-(CURLOPT_CONNECTTIMEOUT), and the default is 5. The second is the
-number of seconds for the transfer completion (CURLOPT_TIMEOUT), and
-the default is no timeout. (Zero or negative also means "no
-timeout".)
+This environment variable governs the timeout for each debuginfod HTTP
+connection. A server that fails to provide at least 100K of data
+within this many seconds is skipped. The default is 90 seconds. (Zero
+or negative means "no timeout".)
.TP 21
.B DEBUGINFOD_CACHE_PATH
diff --git a/doc/debuginfod.8 b/doc/debuginfod.8
index 342f524..6184bcc 100644
--- a/doc/debuginfod.8
+++ b/doc/debuginfod.8
@@ -366,8 +366,10 @@ or indirectly - the results would be hilarious.
.TP 21
.B DEBUGINFOD_TIMEOUT
This environment variable governs the timeout for each debuginfod HTTP
-connection. A server that fails to respond within this many seconds
-is skipped. The default is 5.
+connection. A server that fails to provide at least 100K of data
+within this many seconds is skipped. The default is 90 seconds. (Zero
+or negative means "no timeout".)
+
.TP 21
.B DEBUGINFOD_CACHE_PATH
diff --git a/doc/debuginfod_find_debuginfo.3 b/doc/debuginfod_find_debuginfo.3
index ea8c616..f6ea7a4 100644
--- a/doc/debuginfod_find_debuginfo.3
+++ b/doc/debuginfod_find_debuginfo.3
@@ -163,13 +163,10 @@ debuginfod instances. Alternate URL prefixes are separated by space.
.TP 21
.B DEBUGINFOD_TIMEOUT
-This environment variable governs the timeouts for each debuginfod
-HTTP connection. One or two comma-separated numbers may be given.
-The first is the number of seconds for the connection establishment
-(CURLOPT_CONNECTTIMEOUT), and the default is 5. The second is the
-number of seconds for the transfer completion (CURLOPT_TIMEOUT), and
-the default is no timeout. (Zero or negative also means "no
-timeout".)
+This environment variable governs the timeout for each debuginfod HTTP
+connection. A server that fails to provide at least 100K of data
+within this many seconds is skipped. The default is 90 seconds. (Zero
+or negative means "no timeout".)
.TP 21
.B DEBUGINFOD_PROGRESS
diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh
index 90dafe0..4ab47a3 100755
--- a/tests/run-debuginfod-find.sh
+++ b/tests/run-debuginfod-find.sh
@@ -94,7 +94,7 @@ wait_ready $PORT1 'ready' 1
export DEBUGINFOD_URLS=http://127.0.0.1:$PORT1/ # or without trailing /
# Be patient when run on a busy machine things might take a bit.
-export DEBUGINFOD_TIMEOUT=1,10
+export DEBUGINFOD_TIMEOUT=10
# We use -t0 and -g0 here to turn off time-based scanning & grooming.
# For testing purposes, we just sic SIGUSR1 / SIGUSR2 at the process.
commit 6f2098114a1acbd5e320a1c5fabfa07df02b14fd
Author: Mark Wielaard <mark@klomp.org>
Date: Fri Jan 10 15:46:29 2020 +0100
doc: Fix DEBUGINFOD_PROGRESS description to just mention output on stderr.
An earlier variant of the default progress function could write to any
file. Which is still in the documentation. But the actual implementation
just uses stderr. Fix the documentation to match.
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/doc/debuginfod_find_debuginfo.3 b/doc/debuginfod_find_debuginfo.3
index f6ea7a4..7e5060f 100644
--- a/doc/debuginfod_find_debuginfo.3
+++ b/doc/debuginfod_find_debuginfo.3
@@ -173,8 +173,8 @@ or negative means "no timeout".)
This environment variable governs the default progress function. If
set, and if a progressfn is not explicitly set, then the library will
configure a default progressfn. This function will append a simple
-progress message periodically to the given file. Consider using
-"/dev/stderr" on platforms that support it. The default is nothing.
+progress message periodically to stderr. The default is no progress
+function output.
.TP 21
.B DEBUGINFOD_CACHE_PATH

View File

@ -1,146 +0,0 @@
commit 985550a5b24009e9cb9e511f6d320f3ac1b6bf99
Author: Mark Wielaard <mark@klomp.org>
Date: Wed Jan 8 15:04:50 2020 +0100
libasm.h: Don't include libebl.h. Define an opaque Ebl handle.
Using libasm isn't really usable without a way to create an Ebl handle.
But we don't support libebl.h (and libebl itself). Just define the
Ebl handle as an opaque struct. Code that uses it needs to figure out
how to instantiate one itself (they cannot in any supportable way...)
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/libasm/libasm.h b/libasm/libasm.h
index 5c61224..a45c9fa 100644
--- a/libasm/libasm.h
+++ b/libasm/libasm.h
@@ -32,7 +32,7 @@
#include <stdbool.h>
#include <stdint.h>
-#include <libebl.h>
+typedef struct ebl Ebl;
/* Opaque type for the assembler context descriptor. */
diff --git a/libasm/libasmP.h b/libasm/libasmP.h
index 54460cf..a4703fc 100644
--- a/libasm/libasmP.h
+++ b/libasm/libasmP.h
@@ -31,6 +31,7 @@
#include <stdio.h>
+#include "libebl.h"
#include <libasm.h>
#include "libdwelf.h"
diff --git a/tests/asm-tst1.c b/tests/asm-tst1.c
index 9afc676..cdf2a92 100644
--- a/tests/asm-tst1.c
+++ b/tests/asm-tst1.c
@@ -20,6 +20,7 @@
#endif
#include <fcntl.h>
+#include ELFUTILS_HEADER(ebl)
#include ELFUTILS_HEADER(asm)
#include <libelf.h>
#include <stdio.h>
diff --git a/tests/asm-tst2.c b/tests/asm-tst2.c
index 2556d0c..9e88b70 100644
--- a/tests/asm-tst2.c
+++ b/tests/asm-tst2.c
@@ -20,6 +20,7 @@
#endif
#include <fcntl.h>
+#include ELFUTILS_HEADER(ebl)
#include ELFUTILS_HEADER(asm)
#include <libelf.h>
#include <stdio.h>
diff --git a/tests/asm-tst3.c b/tests/asm-tst3.c
index e52cfbe..39c1d90 100644
--- a/tests/asm-tst3.c
+++ b/tests/asm-tst3.c
@@ -20,6 +20,7 @@
#endif
#include <fcntl.h>
+#include ELFUTILS_HEADER(ebl)
#include ELFUTILS_HEADER(asm)
#include <libelf.h>
#include <stdio.h>
diff --git a/tests/asm-tst4.c b/tests/asm-tst4.c
index 52e9e20..5114938 100644
--- a/tests/asm-tst4.c
+++ b/tests/asm-tst4.c
@@ -20,6 +20,7 @@
#endif
#include <fcntl.h>
+#include ELFUTILS_HEADER(ebl)
#include ELFUTILS_HEADER(asm)
#include <libelf.h>
#include <stdio.h>
diff --git a/tests/asm-tst5.c b/tests/asm-tst5.c
index 5a29b01..dcb852f 100644
--- a/tests/asm-tst5.c
+++ b/tests/asm-tst5.c
@@ -20,6 +20,7 @@
#endif
#include <fcntl.h>
+#include ELFUTILS_HEADER(ebl)
#include ELFUTILS_HEADER(asm)
#include <libelf.h>
#include <stdio.h>
diff --git a/tests/asm-tst6.c b/tests/asm-tst6.c
index bd9b362..829cd90 100644
--- a/tests/asm-tst6.c
+++ b/tests/asm-tst6.c
@@ -19,6 +19,7 @@
# include <config.h>
#endif
+#include ELFUTILS_HEADER(ebl)
#include ELFUTILS_HEADER(asm)
#include <libelf.h>
#include <stdio.h>
diff --git a/tests/asm-tst7.c b/tests/asm-tst7.c
index 00cb2bf..9017976 100644
--- a/tests/asm-tst7.c
+++ b/tests/asm-tst7.c
@@ -21,6 +21,7 @@
#include <fcntl.h>
#include <inttypes.h>
+#include ELFUTILS_HEADER(ebl)
#include ELFUTILS_HEADER(asm)
#include <libelf.h>
#include <stdio.h>
diff --git a/tests/asm-tst8.c b/tests/asm-tst8.c
index 4fb0d99..a65509f 100644
--- a/tests/asm-tst8.c
+++ b/tests/asm-tst8.c
@@ -21,6 +21,7 @@
#include <fcntl.h>
#include <inttypes.h>
+#include ELFUTILS_HEADER(ebl)
#include ELFUTILS_HEADER(asm)
#include <libelf.h>
#include <stdio.h>
diff --git a/tests/asm-tst9.c b/tests/asm-tst9.c
index b6d0e43..681e872 100644
--- a/tests/asm-tst9.c
+++ b/tests/asm-tst9.c
@@ -21,6 +21,7 @@
#include <fcntl.h>
#include <inttypes.h>
+#include ELFUTILS_HEADER(ebl)
#include ELFUTILS_HEADER(asm)
#include <libelf.h>
#include <stdio.h>

View File

@ -1,18 +0,0 @@
diff --git a/src/elflint.c b/src/elflint.c
index 810c8bd..1acf1bc 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -4483,8 +4483,13 @@ only executables, shared objects, and core files can have program headers\n"));
continue;
}
+#ifndef PT_GNU_PROPERTY
+#define PT_GNU_PROPERTY (PT_LOOS + 0x474e553)
+#endif
+
if (phdr->p_type >= PT_NUM && phdr->p_type != PT_GNU_EH_FRAME
&& phdr->p_type != PT_GNU_STACK && phdr->p_type != PT_GNU_RELRO
+ && phdr->p_type != PT_GNU_PROPERTY
/* Check for a known machine-specific type. */
&& ebl_segment_type_name (ebl, phdr->p_type, NULL, 0) == NULL)
ERROR (gettext ("\

View File

@ -1,6 +1,6 @@
Name: elfutils
Version: 0.178
%global baserelease 7
Version: 0.180
%global baserelease 1
Release: %{baserelease}%{?dist}
URL: http://elfutils.org/
%global source_url ftp://sourceware.org/pub/elfutils/%{version}/
@ -42,6 +42,7 @@ BuildRequires: pkgconfig(libarchive) >= 3.1.2
BuildRequires: bzip2
# For the run-debuginfod-find.sh test case in %check for /usr/sbin/ss
BuildRequires: iproute
BuildRequires: bsdtar
BuildRequires: curl
%global _gnu %{nil}
@ -54,12 +55,6 @@ BuildRequires: curl
%endif
# Patches
Patch1: elfutils-0.178-pt-gnu-prop.patch
Patch2: elfutils-0.178-debuginfod-no-cache.patch
Patch3: elfutils-0.178-curl-code-gcc-10.patch
Patch4: elfutils-0.178-compressed-vmlinuz.patch
Patch5: elfutils-0.178-debuginfod-timeoutprogress.patch
Patch6: elfutils-0.178-libasm-ebl.patch
%description
Elfutils is a collection of utilities, including stack (to show
@ -227,8 +222,8 @@ Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires(pre): shadow-utils
# For /usr/bin/cpio2rpm
Requires: rpm
# To extract .deb files with a bsdtar (= libarchive) subshell
Requires: bsdtar
%description debuginfod-client
The elfutils-debuginfod-client package contains shared libraries
@ -251,12 +246,6 @@ such servers to download those files on demand.
%setup -q
# Apply patches
%patch1 -p1 -b .pt-gnu-prop
%patch2 -p1 -b .debuginfod-client-cache
%patch3 -p1 -b .curl-gcc-10
%patch4 -p1 -b .vmlinuz
%patch5 -p1 -b .debuginfod-timeout-progress
%patch6 -p1 -b .libasm-ebl
# In case the above patches added any new test scripts, make sure they
# are executable.
@ -434,6 +423,9 @@ exit 0
%systemd_postun_with_restart debuginfod.service
%changelog
* Thu Jun 11 2020 Mark Wielaard <mjw@redhat.com> - 0.180-1
- New upstream release.
* Fri Jan 10 2020 Mark Wielaard <mjw@redhat.com> - 0.178-7
- Add elfutils-0.178-debuginfod-timeoutprogress.patch
- Add elfutils-0.178-libasm-ebl.patch