[ceph/f22] Fix several issues with spec file

branto branto at fedoraproject.org
Wed Mar 4 15:15:59 UTC 2015


commit 085130783d3b6dc9242d9a39ac9898b526e9c74e
Author: Boris Ranto <branto at redhat.com>
Date:   Wed Mar 4 16:12:18 2015 +0100

    Fix several issues with spec file
    
    - Perform a hardened build
    - Use git-formatted patches
    - Add patch for pthreads rwlock unlock problem
    - Do not remove conf files on uninstall
    - Remove the cleanup function, it is only necessary for f20 and f21

 ...ch-google-includes-to-gperftools-includes.patch |  27 +++++
 ...ommon-do-not-unlock-rwlock-on-destruction.patch |  62 +++++++++++
 ceph-0.87-boost157.patch                           | 117 ---------------------
 ceph-google-gperftools.patch                       |  13 ---
 ceph.spec                                          |  22 ++--
 5 files changed, 103 insertions(+), 138 deletions(-)
---
diff --git a/0001-Switch-google-includes-to-gperftools-includes.patch b/0001-Switch-google-includes-to-gperftools-includes.patch
new file mode 100644
index 0000000..58c11a3
--- /dev/null
+++ b/0001-Switch-google-includes-to-gperftools-includes.patch
@@ -0,0 +1,27 @@
+From 586893408fa1c274844941c74757c3364c0f701e Mon Sep 17 00:00:00 2001
+From: Boris Ranto <branto at redhat.com>
+Date: Wed, 4 Mar 2015 15:23:53 +0100
+Subject: [PATCH 1/2] Switch google/* includes to gperftools/* includes
+
+---
+ src/perfglue/heap_profiler.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/perfglue/heap_profiler.cc b/src/perfglue/heap_profiler.cc
+index 6b079b8..cdd5ccb 100644
+--- a/src/perfglue/heap_profiler.cc
++++ b/src/perfglue/heap_profiler.cc
+@@ -12,8 +12,8 @@
+  * 
+  */
+ 
+-#include <google/heap-profiler.h>
+-#include <google/malloc_extension.h>
++#include <gperftools/heap-profiler.h>
++#include <gperftools/malloc_extension.h>
+ #include "heap_profiler.h"
+ #include "common/environment.h"
+ #include "common/LogClient.h"
+-- 
+1.9.3
+
diff --git a/0002-common-do-not-unlock-rwlock-on-destruction.patch b/0002-common-do-not-unlock-rwlock-on-destruction.patch
new file mode 100644
index 0000000..6649658
--- /dev/null
+++ b/0002-common-do-not-unlock-rwlock-on-destruction.patch
@@ -0,0 +1,62 @@
+From e77a5347aaeeb219512f77ae7a517906a51aca29 Mon Sep 17 00:00:00 2001
+From: Federico Simoncelli <fsimonce at redhat.com>
+Date: Sat, 15 Nov 2014 14:14:04 +0000
+Subject: [PATCH 2/2] common: do not unlock rwlock on destruction
+
+According to pthread_rwlock_unlock(3p):
+
+ Results are undefined if the read-write lock rwlock is not held
+ by the calling thread.
+
+and:
+
+ https://sourceware.org/bugzilla/show_bug.cgi?id=17561
+
+ Calling pthread_rwlock_unlock on an rwlock which is not locked
+ is undefined.
+
+calling pthread_rwlock_unlock on RWLock destruction could cause
+an unknown behavior for two reasons:
+
+- the lock is acquired by another thread (undefined)
+- the lock is not acquired (undefined)
+
+Moreover since glibc-2.20 calling pthread_rwlock_unlock on a
+rwlock that is not locked results in a SIGILL that kills the
+application.
+
+This patch removes the pthread_rwlock_unlock call on destruction
+and replaces it with an assertion to check that the RWLock is
+not in use.
+
+Any code that relied on the implicit release is now going to
+break the assertion, e.g.:
+
+ {
+   RWLock l;
+   l.get(for_write);
+ } // implicit release, wrong.
+
+Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
+---
+ src/common/RWLock.h | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/common/RWLock.h b/src/common/RWLock.h
+index e647e17..6f0ab8e 100644
+--- a/src/common/RWLock.h
++++ b/src/common/RWLock.h
+@@ -46,7 +46,9 @@ public:
+     return (nwlock.read() > 0);
+   }
+   virtual ~RWLock() {
+-    pthread_rwlock_unlock(&L);
++    // The following check is racy but we are about to destroy
++    // the object and we assume that there are no other users.
++    assert(!is_locked());
+     pthread_rwlock_destroy(&L);
+   }
+ 
+-- 
+1.9.3
+
diff --git a/ceph.spec b/ceph.spec
index 6eef2ea..8cbcd85 100644
--- a/ceph.spec
+++ b/ceph.spec
@@ -5,19 +5,22 @@
 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 %endif
 
+%global _hardened_build 1
+
 #################################################################################
 # common
 #################################################################################
 Name:		ceph
 Version:	0.87.1
-Release:	1%{?dist}
+Release:	2%{?dist}
 Epoch:		1
 Summary:	User space components of the Ceph file system
 License:	GPLv2
 Group:		System Environment/Base
 URL:		http://ceph.com/
 Source0:	http://ceph.com/download/%{name}-%{version}.tar.bz2
-Patch0:		ceph-google-gperftools.patch
+Patch1:		0001-Switch-google-includes-to-gperftools-includes.patch
+Patch2:		0002-common-do-not-unlock-rwlock-on-destruction.patch
 Requires:	librbd1 = %{epoch}:%{version}-%{release}
 Requires:	librados2 = %{epoch}:%{version}-%{release}
 Requires:	libcephfs1 = %{epoch}:%{version}-%{release}
@@ -411,7 +414,8 @@ python-cephfs instead.
 #################################################################################
 %prep
 %setup -q
-%patch0 -p1
+%patch1 -p1
+%patch2 -p1
 
 %build
 # Find jni.h
@@ -679,7 +683,6 @@ fi
 # Package removal cleanup
 if [ "$1" -eq "0" ] ; then
     rm -rf /var/log/ceph
-    rm -rf /etc/ceph
 fi
 
 #################################################################################
@@ -805,10 +808,6 @@ fi
 
 %post -n librbd1
 /sbin/ldconfig
-# First, cleanup
-rm -f /usr/lib64/qemu/librbd.so.1
-rmdir /usr/lib64/qemu 2>/dev/null || true
-rmdir /usr/lib64/ 2>/dev/null || true
 # If x86_64 and rhel6+, link the library to /usr/lib64/qemu -- rhel hack
 %ifarch x86_64
 %if 0%{?rhel} >= 6
@@ -918,6 +917,13 @@ ln -sf %{_libdir}/librbd.so.1 /usr/lib64/qemu/librbd.so.1
 %files -n python-ceph-compat
 
 %changelog
+* Wed Mar 4 2015 Boris Ranto <branto at redhat.com> - 1:0.87.1-2
+- Perform a hardened build
+- Use git-formatted patches
+- Add patch for pthreads rwlock unlock problem
+- Do not remove conf files on uninstall
+- Remove the cleanup function, it is only necessary for f20 and f21
+
 * Wed Feb 25 2015 Boris Ranto <branto at redhat.com> - 1:0.87.1-1
 - Rebase to latest upstream
 - Remove boost patch, it is in upstream tarball


More information about the scm-commits mailing list