CMake Address/Memory/Thread/Undefined Sanitizer support

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

CMake Address/Memory/Thread/Undefined Sanitizer support

Inkscape - Dev mailing list
Dear Jabier,

as discussed, I tested the Sanitzer builds with Debian 9 - works well. I
can now configure 4 sanitizer variants with CMake D Parameters like this:

-D SANITIZE_ADDRESS=ON
-D SANITIZE_MEMORY=OFF
-D SANITIZE_THREAD=OFF
-D SANITIZE_UNDEFINED=ON

address and undefined can be enabled together, the other two options
require separate builds with only one option enabled.

When I set

export ASAN_OPTIONS=halt_on_error=0

before you start inkscape, it will not stop on errors. Then you get the
output in sanitizer-sample-1.txt until inkscape reaches the main screen.
It looks all like new/delete mismatches which usually come from
forgetting to define a destructor virtual. If I disable these as well with:

export ASAN_OPTIONS=new_delete_type_mismatch=0

it is clean until reaching main screen. The second attached file is from
shutdown and shows just memory leaks. So chances are not bad that the
Sanitizer will be useful for specific issues without a lot of upfront
debugging.

The detection and configuration of the sanitizers is done by CMake
scripts I took from another project (compatible licenses). You get all 4
variants with gcc 6.xx. With earlier variants only the address sanitizer
works. The changes to the inkscape CMake files are minimal, all is in
separate CMake modules.

I will do some more tests on Saturday and do a pull request then, but
you can already look at it here:

https://gitlab.com/MSoegtrop/inkscape/commits/sanitizer

It is just one commit you can easily merge.

Best regards,

Michael

P.S.: attachments as ZIP didn't get through and are way large unzipped.
If someone is interested in the Sanitizer errors, please send me a mail.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: CMake Address/Memory/Thread/Undefined Sanitizer support

Jabier Arraiza
Hi Michael.

Thanks so much for the work. I hope is merged soon into branch and we
are allowed to fix the diferences on execution from compilations in
debug mode and in release mode actualy happends.

As far I know this new branch can be used with modern linux
distributions but not broke older ones. Is correct?

I have the zip in my inbox with the problems you find with your first
test. I try to wait to be merged to start fixing the long list.

All the best, Jabier.


On Thu, 2017-09-07 at 22:34 +0200, Michael Soegtrop via Inkscape-devel
wrote:

> Dear Jabier,
>
> as discussed, I tested the Sanitzer builds with Debian 9 - works
> well. I
> can now configure 4 sanitizer variants with CMake D Parameters like
> this:
>
> -D SANITIZE_ADDRESS=ON
> -D SANITIZE_MEMORY=OFF
> -D SANITIZE_THREAD=OFF
> -D SANITIZE_UNDEFINED=ON
>
> address and undefined can be enabled together, the other two options
> require separate builds with only one option enabled.
>
> When I set
>
> export ASAN_OPTIONS=halt_on_error=0
>
> before you start inkscape, it will not stop on errors. Then you get
> the
> output in sanitizer-sample-1.txt until inkscape reaches the main
> screen.
> It looks all like new/delete mismatches which usually come from
> forgetting to define a destructor virtual. If I disable these as well
> with:
>
> export ASAN_OPTIONS=new_delete_type_mismatch=0
>
> it is clean until reaching main screen. The second attached file is
> from
> shutdown and shows just memory leaks. So chances are not bad that the
> Sanitizer will be useful for specific issues without a lot of upfront
> debugging.
>
> The detection and configuration of the sanitizers is done by CMake
> scripts I took from another project (compatible licenses). You get
> all 4
> variants with gcc 6.xx. With earlier variants only the address
> sanitizer
> works. The changes to the inkscape CMake files are minimal, all is in
> separate CMake modules.
>
> I will do some more tests on Saturday and do a pull request then, but
> you can already look at it here:
>
> https://gitlab.com/MSoegtrop/inkscape/commits/sanitizer
>
> It is just one commit you can easily merge.
>
> Best regards,
>
> Michael
>
> P.S.: attachments as ZIP didn't get through and are way large
> unzipped.
> If someone is interested in the Sanitizer errors, please send me a
> mail.
>
> -------------------------------------------------------------------
> -----------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Inkscape-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: CMake Address/Memory/Thread/Undefined Sanitizer support

Inkscape - Dev mailing list
Dear Jabier,

> As far I know this new branch can be used with modern linux
> distributions but not broke older ones. Is correct?
To have all 4 modes you need gcc 6 or clang as compiler. There shouldn't
be any other requirements. With gcc 4 (Debian 8) you get only the
address sanitizer mode, not the other 3 modes. It is not so that older
OSes are broken, they just use a default C compiler which doesn't
support this form of code instrumentation. I also tried to configure the
inkscape build to use a non default compiler on Debian 8, but it got a
bit messy. I don't think it is worthwhile to support such a debug/test
only feature setup for Debian 8 & Co now that gcc 6 becomes standard.

Btw.: Here are links to the wiki pages for the 4 sanitizer modes:

https://github.com/google/sanitizers/wiki    (address, memory & thread
sanitizer overview)
https://github.com/google/sanitizers/wiki/AddressSanitizer
https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#ubsan-checks

Best regards,

Michael


.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: CMake Address/Memory/Thread/Undefined Sanitizer support

Jabier Arraiza
Thanks for the info!

On Sat, 2017-09-09 at 10:07 +0200, Michael Soegtrop wrote:

> Dear Jabier,
>
> > As far I know this new branch can be used with modern linux
> > distributions but not broke older ones. Is correct?
>
> To have all 4 modes you need gcc 6 or clang as compiler. There
> shouldn't
> be any other requirements. With gcc 4 (Debian 8) you get only the
> address sanitizer mode, not the other 3 modes. It is not so that
> older
> OSes are broken, they just use a default C compiler which doesn't
> support this form of code instrumentation. I also tried to configure
> the
> inkscape build to use a non default compiler on Debian 8, but it got
> a
> bit messy. I don't think it is worthwhile to support such a
> debug/test
> only feature setup for Debian 8 & Co now that gcc 6 becomes standard.
>
> Btw.: Here are links to the wiki pages for the 4 sanitizer modes:
>
> https://github.com/google/sanitizers/wiki    (address, memory &
> thread
> sanitizer overview)
> https://github.com/google/sanitizers/wiki/AddressSanitizer
> https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#ubsan-che
> cks
>
> Best regards,
>
> Michael
>
>
> .
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel

signature.asc (849 bytes) Download Attachment