[xml/sgml-pkgs] Bug#664107: libxml2: Hardening flags missing for python modules

Simon Ruderich simon at ruderich.org
Thu Mar 15 17:32:28 UTC 2012


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libxml2-hardening-flags.patch
Type: text/x-diff
Size: 1367 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debian-xml-sgml-pkgs/attachments/20120315/f3b835fd/attachment.patch>
-------------- 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-xml-sgml-pkgs/attachments/20120315/f3b835fd/attachment.pgp>


More information about the debian-xml-sgml-pkgs mailing list