Package: libxml2 Version: 2.7.8.dfsg-7 Severity: important Tags: patch Dear Maintainer,
The hardening flags are missing for the python modules because
debian/rules overwrites them.
The attached patch fixes the issue and also passes
-Wl,--as-needed in LDFLAGS. -O0 overwrites the previous -O2 set
by dpkg-buildflags, so -O0 correctly takes effect.
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/python2.6/dist-packages/libxml2mod.so
/usr/lib/python2.7/dist-packages/libxml2mod.so
/usr/lib/python2.6/dist-packages/libxml2mod_d.so
/usr/lib/python2.7/dist-packages/libxml2mod_d.so ...
/usr/lib/python2.6/dist-packages/libxml2mod.so:
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!
/usr/lib/python2.7/dist-packages/libxml2mod.so:
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!
/usr/lib/python2.6/dist-packages/libxml2mod_d.so:
Position Independent Executable: no, regular shared library (ignored)
Stack protected: yes
Fortify Source functions: no, only unprotected functions found!
Read-only relocations: yes
Immediate binding: no not found!
/usr/lib/python2.7/dist-packages/libxml2mod_d.so:
Position Independent Executable: no, regular shared library (ignored)
Stack protected: yes
Fortify Source functions: no, only unprotected 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
diff -u libxml2-2.7.8.dfsg/debian/rules libxml2-2.7.8.dfsg/debian/rules --- libxml2-2.7.8.dfsg/debian/rules +++ libxml2-2.7.8.dfsg/debian/rules @@ -7,7 +7,7 @@ CFLAGS = `dpkg-buildflags --get CFLAGS` CFLAGS += -Wall -LDFLAGS = `dpkg-buildflags --get LDFLAGS` +LDFLAGS = `dpkg-buildflags --get LDFLAGS` -Wl,--as-needed CPPFLAGS = `dpkg-buildflags --get CPPFLAGS` ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) @@ -26,7 +26,7 @@ export DH_OPTIONS = -Nlibxml2-udeb endif -CONFIGURE_FLAGS := --with-history CC="$(CC) -Wl,--as-needed" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" --cache-file="$(CURDIR)/build/config.cache" +CONFIGURE_FLAGS := --with-history CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" --cache-file="$(CURDIR)/build/config.cache" override_dh_auto_configure: $(TARGETS:%=configure-%) @@ -46,7 +46,7 @@ build-python%: BUILD_DIR=build/main/$* build-python%: BUILD_FLAGS = libxml2mod_la_LIBADD='$$(mylibs)' -build-python%-dbg: BUILD_FLAGS += PYTHON_INCLUDES=/usr/include/$(*:-dbg=_d) LDFLAGS="-L$(CURDIR)/debian/tmp/usr/lib" CFLAGS="-Wall -g -O0" +build-python%-dbg: BUILD_FLAGS += PYTHON_INCLUDES=/usr/include/$(*:-dbg=_d) CFLAGS="$(CFLAGS) -Wall -g -O0" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS) -L$(CURDIR)/debian/tmp/usr/lib" override_dh_auto_clean: rm -rf build debian/tmp-dbg
signature.asc
Description: Digital signature

