Bug#665311: gnuplot: CPPFLAGS/CXXFLAGS hardening flags missing

Simon Ruderich simon at ruderich.org
Thu Mar 22 23:55:42 UTC 2012


Package: gnuplot
Version: 4.6.0-1
Severity: important
Tags: patch

Dear Maintainer,

The CPPFLAGS and CXXFLAGS hardening flags are missing because
they are not set in debian/rules. For more information please
have a look at [1], [2] and [3].

The following patch fixes the issue.

diff -Nru gnuplot-4.6.0/debian/rules gnuplot-4.6.0/debian/rules
--- gnuplot-4.6.0/debian/rules	2012-03-22 13:27:51.000000000 +0100
+++ gnuplot-4.6.0/debian/rules	2012-03-23 00:49:33.000000000 +0100
@@ -7,6 +7,8 @@
 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
 CFLAGS := -Wall $(shell dpkg-buildflags --get CFLAGS)
+CXXFLAGS := -Wall $(shell dpkg-buildflags --get CXXFLAGS)
+CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
 LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
 
 # Build structure may link against unneeded libs.
@@ -30,7 +32,7 @@
 	dh_testdir
 	mkdir -p $(BUILDDIR_NOX)
 	cd $(BUILDDIR_NOX);  ../../configure \
-		CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
+		CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
 		--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
 		--prefix=/usr --mandir=\$${prefix}/share/man \
 	  	--infodir=\$${prefix}/share/info \
@@ -47,7 +49,7 @@
 	dh_testdir
 	mkdir -p $(BUILDDIR_X11)
 	cd $(BUILDDIR_X11); ../../configure \
-		CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
+		CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
 		--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
 	  	--prefix=/usr --mandir=\$${prefix}/share/man \
 	  	--infodir=\$${prefix}/share/info \

To check if all flags were correctly enabled you can use
`hardening-check` from the hardening-includes package and check
the build log (hardening-check doesn't catch everything):

    $ hardening-check /usr/lib/gnuplot/gnuplot_x11 /usr/bin/gnuplot ...
    /usr/lib/gnuplot/gnuplot_x11:
     Position Independent Executable: no, normal executable!
     Stack protected: yes
     Fortify Source functions: yes (some protected functions found)
     Read-only relocations: yes
     Immediate binding: no not found!
    /usr/bin/gnuplot:
     Position Independent Executable: no, normal executable!
     Stack protected: yes
     Fortify Source functions: yes (some protected functions found)
     Read-only relocations: yes
     Immediate binding: no not found!
    ...

(Position Independent Executable and Immediate binding is not
enabled by default.)

Use find -type f \( -executable -o -name \*.so\* \) -exec
hardening-check {} + on the build result to check all files.

Regards,
Simon

[1]: https://wiki.debian.org/ReleaseGoals/SecurityHardeningBuildFlags
[2]: https://wiki.debian.org/HardeningWalkthrough
[3]: https://wiki.debian.org/Hardening
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/debian-science-maintainers/attachments/20120323/8239ad42/attachment.pgp>


More information about the debian-science-maintainers mailing list