patches from Simon Ruderich that broaden use of hardening build flags
authorBdale Garbee <bdale@gag.com>
Mon, 19 Mar 2012 14:00:50 +0000 (15:00 +0100)
committerBdale Garbee <bdale@gag.com>
Mon, 19 Mar 2012 14:00:50 +0000 (15:00 +0100)
common/Makefile.in
compat/Makefile.in
debian/changelog
debian/patches/actually-use-buildflags.diff [new file with mode: 0644]
debian/patches/series
plugins/sudoers/Makefile.in
src/Makefile.in

index a1319eff6304842f8b3884511636c7ce8a5e9f88..9ee10c7f2968714300f6d1d0f1b74fb11b29d9d4 100644 (file)
@@ -35,6 +35,9 @@ CPPFLAGS = -I$(incdir) -I$(top_builddir) -I$(top_srcdir) @CPPFLAGS@
 # Usually -O and/or -g
 CFLAGS = @CFLAGS@
 
+# Linker flags
+LDFLAGS = @LDFLAGS@
+
 # OS dependent defines
 DEFS = @OSDEFS@
 
@@ -56,7 +59,7 @@ Makefile: $(srcdir)/Makefile.in
        $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
 
 libcommon.la: $(LTOBJS)
-       $(LIBTOOL) --mode=link $(CC) -o $@ $(LTOBJS) -no-install
+       $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(LTOBJS) -no-install
 
 pre-install:
 
index 09a02b26a8c48cd54bede0dcc273d7efc286189a..33f2e65addcc85cf7e0fbf2737eb5523367d80f4 100644 (file)
@@ -35,6 +35,9 @@ CPPFLAGS = -I$(incdir) -I$(top_builddir) -I$(top_srcdir) @CPPFLAGS@
 # Usually -O and/or -g
 CFLAGS = @CFLAGS@
 
+# Linker flags
+LDFLAGS = @LDFLAGS@
+
 # OS dependent defines
 DEFS = @OSDEFS@
 
@@ -62,19 +65,19 @@ Makefile: $(srcdir)/Makefile.in
        $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
 
 libreplace.la: $(LTLIBOBJS)
-       $(LIBTOOL) --mode=link $(CC) -o $@ $(LTLIBOBJS) -no-install
+       $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(LTLIBOBJS) -no-install
 
 siglist.c: mksiglist
        ./mksiglist > $@
 
 mksiglist: $(srcdir)/mksiglist.c $(srcdir)/mksiglist.h $(incdir)/missing.h $(top_builddir)/config.h
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/mksiglist.c -o $@
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(DEFS) $(srcdir)/mksiglist.c -o $@
 
 fnm_test: fnm_test.o libreplace.la
-       $(LIBTOOL) --mode=link $(CC) -o $@ fnm_test.o libreplace.la
+       $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ fnm_test.o libreplace.la
 
 globtest: globtest.o libreplace.la
-       $(LIBTOOL) --mode=link $(CC) -o $@ globtest.o libreplace.la
+       $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ globtest.o libreplace.la
 
 @DEV@$(srcdir)/mksiglist.h: $(srcdir)/siglist.in
 @DEV@  awk 'BEGIN {print "/* public domain */\n"} /^    [A-Z]/ {printf("#ifdef SIG%s\n    if (my_sys_siglist[SIG%s] == NULL)\n\tmy_sys_siglist[SIG%s] = \"%s\";\n#endif\n", $$1, $$1, $$1, substr($$0, 13))}' < $(srcdir)/siglist.in > $@
index 5c6a5b8cfff9fcb03e152b1cacd96601759cc7ed..f30818cfa27d7522f7b9b2bdbe146f55dc129c63 100644 (file)
@@ -1,3 +1,9 @@
+sudo (1.8.3p2-2) unstable; urgency=low
+
+  * patch to actually use hardening build flags, closes: #655417
+
+ -- Bdale Garbee <bdale@gag.com>  Mon, 19 Mar 2012 14:58:39 +0100
+
 sudo (1.8.3p2-1) unstable; urgency=high
 
   * new upstream version, closes: #657985 (CVE-2012-0809)
diff --git a/debian/patches/actually-use-buildflags.diff b/debian/patches/actually-use-buildflags.diff
new file mode 100644 (file)
index 0000000..42bf4b5
--- /dev/null
@@ -0,0 +1,92 @@
+Description: Use build flags from environment (dpkg-buildflags).
+ Necessary for hardening flags.
+Author: Simon Ruderich <simon@ruderich.org>
+Last-Update: 2012-03-13
+
+Index: sudo-1.8.3p2/src/Makefile.in
+===================================================================
+--- sudo-1.8.3p2.orig/src/Makefile.in  2012-03-13 17:46:43.069036559 +0100
++++ sudo-1.8.3p2/src/Makefile.in       2012-03-13 17:47:12.949037698 +0100
+@@ -101,7 +101,7 @@
+       $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(LTLDFLAGS) -o $@ sudo_noexec.lo -avoid-version -rpath $(noexecdir)
+ sesh: sesh.o
+-      $(CC) -o $@ sesh.o
++      $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ sesh.o
+ pre-install:
+Index: sudo-1.8.3p2/compat/Makefile.in
+===================================================================
+--- sudo-1.8.3p2.orig/compat/Makefile.in       2012-03-13 17:46:43.069036559 +0100
++++ sudo-1.8.3p2/compat/Makefile.in    2012-03-13 17:47:12.949037698 +0100
+@@ -35,6 +35,9 @@
+ # Usually -O and/or -g
+ CFLAGS = @CFLAGS@
++# Linker flags
++LDFLAGS = @LDFLAGS@
++
+ # OS dependent defines
+ DEFS = @OSDEFS@
+@@ -62,19 +65,19 @@
+       $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
+ libreplace.la: $(LTLIBOBJS)
+-      $(LIBTOOL) --mode=link $(CC) -o $@ $(LTLIBOBJS) -no-install
++      $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(LTLIBOBJS) -no-install
+ siglist.c: mksiglist
+       ./mksiglist > $@
+ mksiglist: $(srcdir)/mksiglist.c $(srcdir)/mksiglist.h $(incdir)/missing.h $(top_builddir)/config.h
+-      $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/mksiglist.c -o $@
++      $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(DEFS) $(srcdir)/mksiglist.c -o $@
+ fnm_test: fnm_test.o libreplace.la
+-      $(LIBTOOL) --mode=link $(CC) -o $@ fnm_test.o libreplace.la
++      $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ fnm_test.o libreplace.la
+ globtest: globtest.o libreplace.la
+-      $(LIBTOOL) --mode=link $(CC) -o $@ globtest.o libreplace.la
++      $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ globtest.o libreplace.la
+ @DEV@$(srcdir)/mksiglist.h: $(srcdir)/siglist.in
+ @DEV@ awk 'BEGIN {print "/* public domain */\n"} /^    [A-Z]/ {printf("#ifdef SIG%s\n    if (my_sys_siglist[SIG%s] == NULL)\n\tmy_sys_siglist[SIG%s] = \"%s\";\n#endif\n", $$1, $$1, $$1, substr($$0, 13))}' < $(srcdir)/siglist.in > $@
+Index: sudo-1.8.3p2/common/Makefile.in
+===================================================================
+--- sudo-1.8.3p2.orig/common/Makefile.in       2012-03-13 17:46:43.013036558 +0100
++++ sudo-1.8.3p2/common/Makefile.in    2012-03-13 17:47:12.949037698 +0100
+@@ -35,6 +35,9 @@
+ # Usually -O and/or -g
+ CFLAGS = @CFLAGS@
++# Linker flags
++LDFLAGS = @LDFLAGS@
++
+ # OS dependent defines
+ DEFS = @OSDEFS@
+@@ -56,7 +59,7 @@
+       $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
+ libcommon.la: $(LTOBJS)
+-      $(LIBTOOL) --mode=link $(CC) -o $@ $(LTOBJS) -no-install
++      $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(LTOBJS) -no-install
+ pre-install:
+Index: sudo-1.8.3p2/plugins/sudoers/Makefile.in
+===================================================================
+--- sudo-1.8.3p2.orig/plugins/sudoers/Makefile.in      2012-03-13 17:46:42.985036557 +0100
++++ sudo-1.8.3p2/plugins/sudoers/Makefile.in   2012-03-13 17:47:12.949037698 +0100
+@@ -159,7 +159,7 @@
+       (cd $(top_builddir) && ./config.status --file plugins/sudoers/Makefile)
+ libparsesudoers.la: $(LIBPARSESUDOERS_OBJS)
+-      $(LIBTOOL) --mode=link $(CC) -o $@ $(LIBPARSESUDOERS_OBJS) -no-install
++      $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(LIBPARSESUDOERS_OBJS) -no-install
+ sudoers.la: $(SUDOERS_OBJS) $(LT_LIBS) libparsesudoers.la
+       $(LIBTOOL) @LT_STATIC@ --mode=link $(CC) $(SUDOERS_LDFLAGS) $(LTLDFLAGS) -o $@ $(SUDOERS_OBJS) libparsesudoers.la $(SUDOERS_LIBS) -module -export-symbols $(srcdir)/sudoers.sym -avoid-version -rpath $(plugindir)
index 5e1f561771fda7cd2b9842f5e461c94ed29d302d..dafb5625ba89ecd00d1d826d7c26e92248e37e22 100644 (file)
@@ -1,2 +1,3 @@
 typo-in-classic-insults.diff
 paths-in-samples.diff
+actually-use-buildflags.diff
index 6c3c35c79451a6b2989f49c74ade0ba8bb0f4ede..71a316d97e53f01d97aa1bb4abea84e7aa14ee37 100644 (file)
@@ -159,7 +159,7 @@ Makefile: $(srcdir)/Makefile.in
        (cd $(top_builddir) && ./config.status --file plugins/sudoers/Makefile)
 
 libparsesudoers.la: $(LIBPARSESUDOERS_OBJS)
-       $(LIBTOOL) --mode=link $(CC) -o $@ $(LIBPARSESUDOERS_OBJS) -no-install
+       $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(LIBPARSESUDOERS_OBJS) -no-install
 
 sudoers.la: $(SUDOERS_OBJS) $(LT_LIBS) libparsesudoers.la
        $(LIBTOOL) @LT_STATIC@ --mode=link $(CC) $(SUDOERS_LDFLAGS) $(LTLDFLAGS) -o $@ $(SUDOERS_OBJS) libparsesudoers.la $(SUDOERS_LIBS) -module -export-symbols $(srcdir)/sudoers.sym -avoid-version -rpath $(plugindir)
index 49ed68e874030c46bf92f0ac595d2e061820f9e1..d81a368277fe40482b78a8ac700dffb8accc9e22 100644 (file)
@@ -101,7 +101,7 @@ libsudo_noexec.la: sudo_noexec.lo
        $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(LTLDFLAGS) -o $@ sudo_noexec.lo -avoid-version -rpath $(noexecdir)
 
 sesh: sesh.o
-       $(CC) -o $@ sesh.o
+       $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ sesh.o
 
 pre-install: