public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "y.gribov at samsung dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/58680] New: Spurious warnings from libasan Date: Thu, 10 Oct 2013 08:55:00 -0000 [thread overview] Message-ID: <bug-58680-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680 Bug ID: 58680 Summary: Spurious warnings from libasan Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: y.gribov at samsung dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org Created attachment 30975 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30975&action=edit Repro I've found that Sanitizer will sometimes report a warning about failed interceptions of libc functions. $ ~/install/gcc-master/bin/gcc prog.c -fsanitize=address -DGEN_PLT $ LD_LIBRARY_PATH=~/install/gcc-master/lib64:$LD_LIBRARY_PATH ASAN_OPTIONS=verbosity=1 ./a.out ==30654== Parsed ASAN_OPTIONS: verbosity=1 ==30654== AddressSanitizer: failed to intercept 'memcpy' ==30654== AddressSanitizer: libc interceptors initialized ... After small and inspiring investigation I've found out that this warning is caused by check for successful interception of memcpy in libsanitizer/asan/asan_interceptors.cc:676: ASAN_INTERCEPT_FUNC(memcpy); Apart from other actions, this macro verifies that memcpy and __interceptor_memcpy resolve to the same address. Unfortunately this does not happen if main executable takes address of memcpy. In that case ld.so will resolve memcpy to the address of corresponding PLT entry in executable. This won't cause any problem (because PLT entry will eventually call Asan's memcpy) but will make libsanitizer think that it has failed to override memcpy. This problem could be worked around by compiling with -static-libasan because in this case memcpy will be resolved to __interceptor_memcpy at link time (i.e. statically). AFAIK Clang uses static libsanitizer by default so they probably never ever faced this problem. I suggest that we either remove the warning or make the check in ASAN_INTERCEPT_FUNC more sophisticated so as to support dynamic libsanitizer. -Y
next reply other threads:[~2013-10-10 8:55 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-10-10 8:55 y.gribov at samsung dot com [this message] 2013-10-10 9:30 ` [Bug sanitizer/58680] " kcc at gcc dot gnu.org 2013-10-10 16:55 ` tetra2005 at gmail dot com 2013-10-15 9:24 ` y.gribov at samsung dot com 2013-10-15 9:40 ` kcc at gcc dot gnu.org 2013-10-15 12:03 ` y.gribov at samsung dot com 2013-10-15 12:05 ` kcc at gcc dot gnu.org 2013-10-15 12:21 ` y.gribov at samsung dot com 2013-10-15 13:40 ` kcc at gcc dot gnu.org 2013-10-15 13:46 ` y.gribov at samsung dot com 2013-10-15 13:54 ` kcc at gcc dot gnu.org 2013-10-15 17:47 ` tetra2005 at gmail dot com 2013-10-16 8:58 ` glider at google dot com 2013-10-16 8:59 ` glider at google dot com 2013-11-13 12:42 ` y.gribov at samsung dot com 2014-01-22 7:34 ` y.gribov at samsung dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-58680-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).