tsan: use of freed mutex

Because the mutex has already been freed because raptor calls
xmlCleanupParser

I have logged a feature request against raptor for a flag to turn off
this behaviour, but until that lands, this will have to do.

-----

make CppunitTest_filter_pdf results in

WARNING: ThreadSanitizer: use of an invalid mutex (e.g. uninitialized or
destroyed) (pid=330602)
0 pthread_mutex_lock
/home/noel/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1371
(discriminator 8) (cppunittester+0x7e1be)
1 xmlDictFree ??:? (libxml2.so.2+0x3404b) (BuildId:
14c9410dbe8278dfa121dabc48c9ae25eac169d1)
2 lt_xml_unref
/home/noel/libo-tsan/workdir/UnpackedTarball/liblangtag/liblangtag/lt-xml.c:351
(liblangtag-lo.so.1+0x1fc6a)
3 lt_db_finalize
/home/noel/libo-tsan/workdir/UnpackedTarball/liblangtag/liblangtag/lt-database.c:144
(liblangtag-lo.so.1+0xac22)
4 (anonymous namespace)::LiblangtagDataRef::teardown()
/home/noel/libo-tsan/i18nlangtag/source/languagetag/languagetag.cxx:219
(libi18nlangtag.so+0x20951)
5 (anonymous namespace)::LiblangtagDataRef::~LiblangtagDataRef()
/home/noel/libo-tsan/i18nlangtag/source/languagetag/languagetag.cxx:204
(libi18nlangtag.so+0x20951)
6 cxa_at_exit_callback_installed_at(void*)
/home/noel/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:445
(cppunittester+0x6e3af)
7 LanguageTagImpl::canonicalize()
/home/noel/libo-tsan/i18nlangtag/source/languagetag/languagetag.cxx:190
(libi18nlangtag.so+0xe370)
8 main /home/noel/libo-tsan/sal/cppunittester/cppunittester.cxx:482
(cppunittester+0x10cf6c)

Change-Id: I5d9ff1c5667f8e19e5858cd5a408e8f95d2a98e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177320
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2024-11-26 10:41:39 +02:00
parent c41d2eb41d
commit fa50b71fb8
2 changed files with 15 additions and 0 deletions

View file

@ -30,6 +30,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,raptor,\
external/redland/raptor/xml2-config.patch \
external/redland/raptor/raptor-libxml2-11.patch.1 \
$(if $(SYSTEM_ICU),,external/redland/raptor/raptor-icu.patch) \
external/redland/raptor/disable-libxml-cleanup.patch.1 \
))
# vim: set noet sw=4 ts=4:

View file

@ -0,0 +1,14 @@
diff -ur raptor.org/src/raptor_libxml.c raptor/src/raptor_libxml.c
--- raptor.org/src/raptor_libxml.c 2024-11-26 10:21:41.759955398 +0200
+++ raptor/src/raptor_libxml.c 2024-11-26 10:23:43.891720421 +0200
@@ -657,7 +657,10 @@
xmlSetGenericErrorFunc(world->libxml_saved_generic_error_context,
world->libxml_saved_generic_error_handler);
+// I have logged a feature request to have a flag to turn this off, at https://github.com/dajobe/raptor/issues/69
+#if 0
xmlCleanupParser();
+#endif
}