[libutempter] compile with PIE and RELRO flags (#853176)

Miroslav Lichvar mlichvar at fedoraproject.org
Thu Jan 24 15:02:32 UTC 2013


commit b6e4f4a7f7a481bcd83f5a973c8c9df7d0242f95
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date:   Thu Jan 24 16:00:59 2013 +0100

    compile with PIE and RELRO flags (#853176)

 libutempter-pierelro.patch |   18 ++++++++++++++++++
 libutempter.spec           |    9 ++++++++-
 2 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/libutempter-pierelro.patch b/libutempter-pierelro.patch
new file mode 100644
index 0000000..9bd726d
--- /dev/null
+++ b/libutempter-pierelro.patch
@@ -0,0 +1,18 @@
+diff -up libutempter-1.1.6/Makefile.pierelro libutempter-1.1.6/Makefile
+--- libutempter-1.1.6/Makefile.pierelro	2010-11-04 18:14:53.000000000 +0100
++++ libutempter-1.1.6/Makefile	2013-01-24 15:58:06.241865564 +0100
+@@ -52,11 +52,12 @@ all: $(TARGETS)
+ 	$(COMPILE.c) -fPIC $< $(OUTPUT_OPTION)
+ 
+ $(PROJECT): utempter.c
+-	$(LINK.c) -Wl,-z,now,-stats $(LDLIBS) $< $(OUTPUT_OPTION)
++	$(LINK.c) -pie -fPIE -Wl,-z,relro,-z,now,-stats $(LDLIBS) \
++		$< $(OUTPUT_OPTION)
+ 
+ $(SHAREDLIB): iface.os $(MAP)
+ 	$(LINK.o) -shared \
+-		-Wl,-soname,$(SONAME),--version-script=$(MAP),-z,defs,-stats \
++		-Wl,-soname,$(SONAME),--version-script=$(MAP),-z,relro,-z,defs,-stats \
+ 		-lc $< $(OUTPUT_OPTION)
+ 
+ $(STATICLIB): iface.o
diff --git a/libutempter.spec b/libutempter.spec
index f259358..fcd0c7d 100644
--- a/libutempter.spec
+++ b/libutempter.spec
@@ -3,13 +3,16 @@
 Summary: A privileged helper for utmp/wtmp updates
 Name: libutempter
 Version: 1.1.6
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: LGPLv2+
 Group: System Environment/Libraries
 URL: ftp://ftp.altlinux.org/pub/people/ldv/utempter
 
 Source0: ftp://ftp.altlinux.org/pub/people/ldv/utempter/%{name}-%{version}.tar.bz2
 
+# Compile with PIE and RELRO flags.
+Patch0: libutempter-pierelro.patch
+
 Requires(pre): shadow-utils
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
@@ -31,6 +34,7 @@ utempter-based software.
 
 %prep
 %setup -q
+%patch0 -p1 -b .pierelro
 
 %build
 make CFLAGS="$RPM_OPT_FLAGS" libdir="%{_libdir}" libexecdir="%{_libexecdir}"
@@ -73,6 +77,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
 %{_mandir}/man3/*
 
 %changelog
+* Thu Jan 24 2013 Miroslav Lichvar <mlichvar at redhat.com> - 1.1.6-2
+- compile with PIE and RELRO flags (#853176)
+
 * Thu Oct 11 2012 Miroslav Lichvar <mlichvar at redhat.com> - 1.1.6-1
 - update to 1.1.6
 - fix license tag


More information about the scm-commits mailing list