[apparmor] Memory leaks in parser/parser_regex.c (at least)
intrigeri
intrigeri at debian.org
Fri Oct 16 18:07:35 UTC 2015
Hi,
Steve Beattie wrote (31 Aug 2015 18:13:42 GMT) :
> On Sat, Aug 29, 2015 at 10:56:53AM +0200, intrigeri wrote:
>> Can it be because the Python interpreter wasn't built with ASan?
>> (I was told that whenever a library is built with ASan, all reverse
>> build-deps must be built with ASan as well; my knowledge in this area
>> is basically non-existing, though, and that's just hearsay.)
> I don't really know very much about the details of ASan either. You
> could try the following untested patch (not intended for upstreaming,
> unless we gain a build configuration option to build with the address
> sanitizer):
> ---
> libraries/libapparmor/swig/python/test/Makefile.am | 1 +
> 1 file changed, 1 insertion(+)
> Index: b/libraries/libapparmor/swig/python/test/Makefile.am
> ===================================================================
> --- a/libraries/libapparmor/swig/python/test/Makefile.am
> +++ b/libraries/libapparmor/swig/python/test/Makefile.am
> @@ -15,6 +15,7 @@ PYTHON_DIST_BUILD_PATH = '$(builddir)/..
>
> TESTS = test_python.py
> TESTS_ENVIRONMENT = \
> + LD_PRELOAD=/usr/lib/${DEB_HOST_MULTIARCH}/libasan.so.1 \
> LD_LIBRARY_PATH='$(top_builddir)/src/.libs:$(PYTHON_DIST_BUILD_PATH)' \
> PYTHONPATH='$(PYTHON_DIST_BUILD_PATH)'
>
I see that:
FAIL: test_python.py
============================================================================
Testsuite summary for
============================================================================
# TOTAL: 1
# PASS: 0
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0
============================================================================
See swig/python/test/test-suite.log
============================================================================
Makefile:541: recipe for target 'test-suite.log' failed
make[7]: *** [test-suite.log] Error 1
make[7]: Leaving directory '/build/apparmor-2.10/libraries/libapparmor.python2.7/swig/python/test'
Makefile:647: recipe for target 'check-TESTS' failed
make[6]: *** [check-TESTS] Error 2
make[6]: Leaving directory '/build/apparmor-2.10/libraries/libapparmor.python2.7/swig/python/test'
Makefile:720: recipe for target 'check-am' failed
make[5]: *** [check-am] Error 2
make[5]: Leaving directory '/build/apparmor-2.10/libraries/libapparmor.python2.7/swig/python/test'
Makefile:377: recipe for target 'check-recursive' failed
make[4]: *** [check-recursive] Error 1
make[4]: Leaving directory '/build/apparmor-2.10/libraries/libapparmor.python2.7/swig/python'
Makefile:374: recipe for target 'check-recursive' failed
make[3]: *** [check-recursive] Error 1
make[3]: Leaving directory '/build/apparmor-2.10/libraries/libapparmor.python2.7/swig'
Makefile:406: recipe for target 'check-recursive' failed
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory '/build/apparmor-2.10/libraries/libapparmor.python2.7'
dh_auto_test: make -j1 check PYTHON=/usr/bin/python2.7 returned exit code 2
debian/rules:52: recipe for target 'override_dh_auto_test' failed
make[1]: *** [override_dh_auto_test] Error 2
make[1]: Leaving directory '/build/apparmor-2.10'
debian/rules:14: recipe for target 'build' failed
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
E: Failed autobuilding of package
I: user script /var/cache/pbuilder/build/14153/tmp/hooks/C10_launch_shell starting
I: installing necessary tools to work in the damn chroot
debconf: delaying package configuration, since apt-utils is not installed
ensifera# ls libraries/libapparmor.python2.7/swig/python/test/test-suite.log
libraries/libapparmor.python2.7/swig/python/test/test-suite.log
ensifera# cat libraries/libapparmor.python2.7/swig/python/test/test-suite.log
=======================================
: swig/python/test/test-suite.log
=======================================
# TOTAL: 1
# PASS: 0
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0
.. contents:: :depth: 2
FAIL: test_python.py
====================
==26602==Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING.
==26602==Process memory map follows:
0x000000400000-0x0000006e1000 /usr/bin/python2.7
0x0000008e0000-0x0000008e1000 /usr/bin/python2.7
0x0000008e1000-0x000000958000 /usr/bin/python2.7
0x000000958000-0x000000969000
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x600000000000-0x602000000000
0x602000000000-0x602000010000
0x602000010000-0x603000000000
0x603000000000-0x603000010000
0x603000010000-0x604000000000
0x604000000000-0x604000010000
0x604000010000-0x606000000000
0x606000000000-0x606000010000
0x606000010000-0x607000000000
0x607000000000-0x607000010000
0x607000010000-0x608000000000
0x608000000000-0x608000010000
0x608000010000-0x60b000000000
0x60b000000000-0x60b000010000
0x60b000010000-0x60c000000000
0x60c000000000-0x60c000010000
0x60c000010000-0x60d000000000
0x60d000000000-0x60d000010000
0x60d000010000-0x60e000000000
0x60e000000000-0x60e000010000
0x60e000010000-0x60f000000000
0x60f000000000-0x60f000010000
0x60f000010000-0x610000000000
0x610000000000-0x610000010000
0x610000010000-0x611000000000
0x611000000000-0x611000010000
0x611000010000-0x612000000000
0x612000000000-0x612000010000
0x612000010000-0x613000000000
0x613000000000-0x613000010000
0x613000010000-0x614000000000
0x614000000000-0x614000020000
0x614000020000-0x615000000000
0x615000000000-0x615000020000
0x615000020000-0x616000000000
0x616000000000-0x6160000c0000
0x6160000c0000-0x617000000000
0x617000000000-0x6170000d0000
0x6170000d0000-0x618000000000
0x618000000000-0x618000030000
0x618000030000-0x619000000000
0x619000000000-0x619000050000
0x619000050000-0x61a000000000
0x61a000000000-0x61a000020000
0x61a000020000-0x61b000000000
0x61b000000000-0x61b000020000
0x61b000020000-0x61c000000000
0x61c000000000-0x61c000020000
0x61c000020000-0x61d000000000
0x61d000000000-0x61d000020000
0x61d000020000-0x61e000000000
0x61e000000000-0x61e000030000
0x61e000030000-0x61f000000000
0x61f000000000-0x61f000070000
0x61f000070000-0x620000000000
0x620000000000-0x620000020000
0x620000020000-0x621000000000
0x621000000000-0x621000250000
0x621000250000-0x622000000000
0x622000000000-0x622000020000
0x622000020000-0x623000000000
0x623000000000-0x623000030000
0x623000030000-0x624000000000
0x624000000000-0x624000030000
0x624000030000-0x625000000000
0x625000000000-0x625000050000
0x625000050000-0x626000000000
0x626000000000-0x626000030000
0x626000030000-0x627000000000
0x627000000000-0x627000060000
0x627000060000-0x628000000000
0x628000000000-0x628000010000
0x628000010000-0x629000000000
0x629000000000-0x629000020000
0x629000020000-0x62a000000000
0x62a000000000-0x62a000020000
0x62a000020000-0x62b000000000
0x62b000000000-0x62b000030000
0x62b000030000-0x62d000000000
0x62d000000000-0x62d000050000
0x62d000050000-0x62e000000000
0x62e000000000-0x62e000020000
0x62e000020000-0x62f000000000
0x62f000000000-0x62f000040000
0x62f000040000-0x630000000000
0x630000000000-0x630000020000
0x630000020000-0x631000000000
0x631000000000-0x631000030000
0x631000030000-0x640000000000
0x640000000000-0x640000003000
0x7ff96ca07000-0x7ff96cd59000
0x7ff96cd59000-0x7ff96cd95000 /usr/lib/x86_64-linux-gnu/libubsan.so.0.0.0
0x7ff96cd95000-0x7ff96cf94000 /usr/lib/x86_64-linux-gnu/libubsan.so.0.0.0
0x7ff96cf94000-0x7ff96cf96000 /usr/lib/x86_64-linux-gnu/libubsan.so.0.0.0
0x7ff96cf96000-0x7ff96cf97000 /usr/lib/x86_64-linux-gnu/libubsan.so.0.0.0
0x7ff96cf97000-0x7ff96da68000
0x7ff96da68000-0x7ff96dac5000 /build/apparmor-2.10/libraries/libapparmor.python2.7/src/.libs/libapparmor.so.1.3.0
0x7ff96dac5000-0x7ff96dcc4000 /build/apparmor-2.10/libraries/libapparmor.python2.7/src/.libs/libapparmor.so.1.3.0
0x7ff96dcc4000-0x7ff96dcc5000 /build/apparmor-2.10/libraries/libapparmor.python2.7/src/.libs/libapparmor.so.1.3.0
0x7ff96dcc5000-0x7ff96dcfd000 /build/apparmor-2.10/libraries/libapparmor.python2.7/src/.libs/libapparmor.so.1.3.0
0x7ff96dcfd000-0x7ff96ddef000 /usr/lib/x86_64-linux-gnu/libasan.so.2.0.0
0x7ff96ddef000-0x7ff96dfee000 /usr/lib/x86_64-linux-gnu/libasan.so.2.0.0
0x7ff96dfee000-0x7ff96dff1000 /usr/lib/x86_64-linux-gnu/libasan.so.2.0.0
0x7ff96dff1000-0x7ff96dff2000 /usr/lib/x86_64-linux-gnu/libasan.so.2.0.0
0x7ff96dff2000-0x7ff96ec67000
0x7ff96ec67000-0x7ff96ecc5000 /build/apparmor-2.10/libraries/libapparmor.python2.7/swig/python/build/lib.linux-x86_64-2.7/LibAppArmor/_LibAppArmor.so
0x7ff96ecc5000-0x7ff96eec4000 /build/apparmor-2.10/libraries/libapparmor.python2.7/swig/python/build/lib.linux-x86_64-2.7/LibAppArmor/_LibAppArmor.so
0x7ff96eec4000-0x7ff96eec5000 /build/apparmor-2.10/libraries/libapparmor.python2.7/swig/python/build/lib.linux-x86_64-2.7/LibAppArmor/_LibAppArmor.so
0x7ff96eec5000-0x7ff96eef1000 /build/apparmor-2.10/libraries/libapparmor.python2.7/swig/python/build/lib.linux-x86_64-2.7/LibAppArmor/_LibAppArmor.so
0x7ff96eef1000-0x7ff96ef31000
0x7ff96efa9000-0x7ff96f031000
0x7ff96f031000-0x7ff96f038000 /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
0x7ff96f038000-0x7ff96f238000 /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
0x7ff96f238000-0x7ff96f239000 /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
0x7ff96f239000-0x7ff96f23a000 /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
0x7ff96f23a000-0x7ff96f258000 /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so
0x7ff96f258000-0x7ff96f457000 /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so
0x7ff96f457000-0x7ff96f458000 /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so
0x7ff96f458000-0x7ff96f45c000 /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so
0x7ff96f45c000-0x7ff971762000
0x7ff971762000-0x7ff971778000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7ff971778000-0x7ff971977000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7ff971977000-0x7ff971978000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7ff971978000-0x7ff971ae4000 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
0x7ff971ae4000-0x7ff971ce3000 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
0x7ff971ce3000-0x7ff971ced000 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
0x7ff971ced000-0x7ff971cef000 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
0x7ff971cef000-0x7ff971cf3000
0x7ff971cf3000-0x7ff971e92000 /lib/x86_64-linux-gnu/libc-2.19.so
0x7ff971e92000-0x7ff972092000 /lib/x86_64-linux-gnu/libc-2.19.so
0x7ff972092000-0x7ff972096000 /lib/x86_64-linux-gnu/libc-2.19.so
0x7ff972096000-0x7ff972098000 /lib/x86_64-linux-gnu/libc-2.19.so
0x7ff972098000-0x7ff97209c000
0x7ff97209c000-0x7ff97219c000 /lib/x86_64-linux-gnu/libm-2.19.so
0x7ff97219c000-0x7ff97239b000 /lib/x86_64-linux-gnu/libm-2.19.so
0x7ff97239b000-0x7ff97239c000 /lib/x86_64-linux-gnu/libm-2.19.so
0x7ff97239c000-0x7ff97239d000 /lib/x86_64-linux-gnu/libm-2.19.so
0x7ff97239d000-0x7ff9723b7000 /lib/x86_64-linux-gnu/libz.so.1.2.8
0x7ff9723b7000-0x7ff9725b6000 /lib/x86_64-linux-gnu/libz.so.1.2.8
0x7ff9725b6000-0x7ff9725b7000 /lib/x86_64-linux-gnu/libz.so.1.2.8
0x7ff9725b7000-0x7ff9725b8000 /lib/x86_64-linux-gnu/libz.so.1.2.8
0x7ff9725b8000-0x7ff9725ba000 /lib/x86_64-linux-gnu/libutil-2.19.so
0x7ff9725ba000-0x7ff9727b9000 /lib/x86_64-linux-gnu/libutil-2.19.so
0x7ff9727b9000-0x7ff9727ba000 /lib/x86_64-linux-gnu/libutil-2.19.so
0x7ff9727ba000-0x7ff9727bb000 /lib/x86_64-linux-gnu/libutil-2.19.so
0x7ff9727bb000-0x7ff9727be000 /lib/x86_64-linux-gnu/libdl-2.19.so
0x7ff9727be000-0x7ff9729bd000 /lib/x86_64-linux-gnu/libdl-2.19.so
0x7ff9729bd000-0x7ff9729be000 /lib/x86_64-linux-gnu/libdl-2.19.so
0x7ff9729be000-0x7ff9729bf000 /lib/x86_64-linux-gnu/libdl-2.19.so
0x7ff9729bf000-0x7ff9729d7000 /lib/x86_64-linux-gnu/libpthread-2.19.so
0x7ff9729d7000-0x7ff972bd6000 /lib/x86_64-linux-gnu/libpthread-2.19.so
0x7ff972bd6000-0x7ff972bd7000 /lib/x86_64-linux-gnu/libpthread-2.19.so
0x7ff972bd7000-0x7ff972bd8000 /lib/x86_64-linux-gnu/libpthread-2.19.so
0x7ff972bd8000-0x7ff972bdc000
0x7ff972bdc000-0x7ff972c78000 /usr/lib/x86_64-linux-gnu/libasan.so.1.0.0
0x7ff972c78000-0x7ff972e78000 /usr/lib/x86_64-linux-gnu/libasan.so.1.0.0
0x7ff972e78000-0x7ff972e7b000 /usr/lib/x86_64-linux-gnu/libasan.so.1.0.0
0x7ff972e7b000-0x7ff973ab4000
0x7ff973ab4000-0x7ff973ad4000 /lib/x86_64-linux-gnu/ld-2.19.so
0x7ff973ae3000-0x7ff973cba000
0x7ff973cba000-0x7ff973cbc000
0x7ff973cbc000-0x7ff973cc2000 /etc/ld.so.cache
0x7ff973cc2000-0x7ff973cc3000
0x7ff973cc3000-0x7ff973cc4000
0x7ff973cc4000-0x7ff973ccd000
0x7ff973ccd000-0x7ff973cd4000
0x7ff973cd4000-0x7ff973cd5000 /lib/x86_64-linux-gnu/ld-2.19.so
0x7ff973cd5000-0x7ff973cd6000 /lib/x86_64-linux-gnu/ld-2.19.so
0x7ff973cd6000-0x7ff973cd7000
0x7ffe395dc000-0x7ffe395fe000 [stack]
0x7ffe39732000-0x7ffe39734000 [vvar]
0x7ffe39734000-0x7ffe39736000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==26602==End of process memory map.
FAIL test_python.py (exit status: 1)
>> What should be my next step? Skipping these specific tests and looking
>> for other potential problems later in the build/test process?
> Perhaps. You might try the above patch and see if the resulting
> failures [0] are limited to libapparmor and the swig wrapper, or if the
> ones that look to be in the python interpreter show up for you, too.
I'm sorry I can't decipher what I pasted above to answer
your question.
> Given that we already have lots of outside pressure to make policy
> compilation take less time/resources, the near 2 orders of magnitude
> time increase it took to run through the simple parser tests with ASan
> enabled, I don't think we could justifiably turn it on by default.
Indeed.
> But integrating it in some way into automatic tests would be good,
> to catch future leaks.
Exactly :)
Cheers,
--
intrigeri
More information about the AppArmor
mailing list