Re: Testing for memory safety issues with Address Sanitizer

2016-09-22 Thread Tobias Mueller
Hi.

On Mi, 2016-09-21 at 11:27 -0500, Michael Catanzaro wrote:
> > Then, setting LD_PRELOAD=/usr/lib64/libasan.so worked for me.
> 
> For some reason, Fedora doesn't seem to have a libasan-devel package,
hm. On my system, I have:

$ dpkg -S /usr/lib/gcc/x86_64-linux-gnu/5/libasan.so
libgcc-5-dev:amd64: /usr/lib/gcc/x86_64-linux-gnu/5/libasan.so

$ dpkg -S /usr/lib/x86_64-linux-gnu/libasan.so.2
libasan2:amd64: /usr/lib/x86_64-linux-gnu/libasan.so.2

> so there's no plain libasan.so. Really strange. I tried changing it to
> libasan.so.3 in my jhbuildrc but actually couldn't figure out how to do
> that; jhbuild is playing with LD_PRELOAD as well. :(
I know little about jhbuild.  I think you could try to jhbuild shell
into your environment, look at $LD_PRELOAD, prefix it with the path to
libasan, and then do "make" or whatever command it intended to execute.
If that works, it needs to be made nicer, though.

Another option altogether may be to statically link ASan with
-static-asan.  I haven't tried that yet, however. I also don't know how
well it actually works in the particular case of ld_opened libraries
that you are describing.

Cheers,
  Tobi

signature.asc
Description: This is a digitally signed message part
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/desktop-devel-list

Re: Testing for memory safety issues with Address Sanitizer

2016-09-22 Thread Milan Crha
On Wed, 2016-09-21 at 11:27 -0500, Michael Catanzaro wrote:
> For some reason, Fedora doesn't seem to have a libasan-devel package,
> so there's no plain libasan.so. Really strange. I tried changing it
> to libasan.so.3 in my jhbuildrc but actually couldn't figure out how
> to do that; jhbuild is playing with LD_PRELOAD as well. :(

Hi,
these options used to work in some not so distant past for me (yeah,
when playing with evolution-data-server and evolution):

export CFLAGS="$CFLAGS -fsanitize=address,bounds,alignment,object-size 
-fno-omit-frame-pointer"
export LDFLAGS="-fsanitize=address,bounds,alignment,object-size -lasan -lubsan 
-lpthread -ldl"
export 
ASAN_OPTIONS=abort_on_error=1:detect_stack_use_after_return=0:detect_leaks=0:handle_segv=0:check_printf=0:detect_deadlocks=1:replace_str=1:replace_intrin=1:alloc_dealloc_mismatch=1:new_delete_type_mismatch=1:detect_container_overflow=1

I recall I was forced to use the LD_PRELOAD too. It was for cases when
mixing with and without asan built code, if I recall correctly. You
should teach jhbuild to add the asan/ubsan first, I'm afraid (or to
concatenate the LD_PRELOAD with some shell value, similar to CFLAGS
above.
Bye,
Milan
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/desktop-devel-list