[Bug sanitizer/100114] libasan built against latest glibc doesn't work
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Apr 16 12:52:12 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100114
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed by code inspection, but it's for sure sth not new (but would be nice
to fix before GCC 11.1).
I suggtest to simply move the initialization inside SetAlternateSignalStack.
Sth like
diff --git a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp
b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp
index d29438cf9db..803712e268e 100644
--- a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp
@@ -165,7 +165,7 @@ bool SupportsColoredOutput(fd_t fd) {
#if !SANITIZER_GO
// TODO(glider): different tools may require different altstack size.
-static const uptr kAltStackSize = SIGSTKSZ * 4; // SIGSTKSZ is not enough.
+static const uptr kAltStackSize;
void SetAlternateSignalStack() {
stack_t altstack, oldstack;
@@ -176,6 +176,7 @@ void SetAlternateSignalStack() {
// TODO(glider): the mapped stack should have the MAP_STACK flag in the
// future. It is not required by man 2 sigaltstack now (they're using
// malloc()).
+ kAltStackSize = SIGSTKSZ * 4; // SIGSTKSZ is not enough.
void* base = MmapOrDie(kAltStackSize, __func__);
altstack.ss_sp = (char*) base;
altstack.ss_flags = 0;
More information about the Gcc-bugs
mailing list