import elfutils-0.188-3.el9

This commit is contained in:
CentOS Sources 2023-05-09 05:36:08 +00:00 committed by Stepan Oksanichenko
parent f9ed631c7f
commit 0e108139ca
11 changed files with 359 additions and 311 deletions

View File

@ -1 +1 @@
2c529212fff4b54e890cb3cf33f93b5f39eda5ab SOURCES/elfutils-0.187.tar.bz2 5e23c010b7f9f45140a43e95d8d1f7fb04aa8302 SOURCES/elfutils-0.188.tar.bz2

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/elfutils-0.187.tar.bz2 SOURCES/elfutils-0.188.tar.bz2

View File

@ -1,28 +0,0 @@
commit f1252e4dbe781f75d806ce0b990779548eeeb7a9
Author: Mark Wielaard <mark@klomp.org>
Date: Tue May 3 17:48:55 2022 +0200
config: Move the 2>/dev/null inside the sh -c '' quotes for profile.csh.
csh/tcsh would warn about "Ambiguous output redirect" if not done inside
the sh -c command.
Fix-by: наб <nabijaczleweli@nabijaczleweli.xyz>
https://bugzilla.redhat.com/show_bug.cgi?id=2080957
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/config/profile.csh.in b/config/profile.csh.in
index 012e243a..74c20c99 100644
--- a/config/profile.csh.in
+++ b/config/profile.csh.in
@@ -6,7 +6,7 @@
if (! $?DEBUGINFOD_URLS) then
set prefix="@prefix@"
- set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls; :' "@sysconfdir@/debuginfod" 2>/dev/null | tr '\n' ' '`
+ set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls 2>/dev/null; :' "@sysconfdir@/debuginfod" | tr '\n' ' '`
if ( "$DEBUGINFOD_URLS" != "" ) then
setenv DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
else

View File

@ -1,98 +0,0 @@
commit 59158656f3b0b99d8784ddc82c15778813000edc
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Wed May 4 10:26:42 2022 -0400
PR29117: fix fd leak in debuginfod client for cache-miss files
Correct a nasty fd leak and a few less nasty leaks in the debuginfod
client code. The nasty one impacts long-lived apps such as debuginfod
servers.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index ea6e461a..521972e4 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -243,7 +243,13 @@ debuginfod_config_cache(char *config_path,
return -errno;
if (dprintf(fd, "%ld", cache_config_default_s) < 0)
- return -errno;
+ {
+ int ret = -errno;
+ close (fd);
+ return ret;
+ }
+
+ close (fd);
}
long cache_config;
@@ -284,7 +290,13 @@ debuginfod_init_cache (char *cache_path, char *interval_path, char *maxage_path)
return -errno;
if (dprintf(fd, "%ld", cache_clean_default_interval_s) < 0)
- return -errno;
+ {
+ int ret = -errno;
+ close (fd);
+ return ret;
+ }
+
+ close (fd);
/* init max age config file. */
if (stat(maxage_path, &st) != 0
@@ -292,8 +304,13 @@ debuginfod_init_cache (char *cache_path, char *interval_path, char *maxage_path)
return -errno;
if (dprintf(fd, "%ld", cache_default_max_unused_age_s) < 0)
- return -errno;
+ {
+ int ret = -errno;
+ close (fd);
+ return ret;
+ }
+ close (fd);
return 0;
}
@@ -812,18 +829,17 @@ debuginfod_query_server (debuginfod_client *c,
has passed since the last attempt. */
time_t cache_miss;
time_t target_mtime = st.st_mtime;
+
+ close(fd); /* no need to hold onto the negative-hit file descriptor */
+
rc = debuginfod_config_cache(cache_miss_path,
cache_miss_default_s, &st);
if (rc < 0)
- {
- close(fd);
- goto out;
- }
+ goto out;
cache_miss = (time_t)rc;
if (time(NULL) - target_mtime <= cache_miss)
{
- close(fd);
rc = -ENOENT;
goto out;
}
diff --git a/debuginfod/debuginfod-find.c b/debuginfod/debuginfod-find.c
index 3e8ab203..f60b5463 100644
--- a/debuginfod/debuginfod-find.c
+++ b/debuginfod/debuginfod-find.c
@@ -231,6 +231,8 @@ main(int argc, char** argv)
fprintf(stderr, "Server query failed: %s\n", strerror(-rc));
return 1;
}
+ else
+ close (rc);
printf("%s\n", cache_name);
free (cache_name);

View File

@ -1,51 +0,0 @@
commit 28f9d86ea89f88b24f1d12c8e9d5ddc3f77da194
Author: Mark Wielaard <mark@klomp.org>
Date: Fri May 6 00:29:28 2022 +0200
debuginfod: Use MHD_USE_EPOLL for libmicrohttpd version 0.9.51 or higher
Also disable MHD_USE_THREAD_PER_CONNECTION when using MHD_USE_EPOLL.
https://sourceware.org/bugzilla/show_bug.cgi?id=29123
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index c02540f1..d4f47bf7 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -1,6 +1,6 @@
/* Debuginfo-over-http server.
Copyright (C) 2019-2021 Red Hat, Inc.
- Copyright (C) 2021 Mark J. Wielaard <mark@klomp.org>
+ Copyright (C) 2021, 2022 Mark J. Wielaard <mark@klomp.org>
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -3899,7 +3899,14 @@ main (int argc, char *argv[])
}
}
- unsigned int mhd_flags = ((connection_pool
+ /* Note that MHD_USE_EPOLL and MHD_USE_THREAD_PER_CONNECTION don't
+ work together. */
+ unsigned int use_epoll = 0;
+#if MHD_VERSION >= 0x00095100
+ use_epoll = MHD_USE_EPOLL;
+#endif
+
+ unsigned int mhd_flags = ((connection_pool || use_epoll
? 0 : MHD_USE_THREAD_PER_CONNECTION)
#if MHD_VERSION >= 0x00095300
| MHD_USE_INTERNAL_POLLING_THREAD
@@ -3907,9 +3914,7 @@ main (int argc, char *argv[])
| MHD_USE_SELECT_INTERNALLY
#endif
| MHD_USE_DUAL_STACK
-#ifdef MHD_USE_EPOLL
- | MHD_USE_EPOLL
-#endif
+ | use_epoll
#if MHD_VERSION >= 0x00095200
| MHD_USE_ITC
#endif

View File

@ -1,118 +0,0 @@
commit ba675ed25a26fd425ffd19b02cf18babf4291b4f
Author: Mark Wielaard <mark@klomp.org>
Date: Thu May 5 23:59:57 2022 +0200
debuginfod: Try without MHD_USE_DUAL_STACK if MHD_start_daemon fails
On a systems that have ipv6 disabled debuginfod doesn't start up
anymore because libhttpd MHD_USE_DUAL_STACK only works if it can
open an ipv6 socket. If MHD_start_daemon with MHD_USE_DUAL_STACK
fails try again without that flag set.
https://sourceware.org/bugzilla/show_bug.cgi?id=29122
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 4aaf41c0..c02540f1 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -3899,40 +3899,67 @@ main (int argc, char *argv[])
}
}
- // Start httpd server threads. Use a single dual-homed pool.
- MHD_Daemon *d46 = MHD_start_daemon ((connection_pool ? 0 : MHD_USE_THREAD_PER_CONNECTION)
+ unsigned int mhd_flags = ((connection_pool
+ ? 0 : MHD_USE_THREAD_PER_CONNECTION)
#if MHD_VERSION >= 0x00095300
- | MHD_USE_INTERNAL_POLLING_THREAD
+ | MHD_USE_INTERNAL_POLLING_THREAD
#else
- | MHD_USE_SELECT_INTERNALLY
+ | MHD_USE_SELECT_INTERNALLY
#endif
+ | MHD_USE_DUAL_STACK
#ifdef MHD_USE_EPOLL
- | MHD_USE_EPOLL
+ | MHD_USE_EPOLL
#endif
- | MHD_USE_DUAL_STACK
#if MHD_VERSION >= 0x00095200
- | MHD_USE_ITC
+ | MHD_USE_ITC
#endif
- | MHD_USE_DEBUG, /* report errors to stderr */
- http_port,
- NULL, NULL, /* default accept policy */
- handler_cb, NULL, /* handler callback */
- MHD_OPTION_EXTERNAL_LOGGER, error_cb, NULL,
- (connection_pool ? MHD_OPTION_THREAD_POOL_SIZE : MHD_OPTION_END),
- (connection_pool ? (int)connection_pool : MHD_OPTION_END),
- MHD_OPTION_END);
+ | MHD_USE_DEBUG); /* report errors to stderr */
+ // Start httpd server threads. Use a single dual-homed pool.
+ MHD_Daemon *d46 = MHD_start_daemon (mhd_flags, http_port,
+ NULL, NULL, /* default accept policy */
+ handler_cb, NULL, /* handler callback */
+ MHD_OPTION_EXTERNAL_LOGGER,
+ error_cb, NULL,
+ (connection_pool
+ ? MHD_OPTION_THREAD_POOL_SIZE
+ : MHD_OPTION_END),
+ (connection_pool
+ ? (int)connection_pool
+ : MHD_OPTION_END),
+ MHD_OPTION_END);
+
+ MHD_Daemon *d4 = NULL;
if (d46 == NULL)
{
- sqlite3 *database = db;
- sqlite3 *databaseq = dbq;
- db = dbq = 0; // for signal_handler not to freak
- sqlite3_close (databaseq);
- sqlite3_close (database);
- error (EXIT_FAILURE, 0, "cannot start http server at port %d", http_port);
- }
+ // Cannot use dual_stack, use ipv4 only
+ mhd_flags &= ~(MHD_USE_DUAL_STACK);
+ d4 = MHD_start_daemon (mhd_flags, http_port,
+ NULL, NULL, /* default accept policy */
+ handler_cb, NULL, /* handler callback */
+ MHD_OPTION_EXTERNAL_LOGGER,
+ error_cb, NULL,
+ (connection_pool
+ ? MHD_OPTION_THREAD_POOL_SIZE
+ : MHD_OPTION_END),
+ (connection_pool
+ ? (int)connection_pool
+ : MHD_OPTION_END),
+ MHD_OPTION_END);
+ if (d4 == NULL)
+ {
+ sqlite3 *database = db;
+ sqlite3 *databaseq = dbq;
+ db = dbq = 0; // for signal_handler not to freak
+ sqlite3_close (databaseq);
+ sqlite3_close (database);
+ error (EXIT_FAILURE, 0, "cannot start http server at port %d",
+ http_port);
+ }
- obatched(clog) << "started http server on IPv4 IPv6 "
+ }
+ obatched(clog) << "started http server on"
+ << (d4 != NULL ? " IPv4 " : " IPv4 IPv6 ")
<< "port=" << http_port << endl;
// add maxigroom sql if -G given
@@ -4053,6 +4080,7 @@ main (int argc, char *argv[])
/* Stop all the web service threads. */
if (d46) MHD_stop_daemon (d46);
+ if (d4) MHD_stop_daemon (d4);
if (! passive_p)
{

View File

@ -0,0 +1,109 @@
commit 75f2de448f311807e2493f2a37a980e2d872b229
Author: Mark Wielaard <mark@klomp.org>
Date: Thu Nov 3 13:38:45 2022 +0100
readelf: Check phdr != NULL or shdr != NULL in handle_dynamic.
The compiler doesn't know that when use_dynamic_segment is true,
then phdr should/will be non-NULL and otherwise shdr is non-NULL.
Add explicit checks to help the compiler out and in case an error
is made calling the handle_dynamic function.
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/src/readelf.c b/src/readelf.c
index 0e0b05c4..e721a209 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -1828,7 +1828,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr)
size_t dyn_ents;
/* Get the data of the section. */
- if (use_dynamic_segment)
+ if (use_dynamic_segment && phdr != NULL)
data = elf_getdata_rawchunk(ebl->elf, phdr->p_offset,
phdr->p_filesz, ELF_T_DYN);
else
@@ -1840,7 +1840,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr)
/* Get the dynamic section entry number */
dyn_ents = get_dyn_ents (data);
- if (!use_dynamic_segment)
+ if (!use_dynamic_segment && shdr != NULL)
{
/* Get the section header string table index. */
if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
@@ -1862,7 +1862,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr)
(int) shdr->sh_link,
elf_strptr (ebl->elf, shstrndx, glink->sh_name));
}
- else
+ else if (phdr != NULL)
{
printf (ngettext ("\
\nDynamic segment contains %lu entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 "\n",
@@ -1879,7 +1879,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr)
/* if --use-dynamic option is enabled,
use the string table to get the related library info. */
Elf_Data *strtab_data = NULL;
- if (use_dynamic_segment)
+ if (use_dynamic_segment && phdr != NULL)
{
strtab_data = get_dynscn_strtab(ebl->elf, phdr);
if (strtab_data == NULL)
@@ -1903,7 +1903,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr)
|| dyn->d_tag == DT_RPATH
|| dyn->d_tag == DT_RUNPATH)
{
- if (! use_dynamic_segment)
+ if (! use_dynamic_segment && shdr != NULL)
name = elf_strptr (ebl->elf, shdr->sh_link, dyn->d_un.d_val);
else if (dyn->d_un.d_val < strtab_data->d_size
&& memrchr (strtab_data->d_buf + dyn->d_un.d_val, '\0',
commit b0a0235771906e3bcd6174c4e3c020b5522b0be5
Author: Mark Wielaard <mark@klomp.org>
Date: Thu Nov 3 13:44:35 2022 +0100
libdw: Don't dereference and assign values we are skipping
We don't use the FDE address encoding byte, so no reason
to read and store it. Just skip past it.
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/libdw/dwarf_next_cfi.c b/libdw/dwarf_next_cfi.c
index 23b16885..be08984f 100644
--- a/libdw/dwarf_next_cfi.c
+++ b/libdw/dwarf_next_cfi.c
@@ -226,7 +226,7 @@ dwarf_next_cfi (const unsigned char e_ident[],
if (sized_augmentation)
{
/* Skip FDE address encoding byte. */
- encoding = *bytes++;
+ bytes++;
continue;
}
break;
commit 52a6a3110e019d696284fdd822c2a2f0987dded2
Author: Mark Wielaard <mark@klomp.org>
Date: Thu Nov 3 13:52:32 2022 +0100
readelf: Check gelf_getdyn doesn't return NULL
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/src/readelf.c b/src/readelf.c
index e721a209..3dafb041 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -4910,7 +4910,7 @@ get_dynscn_addrs(Elf *elf, GElf_Phdr *phdr, GElf_Addr addrs[i_max])
GElf_Dyn dyn_mem;
GElf_Dyn *dyn = gelf_getdyn(data, dyn_idx, &dyn_mem);
/* DT_NULL Marks end of dynamic section. */
- if (dyn->d_tag == DT_NULL)
+ if (dyn == NULL || dyn->d_tag == DT_NULL)
break;
switch (dyn->d_tag) {

View File

@ -0,0 +1,171 @@
commit c424e5f3d24f76e01242d15ba361dc6234706fed
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Thu Nov 3 10:07:31 2022 -0400
debuginfod.cxx: fix coverity-found use-after-release error
The debuginfod_client object lifetime needs more careful handling,
made easier with the defer_dtor<> gadget.
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index f46da6ef..02a11477 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -2249,85 +2249,82 @@ handle_buildid (MHD_Connection* conn,
int fd = -1;
debuginfod_client *client = debuginfod_pool_begin ();
- if (client != NULL)
- {
- debuginfod_set_progressfn (client, & debuginfod_find_progress);
+ if (client == NULL)
+ throw libc_exception(errno, "debuginfod client pool alloc");
+ defer_dtor<debuginfod_client*,void> client_closer (client, debuginfod_pool_end);
+
+ debuginfod_set_progressfn (client, & debuginfod_find_progress);
- if (conn)
- {
- // Transcribe incoming User-Agent:
- string ua = MHD_lookup_connection_value (conn, MHD_HEADER_KIND, "User-Agent") ?: "";
- string ua_complete = string("User-Agent: ") + ua;
- debuginfod_add_http_header (client, ua_complete.c_str());
-
- // Compute larger XFF:, for avoiding info loss during
- // federation, and for future cyclicity detection.
- string xff = MHD_lookup_connection_value (conn, MHD_HEADER_KIND, "X-Forwarded-For") ?: "";
- if (xff != "")
- xff += string(", "); // comma separated list
-
- unsigned int xff_count = 0;
- for (auto&& i : xff){
- if (i == ',') xff_count++;
- }
+ if (conn)
+ {
+ // Transcribe incoming User-Agent:
+ string ua = MHD_lookup_connection_value (conn, MHD_HEADER_KIND, "User-Agent") ?: "";
+ string ua_complete = string("User-Agent: ") + ua;
+ debuginfod_add_http_header (client, ua_complete.c_str());
+
+ // Compute larger XFF:, for avoiding info loss during
+ // federation, and for future cyclicity detection.
+ string xff = MHD_lookup_connection_value (conn, MHD_HEADER_KIND, "X-Forwarded-For") ?: "";
+ if (xff != "")
+ xff += string(", "); // comma separated list
+
+ unsigned int xff_count = 0;
+ for (auto&& i : xff){
+ if (i == ',') xff_count++;
+ }
- // if X-Forwarded-For: exceeds N hops,
- // do not delegate a local lookup miss to upstream debuginfods.
- if (xff_count >= forwarded_ttl_limit)
- throw reportable_exception(MHD_HTTP_NOT_FOUND, "not found, --forwared-ttl-limit reached \
+ // if X-Forwarded-For: exceeds N hops,
+ // do not delegate a local lookup miss to upstream debuginfods.
+ if (xff_count >= forwarded_ttl_limit)
+ throw reportable_exception(MHD_HTTP_NOT_FOUND, "not found, --forwared-ttl-limit reached \
and will not query the upstream servers");
- // Compute the client's numeric IP address only - so can't merge with conninfo()
- const union MHD_ConnectionInfo *u = MHD_get_connection_info (conn,
- MHD_CONNECTION_INFO_CLIENT_ADDRESS);
- struct sockaddr *so = u ? u->client_addr : 0;
- char hostname[256] = ""; // RFC1035
- if (so && so->sa_family == AF_INET) {
- (void) getnameinfo (so, sizeof (struct sockaddr_in), hostname, sizeof (hostname), NULL, 0,
- NI_NUMERICHOST);
- } else if (so && so->sa_family == AF_INET6) {
- struct sockaddr_in6* addr6 = (struct sockaddr_in6*) so;
- if (IN6_IS_ADDR_V4MAPPED(&addr6->sin6_addr)) {
- struct sockaddr_in addr4;
- memset (&addr4, 0, sizeof(addr4));
- addr4.sin_family = AF_INET;
- addr4.sin_port = addr6->sin6_port;
- memcpy (&addr4.sin_addr.s_addr, addr6->sin6_addr.s6_addr+12, sizeof(addr4.sin_addr.s_addr));
- (void) getnameinfo ((struct sockaddr*) &addr4, sizeof (addr4),
- hostname, sizeof (hostname), NULL, 0,
- NI_NUMERICHOST);
- } else {
- (void) getnameinfo (so, sizeof (struct sockaddr_in6), hostname, sizeof (hostname), NULL, 0,
- NI_NUMERICHOST);
- }
- }
-
- string xff_complete = string("X-Forwarded-For: ")+xff+string(hostname);
- debuginfod_add_http_header (client, xff_complete.c_str());
+ // Compute the client's numeric IP address only - so can't merge with conninfo()
+ const union MHD_ConnectionInfo *u = MHD_get_connection_info (conn,
+ MHD_CONNECTION_INFO_CLIENT_ADDRESS);
+ struct sockaddr *so = u ? u->client_addr : 0;
+ char hostname[256] = ""; // RFC1035
+ if (so && so->sa_family == AF_INET) {
+ (void) getnameinfo (so, sizeof (struct sockaddr_in), hostname, sizeof (hostname), NULL, 0,
+ NI_NUMERICHOST);
+ } else if (so && so->sa_family == AF_INET6) {
+ struct sockaddr_in6* addr6 = (struct sockaddr_in6*) so;
+ if (IN6_IS_ADDR_V4MAPPED(&addr6->sin6_addr)) {
+ struct sockaddr_in addr4;
+ memset (&addr4, 0, sizeof(addr4));
+ addr4.sin_family = AF_INET;
+ addr4.sin_port = addr6->sin6_port;
+ memcpy (&addr4.sin_addr.s_addr, addr6->sin6_addr.s6_addr+12, sizeof(addr4.sin_addr.s_addr));
+ (void) getnameinfo ((struct sockaddr*) &addr4, sizeof (addr4),
+ hostname, sizeof (hostname), NULL, 0,
+ NI_NUMERICHOST);
+ } else {
+ (void) getnameinfo (so, sizeof (struct sockaddr_in6), hostname, sizeof (hostname), NULL, 0,
+ NI_NUMERICHOST);
}
-
- if (artifacttype == "debuginfo")
- fd = debuginfod_find_debuginfo (client,
- (const unsigned char*) buildid.c_str(),
- 0, NULL);
- else if (artifacttype == "executable")
- fd = debuginfod_find_executable (client,
- (const unsigned char*) buildid.c_str(),
- 0, NULL);
- else if (artifacttype == "source")
- fd = debuginfod_find_source (client,
- (const unsigned char*) buildid.c_str(),
- 0, suffix.c_str(), NULL);
- else if (artifacttype == "section")
- fd = debuginfod_find_section (client,
- (const unsigned char*) buildid.c_str(),
- 0, section.c_str(), NULL);
-
+ }
+
+ string xff_complete = string("X-Forwarded-For: ")+xff+string(hostname);
+ debuginfod_add_http_header (client, xff_complete.c_str());
}
- else
- fd = -errno; /* Set by debuginfod_begin. */
- debuginfod_pool_end (client);
-
+
+ if (artifacttype == "debuginfo")
+ fd = debuginfod_find_debuginfo (client,
+ (const unsigned char*) buildid.c_str(),
+ 0, NULL);
+ else if (artifacttype == "executable")
+ fd = debuginfod_find_executable (client,
+ (const unsigned char*) buildid.c_str(),
+ 0, NULL);
+ else if (artifacttype == "source")
+ fd = debuginfod_find_source (client,
+ (const unsigned char*) buildid.c_str(),
+ 0, suffix.c_str(), NULL);
+ else if (artifacttype == "section")
+ fd = debuginfod_find_section (client,
+ (const unsigned char*) buildid.c_str(),
+ 0, section.c_str(), NULL);
+
if (fd >= 0)
{
if (conn != 0)

View File

@ -0,0 +1,24 @@
commit 58a7aa900bc2d9822b0d0cb596ba95a21ff0fd2d
Author: Mark Wielaard <mark@klomp.org>
Date: Wed Nov 2 17:54:11 2022 +0100
debuginfod: Mark extract_section function static
The extract_section function in debuginfod-client.c is an internal
function and should not be exported. Mark it as static.
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 0c4a00cf..f48e32cc 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -621,7 +621,7 @@ path_escape (const char *src, char *dest)
section name was not found. -EEXIST indicates that the section was
found but had type SHT_NOBITS. */
-int
+static int
extract_section (int fd, const char *section, char *fd_path, char **usr_path)
{
elf_version (EV_CURRENT);

View File

@ -0,0 +1 @@
u debuginfod - "elfutils debuginfo server" /var/cache/debuginfod -

View File

@ -1,11 +1,12 @@
Name: elfutils Name: elfutils
Version: 0.187 Version: 0.188
%global baserelease 5 %global baserelease 3
Release: %{baserelease}%{?dist} Release: %{baserelease}%{?dist}
URL: http://elfutils.org/ URL: http://elfutils.org/
%global source_url ftp://sourceware.org/pub/elfutils/%{version}/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/
License: GPLv3+ and (GPLv2+ or LGPLv3+) and GFDL License: GPLv3+ and (GPLv2+ or LGPLv3+) and GFDL
Source: %{?source_url}%{name}-%{version}.tar.bz2 Source: %{?source_url}%{name}-%{version}.tar.bz2
Source1: elfutils-debuginfod.sysusers
Summary: A collection of utilities and DSOs to handle ELF files and DWARF data Summary: A collection of utilities and DSOs to handle ELF files and DWARF data
# Needed for isa specific Provides and Requires. # Needed for isa specific Provides and Requires.
@ -48,6 +49,8 @@ BuildRequires: iproute
BuildRequires: procps BuildRequires: procps
BuildRequires: bsdtar BuildRequires: bsdtar
BuildRequires: curl BuildRequires: curl
# For run-debuginfod-response-headers.sh test case
BuildRequires: socat
BuildRequires: automake BuildRequires: automake
BuildRequires: autoconf BuildRequires: autoconf
@ -56,21 +59,26 @@ BuildRequires: gettext-devel
%global _gnu %{nil} %global _gnu %{nil}
%global _program_prefix eu- %global _program_prefix eu-
%global provide_yama_scope 0 %global provide_yama_scope 0
%if 0%{?fedora} >= 22 || 0%{?rhel} >= 7 %if 0%{?fedora} >= 22 || 0%{?rhel} >= 7
%global provide_yama_scope 1 %global provide_yama_scope 1
%endif
%global with_sysusers 0
%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9
%global with_sysusers 1
%endif %endif
# Patches # Patches
# https://bugzilla.redhat.com/show_bug.cgi?id=2080957
Patch1: elfutils-0.187-csh-profile.patch # Don't export internal function.
# https://sourceware.org/bugzilla/show_bug.cgi?id=29117 Patch1: elfutils-0.188-static-extract_section.patch
Patch2: elfutils-0.187-debuginfod-client-fd-leak.patch # Silence some compiler warnings
# https://sourceware.org/bugzilla/show_bug.cgi?id=29122 Patch2: elfutils-0.188-compile-warnings.patch
Patch3: elfutils-0.187-mhd_no_dual_stack.patch # The debuginfod_client object lifetime needs more careful handling
# https://sourceware.org/bugzilla/show_bug.cgi?id=29123 Patch3: elfutils-0.188-debuginfod-client-lifetime.patch
Patch4: elfutils-0.187-mhd_epoll.patch
%description %description
Elfutils is a collection of utilities, including stack (to show Elfutils is a collection of utilities, including stack (to show
@ -217,11 +225,18 @@ Requires: elfutils-libs%{depsuffix} = %{version}-%{release}
Requires: elfutils-libelf%{depsuffix} = %{version}-%{release} Requires: elfutils-libelf%{depsuffix} = %{version}-%{release}
Requires: elfutils-debuginfod-client%{depsuffix} = %{version}-%{release} Requires: elfutils-debuginfod-client%{depsuffix} = %{version}-%{release}
BuildRequires: systemd BuildRequires: systemd
%if %{with_sysusers}
BuildRequires: systemd-rpm-macros
%endif
BuildRequires: make BuildRequires: make
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
%if %{with_sysusers}
%{?sysusers_requires_compat}
%else
Requires(pre): shadow-utils Requires(pre): shadow-utils
%endif
# To extract .deb files with a bsdtar (= libarchive) subshell # To extract .deb files with a bsdtar (= libarchive) subshell
Requires: bsdtar Requires: bsdtar
@ -294,6 +309,10 @@ install -Dm0644 config/debuginfod.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysc
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/cache/debuginfod mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/cache/debuginfod
touch ${RPM_BUILD_ROOT}%{_localstatedir}/cache/debuginfod/debuginfod.sqlite touch ${RPM_BUILD_ROOT}%{_localstatedir}/cache/debuginfod/debuginfod.sqlite
%if %{with_sysusers}
install -Dm0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/elfutils-debuginfod.conf
%endif
%check %check
# Record some build root versions in build.log # Record some build root versions in build.log
uname -r; rpm -q binutils gcc glibc || true uname -r; rpm -q binutils gcc glibc || true
@ -408,18 +427,26 @@ fi
%{_bindir}/debuginfod %{_bindir}/debuginfod
%config(noreplace) %{_sysconfdir}/sysconfig/debuginfod %config(noreplace) %{_sysconfdir}/sysconfig/debuginfod
%{_unitdir}/debuginfod.service %{_unitdir}/debuginfod.service
%{_sysconfdir}/sysconfig/debuginfod %if %{with_sysusers}
%{_mandir}/man8/debuginfod.8* %{_sysusersdir}/elfutils-debuginfod.conf
%endif
%{_mandir}/man8/debuginfod*.8*
%{_mandir}/man7/debuginfod*.7*
%dir %attr(0700,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod %dir %attr(0700,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod
%ghost %attr(0600,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod/debuginfod.sqlite %ghost %attr(0600,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod/debuginfod.sqlite
%pre debuginfod %pre debuginfod
%if %{with_sysusers}
%sysusers_create_compat %{SOURCE1}
%else
getent group debuginfod >/dev/null || groupadd -r debuginfod getent group debuginfod >/dev/null || groupadd -r debuginfod
getent passwd debuginfod >/dev/null || \ getent passwd debuginfod >/dev/null || \
useradd -r -g debuginfod -d /var/cache/debuginfod -s /sbin/nologin \ useradd -r -g debuginfod -d /var/cache/debuginfod -s /sbin/nologin \
-c "elfutils debuginfo server" debuginfod -c "elfutils debuginfo server" debuginfod
exit 0 exit 0
%endif
%post debuginfod %post debuginfod
%systemd_post debuginfod.service %systemd_post debuginfod.service
@ -428,6 +455,17 @@ exit 0
%systemd_postun_with_restart debuginfod.service %systemd_postun_with_restart debuginfod.service
%changelog %changelog
* Mon Nov 7 2022 Mark Wielaard <mjw@redhat.com> - 0.188-3
- Add elfutils-0.188-compile-warnings.patch
- Add elfutils-0.188-debuginfod-client-lifetime.patch
* Wed Nov 2 2022 Mark Wielaard <mjw@redhat.com> - 0.188-1
- Upgrade to upsteam elfutils 0.188.
- Add elfutils-0.188-static-extract_section.patch.
* Fri Sep 30 2022 Mark Wielaard <mjw@redhat.com> - 0.187-6
- Add sysuser support for creating the debuginfod user
* Thu Jun 16 2022 Frank Ch. Eigler <fche@redhat.com> - 0.187-5 * Thu Jun 16 2022 Frank Ch. Eigler <fche@redhat.com> - 0.187-5
- rhbz2088774: ship /etc/profile.d/debuginfod* files even without - rhbz2088774: ship /etc/profile.d/debuginfod* files even without
default DEBUGINFOD_URLS. default DEBUGINFOD_URLS.