public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined
@ 2020-03-25 13:46 gmc at synopsys dot com
  2020-03-25 13:46 ` [Bug sanitizer/94328] " gmc at synopsys dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gmc at synopsys dot com @ 2020-03-25 13:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94328

            Bug ID: 94328
           Summary: Logging of defects to file does not work with Asan and
                    Ubsan combined
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gmc at synopsys 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, marxin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 48114
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48114&action=edit
Source code for testcase

Compile only with the Address Sanitizer, and the resulting exe can log its
defects to file via the log_path setting in ASAN_OPTIONS

Ditto for only the Undefined Sanitizer, and using the log_path in UBSAN_OPTIONS

Combine the 2 though (the only 2 sanitizers that do seem to be allowed to
coexist) and the logging does not seem to work correctly : ASAN_OPTIONS seems
to be ignored altogether - and when I set UBSAN_OPTIONS the designated log_path
is used ONLY for the Address Sanitizer (incl LeakSanitizer) defects - the
Undefined Behavior defects go only to stderr, not to the log file.

See attached files : "test.cx" is the source, "make all" builds 3 exes, "run"
runs each, with log_path being set via the *_OPTIONS settings

Thanks for any help in addressing this.

   Gordon

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

* [Bug sanitizer/94328] Logging of defects to file does not work with Asan and Ubsan combined
  2020-03-25 13:46 [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined gmc at synopsys dot com
@ 2020-03-25 13:46 ` gmc at synopsys dot com
  2020-03-25 13:47 ` gmc at synopsys dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gmc at synopsys dot com @ 2020-03-25 13:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94328

--- Comment #1 from Gordon Mc <gmc at synopsys dot com> ---
Created attachment 48115
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48115&action=edit
Makefile

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

* [Bug sanitizer/94328] Logging of defects to file does not work with Asan and Ubsan combined
  2020-03-25 13:46 [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined gmc at synopsys dot com
  2020-03-25 13:46 ` [Bug sanitizer/94328] " gmc at synopsys dot com
@ 2020-03-25 13:47 ` gmc at synopsys dot com
  2020-03-25 14:02 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gmc at synopsys dot com @ 2020-03-25 13:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94328

--- Comment #2 from Gordon Mc <gmc at synopsys dot com> ---
Created attachment 48116
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48116&action=edit
Script to run the testcase

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

* [Bug sanitizer/94328] Logging of defects to file does not work with Asan and Ubsan combined
  2020-03-25 13:46 [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined gmc at synopsys dot com
  2020-03-25 13:46 ` [Bug sanitizer/94328] " gmc at synopsys dot com
  2020-03-25 13:47 ` gmc at synopsys dot com
@ 2020-03-25 14:02 ` marxin at gcc dot gnu.org
  2020-03-25 14:15 ` gmc at synopsys dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-25 14:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94328

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2020-03-25
     Ever confirmed|0                           |1

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Can you please test if clang suffers from the same problem?
If so, please create a bug to upstream library:
https://github.com/google/sanitizers/issues

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

* [Bug sanitizer/94328] Logging of defects to file does not work with Asan and Ubsan combined
  2020-03-25 13:46 [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined gmc at synopsys dot com
                   ` (2 preceding siblings ...)
  2020-03-25 14:02 ` marxin at gcc dot gnu.org
@ 2020-03-25 14:15 ` gmc at synopsys dot com
  2020-03-25 14:18 ` gmc at synopsys dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gmc at synopsys dot com @ 2020-03-25 14:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94328

--- Comment #4 from Gordon Mc <gmc at synopsys dot com> ---
This seems to be specific to GCC - I just tested with clang 7.1.0, and it
behaves as I would expect it to (both Asan and Ubsan content went to the UABSAN
log file - none went to stderr)

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

* [Bug sanitizer/94328] Logging of defects to file does not work with Asan and Ubsan combined
  2020-03-25 13:46 [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined gmc at synopsys dot com
                   ` (3 preceding siblings ...)
  2020-03-25 14:15 ` gmc at synopsys dot com
@ 2020-03-25 14:18 ` gmc at synopsys dot com
  2020-03-25 14:23 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gmc at synopsys dot com @ 2020-03-25 14:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94328

Gordon Mc <gmc at synopsys dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |9.2.0

--- Comment #5 from Gordon Mc <gmc at synopsys dot com> ---
Also just tested with newer GCC 9.2.0 - behavior there is the same as 6.2 and
7.3, in that the ubsan logging goes to stderr instead of the log file, in the
combined sanitizer build.

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

* [Bug sanitizer/94328] Logging of defects to file does not work with Asan and Ubsan combined
  2020-03-25 13:46 [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined gmc at synopsys dot com
                   ` (4 preceding siblings ...)
  2020-03-25 14:18 ` gmc at synopsys dot com
@ 2020-03-25 14:23 ` marxin at gcc dot gnu.org
  2020-03-25 14:37 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-25 14:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94328

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Ok, let me take a look.

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

* [Bug sanitizer/94328] Logging of defects to file does not work with Asan and Ubsan combined
  2020-03-25 13:46 [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined gmc at synopsys dot com
                   ` (5 preceding siblings ...)
  2020-03-25 14:23 ` marxin at gcc dot gnu.org
@ 2020-03-25 14:37 ` marxin at gcc dot gnu.org
  2020-03-26 10:06 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-25 14:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94328

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
I can confirm that. It's related to fact that clang links sanitizer library
statically, while GCC dynamically.

$ ldd a.out | grep san
        libasan.so.6 => /home/marxin/bin/gcc2/lib64/libasan.so.6
(0x00007ffff7601000)
        libubsan.so.1 => /home/marxin/bin/gcc2/lib64/libubsan.so.1
(0x00007ffff693e000)

And there's some clashing of common_flags()->log_path.
@Jakub: I remember we had one similar problem..

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

* [Bug sanitizer/94328] Logging of defects to file does not work with Asan and Ubsan combined
  2020-03-25 13:46 [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined gmc at synopsys dot com
                   ` (6 preceding siblings ...)
  2020-03-25 14:37 ` marxin at gcc dot gnu.org
@ 2020-03-26 10:06 ` marxin at gcc dot gnu.org
  2022-10-14  9:19 ` shanchuantian at gmail dot com
  2022-10-14  9:54 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-26 10:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94328

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|marxin at gcc dot gnu.org          |unassigned at gcc dot gnu.org

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
Yes, it's related to 

$ nm /home/marxin/bin/gcc/lib64/libasan.so.6 | grep report_file
00000000001224e0 d _ZN11__sanitizer11report_fileE

$ nm /home/marxin/bin/gcc/lib64/libubsan.so.1 | grep report_file
00000000000564e0 d _ZN11__sanitizer11report_fileE

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

* [Bug sanitizer/94328] Logging of defects to file does not work with Asan and Ubsan combined
  2020-03-25 13:46 [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined gmc at synopsys dot com
                   ` (7 preceding siblings ...)
  2020-03-26 10:06 ` marxin at gcc dot gnu.org
@ 2022-10-14  9:19 ` shanchuantian at gmail dot com
  2022-10-14  9:54 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: shanchuantian at gmail dot com @ 2022-10-14  9:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94328

shanchuan tian <shanchuantian at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |shanchuantian at gmail dot com

--- Comment #9 from shanchuan tian <shanchuantian at gmail dot com> ---
Dear all,
Is this problem solved?
Can logging work properly when asan and ubsan be compiled at the same?
Best regards,
Tian

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

* [Bug sanitizer/94328] Logging of defects to file does not work with Asan and Ubsan combined
  2020-03-25 13:46 [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined gmc at synopsys dot com
                   ` (8 preceding siblings ...)
  2022-10-14  9:19 ` shanchuantian at gmail dot com
@ 2022-10-14  9:54 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-14  9:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94328

--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to shanchuan tian from comment #9)
> Dear all,
> Is this problem solved?

No.

> Can logging work properly when asan and ubsan be compiled at the same?

Sorry, but it can't be easily fixed as explained in comment 8.

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

end of thread, other threads:[~2022-10-14  9:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 13:46 [Bug sanitizer/94328] New: Logging of defects to file does not work with Asan and Ubsan combined gmc at synopsys dot com
2020-03-25 13:46 ` [Bug sanitizer/94328] " gmc at synopsys dot com
2020-03-25 13:47 ` gmc at synopsys dot com
2020-03-25 14:02 ` marxin at gcc dot gnu.org
2020-03-25 14:15 ` gmc at synopsys dot com
2020-03-25 14:18 ` gmc at synopsys dot com
2020-03-25 14:23 ` marxin at gcc dot gnu.org
2020-03-25 14:37 ` marxin at gcc dot gnu.org
2020-03-26 10:06 ` marxin at gcc dot gnu.org
2022-10-14  9:19 ` shanchuantian at gmail dot com
2022-10-14  9:54 ` marxin at gcc dot gnu.org

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