[DSE-Dev] Bug#665316: libsepol: CPPFLAGS hardening flags missing

Simon Ruderich simon at ruderich.org
Fri Mar 23 00:43:33 UTC 2012

Package: libsepol
Version: 2.1.4-2
Severity: important
Tags: patch

Dear Maintainer,

The CPPFLAGS hardening flags are missing because the build system
ignores them.

The following patch fixes the issue by adding the CPPFLAGS to

diff -Nru libsepol-2.1.4/debian/rules libsepol-2.1.4/debian/rules
--- libsepol-2.1.4/debian/rules	2012-03-18 16:27:35.000000000 +0100
+++ libsepol-2.1.4/debian/rules	2012-03-23 01:38:42.000000000 +0100
@@ -10,6 +10,10 @@
+# The build system doesn't use CPPFLAGS, pass them to CFLAGS to enable the
+# missing (hardening) flags.
+export DEB_CFLAGS_MAINT_APPEND = $(shell dpkg-buildflags --get CPPFLAGS)
 	dh $@

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/bin/chkcon /lib/x86_64-linux-gnu/libsepol.so.1
     Position Independent Executable: no, normal executable!
     Stack protected: no, not found!
     Fortify Source functions: yes
     Read-only relocations: yes
     Immediate binding: no not found!
     Position Independent Executable: no, regular shared library (ignored)
     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.


[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/selinux-devel/attachments/20120323/005cf7c1/attachment.pgp>

More information about the SELinux-devel mailing list