* [Bug sanitizer/84250] Symbol collision when using both Address and Undefined Behavior sanitizers (-fsanitize=address,undefined)
[not found] <bug-84250-4@http.gcc.gnu.org/bugzilla/>
@ 2021-05-04 12:31 ` rguenth at gcc dot gnu.org
2021-12-16 16:41 ` mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-04 12:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84250
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug sanitizer/84250] Symbol collision when using both Address and Undefined Behavior sanitizers (-fsanitize=address,undefined)
[not found] <bug-84250-4@http.gcc.gnu.org/bugzilla/>
2021-05-04 12:31 ` [Bug sanitizer/84250] Symbol collision when using both Address and Undefined Behavior sanitizers (-fsanitize=address,undefined) rguenth at gcc dot gnu.org
@ 2021-12-16 16:41 ` mpolacek at gcc dot gnu.org
2021-12-17 4:53 ` chefmax at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-12-16 16:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84250
--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Maxim, any updates?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug sanitizer/84250] Symbol collision when using both Address and Undefined Behavior sanitizers (-fsanitize=address,undefined)
[not found] <bug-84250-4@http.gcc.gnu.org/bugzilla/>
2021-05-04 12:31 ` [Bug sanitizer/84250] Symbol collision when using both Address and Undefined Behavior sanitizers (-fsanitize=address,undefined) rguenth at gcc dot gnu.org
2021-12-16 16:41 ` mpolacek at gcc dot gnu.org
@ 2021-12-17 4:53 ` chefmax at gcc dot gnu.org
2021-12-17 14:14 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: chefmax at gcc dot gnu.org @ 2021-12-17 4:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84250
--- Comment #10 from chefmax at gcc dot gnu.org ---
Hi Marek, sorry, I'm not really tracking this anymore :(.
I don't remember exactly why option 1) from
https://github.com/google/sanitizers/issues/912#issuecomment-363525012 doesn't
work for GCC so I'm not sure whether I can give any new valuable input for this
issue. Should I unassign/reassign this to someone else?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug sanitizer/84250] Symbol collision when using both Address and Undefined Behavior sanitizers (-fsanitize=address,undefined)
[not found] <bug-84250-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2021-12-17 4:53 ` chefmax at gcc dot gnu.org
@ 2021-12-17 14:14 ` mpolacek at gcc dot gnu.org
2021-12-23 4:05 ` chefmax at gcc dot gnu.org
2022-10-14 9:21 ` shanchuantian at gmail dot com
5 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-12-17 14:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84250
--- Comment #11 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to chefmax from comment #10)
> Hi Marek, sorry, I'm not really tracking this anymore :(.
Hi, understood.
> I don't remember exactly why option 1) from
> https://github.com/google/sanitizers/issues/912#issuecomment-363525012
> doesn't work for GCC so I'm not sure whether I can give any new valuable
> input for this issue. Should I unassign/reassign this to someone else?
If you're not planning to get back to this then I think it'd be good to
unassign. I don't know whom we would reassign this to at this point.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug sanitizer/84250] Symbol collision when using both Address and Undefined Behavior sanitizers (-fsanitize=address,undefined)
[not found] <bug-84250-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2021-12-17 14:14 ` mpolacek at gcc dot gnu.org
@ 2021-12-23 4:05 ` chefmax at gcc dot gnu.org
2022-10-14 9:21 ` shanchuantian at gmail dot com
5 siblings, 0 replies; 6+ messages in thread
From: chefmax at gcc dot gnu.org @ 2021-12-23 4:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84250
chefmax at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |WAITING
--- Comment #12 from chefmax at gcc dot gnu.org ---
> If you're not planning to get back to this then I think it'd be good to
> unassign. I don't know whom we would reassign this to at this point.
Ok, I'm unassigning this now because I can't guarantee prompt reaction/updates.
Meanwhile, I found the reason why option 1) was reverted (explained by Jakub):
https://gcc.gnu.org/pipermail/gcc-patches/2018-July/501921.html
> the 1) variant is actually not a good idea, it will not work properly anyway
> if you link one library with -fsanitize=undefined and another library
> with -fsanitize=address, the right solution is to make the two libraries
> coexist sanely
If we want to follow this way, we may need to introduce something like
libsanitizer_common.so but this may also require pushing some patches in LLVM
upstream.
And just in case, let me post the variant 2) fix here, just to have a
reference:
diff --git a/libsanitizer/sanitizer_common/sanitizer_file.cpp
b/libsanitizer/sanitizer_common/sanitizer_file.cpp
index 5492560df91..c7013166ef6 100644
--- a/libsanitizer/sanitizer_common/sanitizer_file.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_file.cpp
@@ -27,7 +27,8 @@ void CatastrophicErrorWrite(const char *buffer, uptr length)
{
}
StaticSpinMutex report_file_mu;
-ReportFile report_file = {&report_file_mu, kStderrFd, "", "", 0};
+SANITIZER_INTERFACE_ATTRIBUTE ReportFile report_file = {&report_file_mu,
+ kStderrFd, "", "", 0};
void RawWrite(const char *buffer) {
report_file.Write(buffer, internal_strlen(buffer));
diff --git a/libsanitizer/sanitizer_common/sanitizer_file.h
b/libsanitizer/sanitizer_common/sanitizer_file.h
index 3d7916171c1..0ce1f417030 100644
--- a/libsanitizer/sanitizer_common/sanitizer_file.h
+++ b/libsanitizer/sanitizer_common/sanitizer_file.h
@@ -47,7 +47,7 @@ struct ReportFile {
private:
void ReopenIfNecessary();
};
-extern ReportFile report_file;
+extern SANITIZER_INTERFACE_ATTRIBUTE ReportFile report_file;
enum FileAccessMode {
RdOnly,
diff --git a/libsanitizer/ubsan/ubsan_init.cpp
b/libsanitizer/ubsan/ubsan_init.cpp
index 9931d85bf40..042026fee8d 100644
--- a/libsanitizer/ubsan/ubsan_init.cpp
+++ b/libsanitizer/ubsan/ubsan_init.cpp
@@ -43,7 +43,13 @@ static void CommonStandaloneInit() {
CacheBinaryName();
InitializeFlags();
__sanitizer::InitializePlatformEarly();
- __sanitizer_set_report_path(common_flags()->log_path);
+
+ // GCC-specific: in case of both ASan/UBSan runtimes are present,
+ // ASan or application itself may have aleady defined report path.
+ // Do not override it when initializing UBSan.
+ if (!__sanitizer_get_report_path()) {
+ __sanitizer_set_report_path(common_flags()->log_path);
+ }
AndroidLogInit();
InitializeCoverage(common_flags()->coverage, common_flags()->coverage_dir);
CommonInit();
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug sanitizer/84250] Symbol collision when using both Address and Undefined Behavior sanitizers (-fsanitize=address,undefined)
[not found] <bug-84250-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2021-12-23 4:05 ` chefmax at gcc dot gnu.org
@ 2022-10-14 9:21 ` shanchuantian at gmail dot com
5 siblings, 0 replies; 6+ messages in thread
From: shanchuantian at gmail dot com @ 2022-10-14 9:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84250
shanchuan tian <shanchuantian at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |shanchuantian at gmail dot com
--- Comment #13 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] 6+ messages in thread