From 2589c4ef52c27119ff4d070dd672a42b2da24d2b Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Fri, 8 Mar 2019 11:19:00 +0000 Subject: [PATCH] fix crash on dlclose due to atfork handler (#1680481) Resolves: rhbz#1680481 --- libcap-ng-0.7.9-fixatfork.patch | 28 ++++++++++++++++++++++++++++ libcap-ng.spec | 7 ++++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 libcap-ng-0.7.9-fixatfork.patch diff --git a/libcap-ng-0.7.9-fixatfork.patch b/libcap-ng-0.7.9-fixatfork.patch new file mode 100644 index 0000000..fc21e04 --- /dev/null +++ b/libcap-ng-0.7.9-fixatfork.patch @@ -0,0 +1,28 @@ +--- libcap-ng-0.7.9/src/cap-ng.c.noatfork ++++ libcap-ng-0.7.9/src/cap-ng.c +@@ -153,15 +153,6 @@ + CAPNG_NEW, + {0, 0} }; + +- +-/* +- * The pthread_atfork function is being made weak so that we can use it +- * if the program is linked with pthreads and not requiring it for +- * everything that uses libcap-ng. +- */ +-extern int __attribute__((weak)) pthread_atfork(void (*prepare)(void), +- void (*parent)(void), void (*child)(void)); +- + /* + * Reset the state so that init gets called to erase everything + */ +@@ -173,8 +164,7 @@ + static void init_lib(void) __attribute__ ((constructor)); + static void init_lib(void) + { +- if (pthread_atfork) +- pthread_atfork(NULL, NULL, deinit); ++ pthread_atfork(NULL, NULL, deinit); + } + + static void init(void) diff --git a/libcap-ng.spec b/libcap-ng.spec index 325386a..f949652 100644 --- a/libcap-ng.spec +++ b/libcap-ng.spec @@ -3,11 +3,12 @@ Summary: An alternate posix capabilities library Name: libcap-ng Version: 0.7.9 -Release: 6%{?dist} +Release: 7%{?dist} License: LGPLv2+ URL: http://people.redhat.com/sgrubb/libcap-ng Source0: http://people.redhat.com/sgrubb/libcap-ng/%{name}-%{version}.tar.gz Patch1: libcap-ng-0.8-permitted.patch +Patch2: libcap-ng-0.7.9-fixatfork.patch BuildRequires: gcc BuildRequires: kernel-headers >= 2.6.11 BuildRequires: libattr-devel @@ -49,6 +50,7 @@ lets you set the file system based capabilities. %prep %setup -q %patch1 -p1 +%patch2 -p1 %build %configure --libdir=/%{_lib} --with-python=no --with-python3 @@ -101,6 +103,9 @@ make check %attr(0644,root,root) %{_mandir}/man8/* %changelog +* Fri Mar 8 2019 Joe Orton - 0.7.9-7 +- fix crash on dlclose due to atfork handler (#1680481) + * Fri Feb 01 2019 Fedora Release Engineering - 0.7.9-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild