external/gpgmepp/UnpackedTarball_gpgmepp.mk    |    1 +
 external/gpgmepp/asan.patch                    |   14 ++++++++++++++
 solenv/gbuild/CppunitTest.mk                   |    2 +-
 xmlsecurity/CppunitTest_xmlsecurity_signing.mk |    8 ++++++++
 4 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit d15f042abd5a1093984a0c8380837145f38c4efc
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Mon Dec 11 17:07:50 2017 +0100

    CppunitTest_xmlsecurity_signing failed in sanitizer builds
    
    ...because external/gpgmepp spawns /usr/bin/gpgconf (and later on 
/usr/bin/ggp2,
    /usr/bin/gpgsm) which all depend on libgpg-error.so.0, so due to 
CppunitTest's
    LD_LIBRARY_PATH will pick up instdir/program/libgpg-error.so.0, which fails 
due
    to
    
    > /usr/bin/gpgconf: symbol lookup error: 
/data/sbergman/lo-san/core/instdir/program/libgpg-error.so.0: undefined symbol: 
__asan_option_detect_stack_use_after_return
    
    The easiest fix appears to be, when running sanitizers on Linux, to hack
    gpgmepp's _gpgme_io_spawn to set LD_LIBRARY_PATH back to its original state.
    (When it was originally unset, it will now be set but null, but that should 
not
    make a difference.)  This requires EXTRA_ENV_VARS to be set earlier in
    CppunitTest.mk, so setting LIBO_LD_PATH doesn't use the LD_LIBRARY_PATH 
value
    set in gb_CppunitTest_CPPTESTPRECOMMAND.
    
    The backtrace of the first, originally failing call to _gpgme_io_spawn 
during
    CppunitTest_xmlsecurity_signing:
    
    > #0  0x00007fffe1f354dc in _gpgme_io_spawn (path=0x1 <error: Cannot access 
memory at address 0x1>, argv=0x7ffff2fbd4e0, flags=0, fd_list=0x9, atfork=0x4e, 
atforkvalue=0x7ffff2fbd4e0, r_pid=0x7ffff2fbd4e0) at posix-io.c:433
    > #1  0x00007fffe1f41971 in read_gpgconf_dirs (pgmname=0x6110002f8e00 
"/usr/bin/gpgconf", components=0) at dirinfo.c:206
    > #2  0x00007fffe1f3fa29 in get_gpgconf_item (what=12) at dirinfo.c:284
    > #3  0x00007fffe1f4073e in _gpgme_get_default_gpg_name () at dirinfo.c:370
    > #4  0x00007fffe1e87093 in engine_get_file_name 
(proto=GPGME_PROTOCOL_OpenPGP) at engine.c:79
    > #5  0x00007fffe1e84e89 in gpgme_get_engine_info (info=0x7ffff2a06160) at 
engine.c:230
    > #6  0x00007fffe1e845ef in gpgme_engine_check_version 
(proto=GPGME_PROTOCOL_OpenPGP) at engine.c:144
    > #7  0x00007fffe634e7d9 in GpgME::checkEngine(GpgME::Protocol) 
(proto=GpgME::OpenPGP) at context.cpp:1610
    > #8  0x00007fff8df3fd49 in 
SecurityEnvironmentGpg::SecurityEnvironmentGpg() (this=0x6060005825c0) at 
xmlsecurity/source/gpg/SecurityEnvironment.cxx:30
    > #9  0x00007fff8df5755e in 
SEInitializerGpg::createSecurityContext(rtl::OUString const&) 
(this=0x606000582560) at xmlsecurity/source/gpg/SEInitializer.cxx:45
    > #10 0x00007fff8df57bb3 in non-virtual thunk to 
SEInitializerGpg::createSecurityContext(rtl::OUString const&) () at 
include/rtl/stringutils.hxx:170
    > #11 0x00007fffab66de90 in DocumentSignatureManager::init() 
(this=0x7ffff2fbb020) at 
xmlsecurity/source/helper/documentsignaturemanager.cxx:78
    > #12 0x00007fffab498504 in 
DocumentDigitalSignatures::ImplVerifySignatures(com::sun::star::uno::Reference<com::sun::star::embed::XStorage>
 const&, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> 
const&, DocumentSignatureMode) (this=0x6080001aaf20, rxStorage=uno::Reference 
to (OStorage *) 0x60d0003a4c48, xSignStream=empty uno::Reference, 
eMode=DocumentSignatureMode::Content) at 
xmlsecurity/source/component/documentdigitalsignatures.cxx:264
    > #13 0x00007fffab497f8b in 
DocumentDigitalSignatures::verifyDocumentContentSignatures(com::sun::star::uno::Reference<com::sun::star::embed::XStorage>
 const&, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> 
const&) (this=0x6080001aaf20, rxStorage=uno::Reference to (OStorage *) 
0x60d0003a4c48, xSignInStream=empty uno::Reference) at 
xmlsecurity/source/component/documentdigitalsignatures.cxx:127
    > #14 0x00007fffab49c35b in non-virtual thunk to 
DocumentDigitalSignatures::verifyDocumentContentSignatures(com::sun::star::uno::Reference<com::sun::star::embed::XStorage>
 const&, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> 
const&) () at include/cppu/unotype.hxx:136
    > #15 0x00007fffafc062a3 in SfxObjectShell::ImplAnalyzeSignature(bool, 
com::sun::star::uno::Reference<com::sun::star::security::XDocumentDigitalSignatures>
 const&) (this=0x61100021c7c0, bScriptingContent=false, xSigner=empty 
uno::Reference) at sfx2/source/doc/objserv.cxx:1293
    > #16 0x00007fffafc074b1 in SfxObjectShell::ImplGetSignatureState(bool) 
(this=0x61100021c7c0, bScriptingContent=false) at 
sfx2/source/doc/objserv.cxx:1322
    > #17 0x00007fffafc0383d in SfxObjectShell::GetDocumentSignatureState() 
(this=0x61100021c7c0) at sfx2/source/doc/objserv.cxx:1485
    > #18 0x00007fffafbb323c in 
SfxObjectShell::CheckForBrokenDocSignatures_Impl() (this=0x61100021c7c0) at 
sfx2/source/doc/objmisc.cxx:981
    > #19 0x00007fffafbb2da4 in SfxObjectShell::CheckSecurityOnLoading_Impl() 
(this=0x61100021c7c0) at sfx2/source/doc/objmisc.cxx:931
    > #20 0x00007fffafbb95cf in SfxObjectShell::FinishedLoading(SfxLoadedFlags) 
(this=0x61100021c7c0, nFlags=SfxLoadedFlags::ALL) at 
sfx2/source/doc/objmisc.cxx:1079
    > #21 0x00007fff716a9185 in SwDocShell::LoadingFinished() 
(this=0x61100021c7c0) at sw/source/uibase/app/docsh.cxx:1153
    > #22 0x00007fff71759ada in SwDocShell::Load(SfxMedium&) 
(this=0x61100021c7c0, rMedium=...) at sw/source/uibase/app/docshini.cxx:581
    > #23 0x00007fffafc2bd9a in SfxObjectShell::LoadOwnFormat(SfxMedium&) 
(this=0x61100021c7c0, rMedium=...) at sfx2/source/doc/objstor.cxx:2971
    > #24 0x00007fffafc3128c in SfxObjectShell::DoLoad(SfxMedium*) 
(this=0x61100021c7c0, pMed=0x60300083dac0) at sfx2/source/doc/objstor.cxx:714
    > #25 0x00007fffafdd88d8 in 
SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>
 const&) (this=0x6190000fb0b0, seqArguments=uno::Sequence of length 13 = {...}) 
at sfx2/source/doc/sfxbasemodel.cxx:1788
    > #26 0x00007fffb049a98a in (anonymous 
namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>
 const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) 
(this=0x6060004aaec0, rArgs=uno::Sequence of length 11 = {...}, 
_rTargetFrame=uno::Reference to ((anonymous namespace)::Frame *) 
0x6160000c63f0) at sfx2/source/view/frmload.cxx:693
    > #27 0x00007fff82d6a7ee in framework::LoadEnv::impl_loadContent() 
(this=0x7ffff2fe3040) at framework/source/loadenv/loadenv.cxx:1105
    > #28 0x00007fff82d5aa6b in framework::LoadEnv::startLoading() 
(this=0x7ffff2fe3040) at framework/source/loadenv/loadenv.cxx:374
    > #29 0x00007fff82d56633 in 
framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader>
 const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> 
const&, rtl::OUString const&, rtl::OUString const&, int, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) 
(xLoader=uno::Reference to (framework::Desktop *) 0x6160000153f8, 
xContext=uno::Reference to (cppu::ComponentContext *) 0x611000002b10, 
sURL="file:///xmlsecurity/qa/unit/signing/data/goodGPG.odt", 
sTarget="_default", nFlags=0, lArgs=uno::Sequence of length 2 = {...}) at 
framework/source/loadenv/loadenv.cxx:160
    > #30 0x00007fff82ec93f0 in 
framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString 
const&, int, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) 
(this=0x616000015380, 
sURL="file:///xmlsecurity/qa/unit/signing/data/goodGPG.odt", 
sTargetFrameName="_default", nSearchFlags=0, lArguments=uno::Sequence of length 
2 = {...}) at framework/source/services/desktop.cxx:618
    > #31 0x00007fff82ec95eb in non-virtual thunk to 
framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString 
const&, int, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) () 
at include/rtl/stringutils.hxx:170
    > #32 0x00007fffabe3097d in 
unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString 
const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> 
const&) (this=0x60c000035e48, 
rURL="file:///xmlsecurity/qa/unit/signing/data/goodGPG.odt", 
rDocService="com.sun.star.text.TextDocument", rExtraArgs=empty uno::Sequence) 
at unotest/source/cpp/macros_test.cxx:50
    > #33 0x00007fffb2ba9d2a in SigningTest::createDoc(rtl::OUString const&) 
(this=0x60c000035e00, 
rURL="file:///xmlsecurity/qa/unit/signing/data/goodGPG.odt") at 
xmlsecurity/qa/unit/signing/signing.cxx:204
    > #34 0x00007fffb2bd1532 in SigningTest::testODFGoodGPG() 
(this=0x60c000035e00) at xmlsecurity/qa/unit/signing/signing.cxx:690
    > #35 0x00007fffb2c304fd in std::__invoke_impl<void, void 
(SigningTest::*&)(), SigningTest*&>(std::__invoke_memfun_deref, void 
(SigningTest::*&)(), SigningTest*&) (__f=@0x6030001f0480: (void 
(SigningTest::*)(SigningTest * const)) 0x7fffb2bd0d80 
<SigningTest::testODFGoodGPG()>, __t=@0x6030001f0490: 0x60c000035e00) at 
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/invoke.h:73
    > #36 0x00007fffb2c300e0 in std::__invoke<void (SigningTest::*&)(), 
SigningTest*&>(void (SigningTest::*&)(), SigningTest*&) (__fn=@0x6030001f0480: 
(void (SigningTest::*)(SigningTest * const)) 0x7fffb2bd0d80 
<SigningTest::testODFGoodGPG()>, __args=@0x6030001f0490: 0x60c000035e00) at 
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/invoke.h:95
    > #37 0x00007fffb2c2ff2f in std::_Bind<void 
(SigningTest::*(SigningTest*))()>::__call<void, , 0ul>(std::tuple<>&&, 
std::_Index_tuple<0ul>) (this=0x6030001f0480, __args=...) at 
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/functional:467
    > #38 0x00007fffb2c2fb23 in std::_Bind<void 
(SigningTest::*(SigningTest*))()>::operator()<, void>() (this=0x6030001f0480) 
at /usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/functional:549
    > #39 0x00007fffb2c2e8d1 in std::_Function_handler<void (), std::_Bind<void 
(SigningTest::*(SigningTest*))()> >::_M_invoke(std::_Any_data const&) 
(__functor=...) at 
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/std_function.h:316
    > #40 0x00007fffb2c30b1c in std::function<void ()>::operator()() const 
(this=0x608000083660) at 
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/std_function.h:706
    > #41 0x00007fffb2c2db41 in CppUnit::TestCaller<SigningTest>::runTest() 
(this=0x608000083620) at 
workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:175
    > #42 0x00007ffff78fc159 in CppUnit::TestCaseMethodFunctor::operator()() 
const (this=0x7ffff2e9c0d0) at TestCase.cpp:32
    > #43 0x00007fffdc3cc8e3 in (anonymous 
namespace)::Protector::protect(CppUnit::Functor const&, 
CppUnit::ProtectorContext const&) (this=0x602000019910, functor=...) at 
test/source/vclbootstrapprotector.cxx:48
    > #44 0x00007ffff78ccf96 in 
CppUnit::ProtectorChain::ProtectFunctor::operator()() const 
(this=0x6030002189e0) at ProtectorChain.cpp:20
    > #45 0x00007fffe8938ab3 in (anonymous 
namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext 
const&) (this=0x6020000003f0, functor=...) at 
unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89
    > #46 0x00007ffff78ccf96 in 
CppUnit::ProtectorChain::ProtectFunctor::operator()() const 
(this=0x603000218a10) at ProtectorChain.cpp:20
    > #47 0x00007fffebc1e492 in (anonymous 
namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext 
const&) (this=0x602000000250, functor=..., context=...) at 
unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:63
    > #48 0x00007ffff78ccf96 in 
CppUnit::ProtectorChain::ProtectFunctor::operator()() const 
(this=0x603000218a40) at ProtectorChain.cpp:20
    > #49 0x00007ffff7863084 in 
CppUnit::DefaultProtector::protect(CppUnit::Functor const&, 
CppUnit::ProtectorContext const&) (this=0x602000000150, functor=..., 
context=...) at DefaultProtector.cpp:15
    > #50 0x00007ffff78ccf96 in 
CppUnit::ProtectorChain::ProtectFunctor::operator()() const 
(this=0x603000218a70) at ProtectorChain.cpp:20
    > #51 0x00007ffff78c68f5 in 
CppUnit::ProtectorChain::protect(CppUnit::Functor const&, 
CppUnit::ProtectorContext const&) (this=0x60b000000510, functor=..., 
context=...) at ProtectorChain.cpp:86
    > #52 0x00007ffff795e259 in CppUnit::TestResult::protect(CppUnit::Functor 
const&, CppUnit::Test*, std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&) (this=0x7ffff2f000a0, 
functor=..., test=0x608000083620, shortDescription="") at TestResult.cpp:182
    > #53 0x00007ffff78fa785 in CppUnit::TestCase::run(CppUnit::TestResult*) 
(this=0x608000083620, result=0x7ffff2f000a0) at TestCase.cpp:91
    > #54 0x00007ffff798c2fe in 
CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) 
(this=0x608000081820, result=0x7ffff2f000a0) at TestRunner.cpp:47
    > #55 0x00007ffff795ccdf in CppUnit::TestResult::runTest(CppUnit::Test*) 
(this=0x7ffff2f000a0, test=0x608000081820) at TestResult.cpp:149
    > #56 0x00007ffff798d23f in CppUnit::TestRunner::run(CppUnit::TestResult&, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > 
const&) (this=0x7ffff2f4db00, controller=..., testPath="") at TestRunner.cpp:96
    > #57 0x000000000052e3a9 in (anonymous 
namespace)::ProtectedFixtureFunctor::run() const (this=0x7ffff2f00350) at 
sal/cppunittester/cppunittester.cxx:319
    > #58 0x000000000052ae38 in sal_main() () at 
sal/cppunittester/cppunittester.cxx:469
    > #59 0x0000000000529e2c in main(int, char**) (argc=23, 
argv=0x7fffffff2798) at sal/cppunittester/cppunittester.cxx:376
    
    Change-Id: I386a3b316c78344c2449568894c0f03ba39b1bf0
    Reviewed-on: https://gerrit.libreoffice.org/46249
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/external/gpgmepp/UnpackedTarball_gpgmepp.mk 
b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
index bcddcca1a218..931d163d7576 100644
--- a/external/gpgmepp/UnpackedTarball_gpgmepp.mk
+++ b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
@@ -23,5 +23,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,gpgmepp, \
     $(if $(filter MSC,$(COM)),external/gpgmepp/w32-fix-libtool.patch.1) \
     $(if $(filter MSC,$(COM)),external/gpgmepp/w32-add-initializer.patch.1) \
     external/gpgmepp/w32-build-fixes-2.patch \
+    $(if $(ENABLE_RUNTIME_OPTIMIZATIONS),,external/gpgmepp/asan.patch) \
 ))
 # vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/asan.patch b/external/gpgmepp/asan.patch
new file mode 100644
index 000000000000..526da3336504
--- /dev/null
+++ b/external/gpgmepp/asan.patch
@@ -0,0 +1,14 @@
+--- src/posix-io.c
++++ src/posix-io.c
+@@ -468,6 +468,11 @@
+ 
+         if (atfork)
+           atfork (atforkvalue, 0);
++          char const * ld_path = getenv("LIBO_LD_PATH");
++          if (!ld_path)
++            abort();
++          if (setenv("LD_LIBRARY_PATH", ld_path, 1) != 0)
++            abort();
+ 
+           /* First close all fds which will not be inherited.  If we
+            * have closefrom(2) we first figure out the highest fd we
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 310d39ea61bb..45af5c9b25a7 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -125,13 +125,13 @@ else
                ( \
                $(if $(gb_CppunitTest_localized),for l in $(WITH_LANG_LIST) ; 
do LO_TEST_LOCALE="$$l" ) \
                $(if 
$(gb_CppunitTest_PREGDBTRACE),$(gb_CppunitTest_PREGDBTRACE) &&) \
+               $(EXTRA_ENV_VARS) \
                $(if $(filter 
gdb,$(gb_CppunitTest_GDBTRACE)),,$(gb_CppunitTest_CPPTESTPRECOMMAND)) \
                $(if $(G_SLICE),G_SLICE=$(G_SLICE)) \
                $(if 
$(GLIBCXX_FORCE_NEW),GLIBCXX_FORCE_NEW=$(GLIBCXX_FORCE_NEW)) \
                $(gb_CppunitTest_malloc_check) \
                $(if $(strip $(PYTHON_URE)),\
                        PYTHONDONTWRITEBYTECODE=1) \
-               $(EXTRA_ENV_VARS) \
                $(ICECREAM_RUN) $(gb_CppunitTest_GDBTRACE) 
$(gb_CppunitTest_VALGRINDTOOL) $(gb_CppunitTest_CPPTESTCOMMAND) \
                $(call gb_LinkTarget_get_target,$(call 
gb_CppunitTest_get_linktarget,$*)) \
                $(call gb_CppunitTest__make_args) "-env:CPPUNITTESTTARGET=$@" \
diff --git a/xmlsecurity/CppunitTest_xmlsecurity_signing.mk 
b/xmlsecurity/CppunitTest_xmlsecurity_signing.mk
index e39e5c085bac..bad092e6675b 100644
--- a/xmlsecurity/CppunitTest_xmlsecurity_signing.mk
+++ b/xmlsecurity/CppunitTest_xmlsecurity_signing.mk
@@ -52,4 +52,12 @@ ifeq ($(ENABLE_PDFIMPORT),TRUE)
 $(eval $(call gb_CppunitTest_use_executable,xmlsecurity_signing,xpdfimport))
 endif
 
+ifeq ($(ENABLE_RUNTIME_OPTIMIZATIONS),)
+ifeq ($(OS),LINUX)
+$(call gb_CppunitTest_get_target,xmlsecurity_signing): \
+    EXTRA_ENV_VARS := \
+        LIBO_LD_PATH=$$LD_LIBRARY_PATH
+endif
+endif
+
 # vim: set noet sw=4 ts=4:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to