0.187-3 - Add elfutils-0.187-debuginfod-client-fd-leak.patch
This commit is contained in:
parent
6a6ddccfb4
commit
58242698fa
98
elfutils-0.187-debuginfod-client-fd-leak.patch
Normal file
98
elfutils-0.187-debuginfod-client-fd-leak.patch
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
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);
|
@ -1,6 +1,6 @@
|
|||||||
Name: elfutils
|
Name: elfutils
|
||||||
Version: 0.187
|
Version: 0.187
|
||||||
%global baserelease 2
|
%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}/
|
||||||
@ -65,7 +65,10 @@ BuildRequires: gettext-devel
|
|||||||
|
|
||||||
# For s390x... FDO package notes are bogus.
|
# For s390x... FDO package notes are bogus.
|
||||||
Patch1: elfutils-0.186-fdo-swap.patch
|
Patch1: elfutils-0.186-fdo-swap.patch
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=2080957
|
||||||
Patch2: elfutils-0.187-csh-profile.patch
|
Patch2: elfutils-0.187-csh-profile.patch
|
||||||
|
# https://sourceware.org/bugzilla/show_bug.cgi?id=29117
|
||||||
|
Patch3: elfutils-0.187-debuginfod-client-fd-leak.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Elfutils is a collection of utilities, including stack (to show
|
Elfutils is a collection of utilities, including stack (to show
|
||||||
@ -406,6 +409,9 @@ exit 0
|
|||||||
%systemd_postun_with_restart debuginfod.service
|
%systemd_postun_with_restart debuginfod.service
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu May 5 2022 Mark Wielaard <mjw@fedoraproject.org> - 0.187-3
|
||||||
|
- Add elfutils-0.187-debuginfod-client-fd-leak.patch
|
||||||
|
|
||||||
* Tue May 3 2022 Mark Wielaard <mjw@fedoraproject.org> - 0.187-2
|
* Tue May 3 2022 Mark Wielaard <mjw@fedoraproject.org> - 0.187-2
|
||||||
- Add elfutils-0.187-csh-profile.patch
|
- Add elfutils-0.187-csh-profile.patch
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user