public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/58680] New: Spurious warnings from libasan
@ 2013-10-10  8:55 y.gribov at samsung dot com
  2013-10-10  9:30 ` [Bug sanitizer/58680] " kcc at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: y.gribov at samsung dot com @ 2013-10-10  8:55 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
@ 2013-10-10  9:30 ` kcc at gcc dot gnu.org
  2013-10-10 16:55 ` tetra2005 at gmail dot com
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: kcc at gcc dot gnu.org @ 2013-10-10  9:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

Kostya Serebryany <kcc at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eugeni.stepanov at gmail dot com,
                   |                            |glider at google dot com,
                   |                            |samsonov at google dot com

--- Comment #1 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
In clang we indeed support *only* static run-time and have no experience with
dynamic run-time on Linux.
I wonder if this may affect Mac or Android, where the run-time is dynamic?


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
  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
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: tetra2005 at gmail dot com @ 2013-10-10 16:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #2 from Yuri Gribov <tetra2005 at gmail dot com> ---
/* Answering from my personal account */

According to http://marc.info/?t=136458341500002 this may not be a problem for
Android. It seems that NDK links shared libs with -Bsymbolic which should
prevent interpositions like this. Haven't verified this though, no Android
device at hand...

-Y


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
  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
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: y.gribov at samsung dot com @ 2013-10-15  9:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #3 from Yury Gribov <y.gribov at samsung dot com> ---
Konstantin,

What about returning true in interception_linux.cc #if defined(__pic__) &&
!defined(__ANDROID__)? I can cook a proper patch if this sounds reasonable.

-Y


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (2 preceding siblings ...)
  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
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: kcc at gcc dot gnu.org @ 2013-10-15  9:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #4 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
(In reply to Yury Gribov from comment #3)
> Konstantin,
> 
> What about returning true in interception_linux.cc #if defined(__pic__) &&
> !defined(__ANDROID__)? I can cook a proper patch if this sounds reasonable.
> 
> -Y

Yes, please send the patch upstream (http://llvm.org/docs/Phabricator.html).
I am not sure how we will test it there though... 

Also, why does this warning bother you?
Does it cause other visible and negative effects?


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (3 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: y.gribov at samsung dot com @ 2013-10-15 12:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #5 from Yury Gribov <y.gribov at samsung dot com> ---
> Yes, please send the patch upstream

Will do.

> Also, why does this warning bother you?
> Does it cause other visible and negative effects?

No, it's really more of a cosmetic change.

-Y


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (4 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: kcc at gcc dot gnu.org @ 2013-10-15 12:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #6 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
Why bother then?


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (5 preceding siblings ...)
  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
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: y.gribov at samsung dot com @ 2013-10-15 12:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #7 from Yury Gribov <y.gribov at samsung dot com> ---
Well, I think people will keep asking about these warnings and spend time
debugging them. You don't like the platform-specific code?


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (6 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: kcc at gcc dot gnu.org @ 2013-10-15 13:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #8 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
I especially dislike changes which I can't test upstream


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (7 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: y.gribov at samsung dot com @ 2013-10-15 13:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #9 from Yury Gribov <y.gribov at samsung dot com> ---
I see. The disagreement about static linking of libsanitizer in gcc/llvm is
rather unfortunate. Well, you have the final call on this.

BTW could someone try repro on Mac? I wonder if it has the same problem (and
thus requires the same patch!).

-Y


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (8 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: kcc at gcc dot gnu.org @ 2013-10-15 13:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #10 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
(In reply to Yury Gribov from comment #9)
> I see. The disagreement about static linking of libsanitizer in gcc/llvm is
> rather unfortunate. Well, you have the final call on this.

You may use -static-libasan 

> 
> BTW could someone try repro on Mac? I wonder if it has the same problem (and
> thus requires the same patch!).

glider? 

> 
> -Y


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (9 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: tetra2005 at gmail dot com @ 2013-10-15 17:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #11 from Yuri Gribov <tetra2005 at gmail dot com> ---
(In reply to Kostya Serebryany from comment #10)
> You may use -static-libasan 

Well, that's a universal solution.

> glider?

Sorry, I'm completely ignorant of Apple stuff :(

-Y


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (10 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: glider at google dot com @ 2013-10-16  8:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #12 from Alexander Potapenko <glider at google dot com> ---
This problem doesn't reproduce on OSX.

- Glider (:


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (11 preceding siblings ...)
  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
  14 siblings, 0 replies; 16+ messages in thread
From: glider at google dot com @ 2013-10-16  8:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #13 from Alexander Potapenko <glider at google dot com> ---
(Well, I've only tested this with Clang on OSX. No idea whether it works with
GCC or not, but there should be no difference, since the dynamic runtime
library is the same)


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (12 preceding siblings ...)
  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
  14 siblings, 0 replies; 16+ messages in thread
From: y.gribov at samsung dot com @ 2013-11-13 12:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

--- Comment #14 from Yury Gribov <y.gribov at samsung dot com> ---
I hate zombie bugs. Can we either fix or wontfix this?


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug sanitizer/58680] Spurious warnings from libasan
  2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
                   ` (13 preceding siblings ...)
  2013-11-13 12:42 ` y.gribov at samsung dot com
@ 2014-01-22  7:34 ` y.gribov at samsung dot com
  14 siblings, 0 replies; 16+ messages in thread
From: y.gribov at samsung dot com @ 2014-01-22  7:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58680

Yury Gribov <y.gribov at samsung dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #15 from Yury Gribov <y.gribov at samsung dot com> ---
Rejected by Asan team.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-01-22  7:34 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-10  8:55 [Bug sanitizer/58680] New: Spurious warnings from libasan y.gribov at samsung dot com
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

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).