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