67a767
From cc25319e5e179da1c1d9455ab4760dcbcb66b591 Mon Sep 17 00:00:00 2001
67a767
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
67a767
Date: Wed, 6 Jan 2016 17:14:08 +0100
67a767
Subject: [PATCH] Build rpc.rquotad as PIE
67a767
MIME-Version: 1.0
67a767
Content-Type: text/plain; charset=UTF-8
67a767
Content-Transfer-Encoding: 8bit
67a767
67a767
Harden executables due to rpc.rquotad and quota_nld daemons.
67a767
67a767
Recent distribution enabled hardening globally. This patch preserves the
67a767
test to catch a regression.
67a767
67a767
<https: bugzilla.redhat.com="" show_bug.cgi?id="983179">
67a767
67a767
Signed-off-by: Petr Písař <ppisar@redhat.com>
67a767
---
67a767
 Makefile.am   | 2 ++
67a767
 test-hardened | 9 +++++++++
67a767
 2 files changed, 11 insertions(+)
67a767
 create mode 100644 test-hardened
67a767
67a767
diff --git a/Makefile.am b/Makefile.am
67a767
index eb62617..1414f8d 100644
67a767
--- a/Makefile.am
67a767
+++ b/Makefile.am
67a767
@@ -232,6 +232,8 @@ quota_nld_LDADD = \
67a767
 	$(DBUS_LIBS) \
67a767
 	$(LIBNL3_LIBS)
67a767
 
67a767
+TEST=test-hardended
67a767
+
67a767
 # ------------------
67a767
 # Rpcgen conversions
67a767
 # ------------------
67a767
diff --git a/test-hardened b/test-hardened
67a767
new file mode 100644
67a767
index 0000000..b8f63bf
67a767
--- /dev/null
67a767
+++ b/test-hardened
67a767
@@ -0,0 +1,9 @@
67a767
+#!/bin/sh
67a767
+# Check rpc.rquotad and quota_nld daemons are hardened (bug #983179)
67a767
+
67a767
+for D in rpc.rquotad quota_nld; do
67a767
+    if readelf -d "$D" | fgrep -q TEXTREL; then
67a767
+         echo "*** Text relocation found in ${D}"
67a767
+         exit 1;
67a767
+    fi
67a767
+done
67a767
-- 
67a767
2.5.0
67a767