Bug 72468 - LibreOffice should be able to build with clang/gcc sanitizer
Summary: LibreOffice should be able to build with clang/gcc sanitizer
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.3.0.0.alpha0+ Master
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:4.3.0
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-08 10:10 UTC by Arnaud Versini
Modified: 2018-12-13 15:54 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arnaud Versini 2013-12-08 10:10:08 UTC
Hi

Modern GCC and CLANG have tools to detect errors during runtime, like valgrind but much faster.

Currently those sanitzer are available :
- Adress sanitizer
- Thread sanitizer
- Undefined sanitizer

GCC and CLANG currently don't work on LibreOffice (errors during the build for GCC and can't compile LO on CLANG).

We should add option to the build to use those extensions during LibreOffice build and use those tools to check LibreOffice source code.

Proposition is to use --with-fsanitiz= and the sanitizer name
Comment 1 Arnaud Versini 2013-12-12 20:04:51 UTC
Oups sorry for the mistake, LO doesn't compile on clang/gcc with those option (adress sanitizer...).
Comment 2 Arnaud Versini 2013-12-15 16:07:40 UTC
For example doesn't work on clang with LINKFLAGSNOUNDEFS="-Wl,-z,defs" and adress sanitizer.
Comment 3 Commit Notification 2014-02-11 10:39:45 UTC
Arnaud Versini committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=785c4f10b87ab47b853abf947dfb21117d55cca1

fdo#72468 avoid out of bounds array access



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2014-03-03 07:47:11 UTC
Arnaud Versini committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=160410842be82a4c9a1da58f2e608e9d9c54ebf7

fdo#72468 Remove memory overflow on static memory.



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 5 Michael Stahl (allotropia) 2014-08-14 19:51:20 UTC
i wonder what's still missing here, just the special casing of the "jpipe" library to be built without sanitizer?
Comment 6 Markus Mohrhard 2014-08-15 18:41:52 UTC
(In reply to comment #5)
> i wonder what's still missing here, just the special casing of the "jpipe"
> library to be built without sanitizer?

As far as I remember there were some problems around the python and java bindings but Stephan knows the details.

Otherwise you can already build and run it. It is even possible to package the build so most of the features are covered.

I'm only disabling the firebird code as it uses a custom allocator that does not work nicely with Asan.
Comment 7 Stephan Bergmann 2014-08-18 07:18:17 UTC
(In reply to comment #2)
> For example doesn't work on clang with LINKFLAGSNOUNDEFS="-Wl,-z,defs" and
> adress sanitizer.

see <https://wiki.documentfoundation.org/Development/-fsanitize> for how to build LO with sanitizers
Comment 8 Volga 2018-12-13 15:50:32 UTC
Since Firefox moved the build infrastructure to the Clang toolchain, and they got significant changes for performance, we should try it anyway.

https://www.mozilla.org/en-US/firefox/63.0/releasenotes/
https://www.mozilla.org/en-US/firefox/64.0/releasenotes/
Comment 9 Michael Stahl (allotropia) 2018-12-13 15:54:28 UTC
building with ASAN and UBSAN has been working since years and we even have a tinderbox with ASAN+UBSAN -> closing this

btw while GCC ASAN does work i've noticed that clang ASAN has significantly better performance, so would recommend to use that for debug builds.