[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-09-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #20 from Jakub Jelinek  ---
Fixed.

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-09-07 Thread doko at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #19 from Matthias Klose  ---
Author: doko
Date: Thu Sep  7 07:17:17 2017
New Revision: 251829

URL: https://gcc.gnu.org/viewcvs?rev=251829=gcc=rev
Log:
2017-09-07  Matthias Klose  

Backported from mainline
2017-07-14  Jakub Jelinek  

PR sanitizer/81066
* sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
* sanitizer_common/sanitizer_linux.cc: Likewise.
* sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
* tsan/tsan_platform_linux.cc: Likewise.

Modified:
branches/gcc-5-branch/libsanitizer/ChangeLog
branches/gcc-5-branch/libsanitizer/sanitizer_common/sanitizer_linux.cc
branches/gcc-5-branch/libsanitizer/sanitizer_common/sanitizer_linux.h
   
branches/gcc-5-branch/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
branches/gcc-5-branch/libsanitizer/tsan/tsan_platform_linux.cc

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-09-07 Thread doko at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #18 from Matthias Klose  ---
Author: doko
Date: Thu Sep  7 07:15:24 2017
New Revision: 251828

URL: https://gcc.gnu.org/viewcvs?rev=251828=gcc=rev
Log:
2017-09-07  Matthias Klose  

Backported from mainline
2017-07-14  Jakub Jelinek  

PR sanitizer/81066
* sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
* sanitizer_common/sanitizer_linux.cc: Likewise.
* sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
* tsan/tsan_platform_linux.cc: Likewise.

Modified:
branches/gcc-6-branch/libsanitizer/ChangeLog
branches/gcc-6-branch/libsanitizer/sanitizer_common/sanitizer_linux.cc
branches/gcc-6-branch/libsanitizer/sanitizer_common/sanitizer_linux.h
   
branches/gcc-6-branch/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
branches/gcc-6-branch/libsanitizer/tsan/tsan_platform_linux.cc

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-08-04 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

Jakub Jelinek  changed:

   What|Removed |Added

 CC||abominable-snowman at yandex 
dot r
   ||u

--- Comment #17 from Jakub Jelinek  ---
*** Bug 81711 has been marked as a duplicate of this bug. ***

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-07-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #16 from Jakub Jelinek  ---
Fixed for 7.2+ so far.

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-07-17 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #15 from Jakub Jelinek  ---
Author: jakub
Date: Mon Jul 17 19:41:08 2017
New Revision: 250287

URL: https://gcc.gnu.org/viewcvs?rev=250287=gcc=rev
Log:
Backported from mainline
2017-07-14  Jakub Jelinek  

PR sanitizer/81066
* sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
* sanitizer_common/sanitizer_linux.cc: Likewise.
* sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
* tsan/tsan_platform_linux.cc: Likewise.

Modified:
branches/gcc-7-branch/libsanitizer/ChangeLog
branches/gcc-7-branch/libsanitizer/sanitizer_common/sanitizer_linux.cc
branches/gcc-7-branch/libsanitizer/sanitizer_common/sanitizer_linux.h
   
branches/gcc-7-branch/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
branches/gcc-7-branch/libsanitizer/tsan/tsan_platform_linux.cc

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-07-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #14 from Jakub Jelinek  ---
Author: jakub
Date: Fri Jul 14 09:10:45 2017
New Revision: 250200

URL: https://gcc.gnu.org/viewcvs?rev=250200=gcc=rev
Log:
PR sanitizer/81066
* sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
* sanitizer_common/sanitizer_linux.cc: Likewise.
* sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
* tsan/tsan_platform_linux.cc: Likewise.

Modified:
trunk/libsanitizer/ChangeLog
trunk/libsanitizer/sanitizer_common/sanitizer_linux.cc
trunk/libsanitizer/sanitizer_common/sanitizer_linux.h
trunk/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
trunk/libsanitizer/tsan/tsan_platform_linux.cc

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-07-11 Thread grgoffe at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #13 from George R. Goffe  ---
Jakub,

I have built gcc with itself... including your mod... That appears to have
worked as well.

George...

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-07-11 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #12 from Jakub Jelinek  ---
I've filed https://reviews.llvm.org/D35246 upstream for this.

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-07-10 Thread grgoffe at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #11 from George R. Goffe  ---
Jakub,

I just tried your suggestion... It worked on "my" platform!

George...

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-07-10 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #10 from Jakub Jelinek  ---
I think the tsan build issue can be fixed just by replacing
__res_state *statp = (__res_state*)state;
line with
struct __res_state *statp = (struct __res_state*)state;
It should then build hopefully with both old and new glibc.

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-07-10 Thread grgoffe at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

George R. Goffe  changed:

   What|Removed |Added

 CC||grgoffe at yahoo dot com

--- Comment #9 from George R. Goffe  ---
Hi,

I'm building the "latest" gcc on a Fedora 27 (rawhide) system and am seeing
this same problem.

x86_64-pc-linux-gnu/libsanitizer/tsan#
/tools/gcc/obj-x86_64-pc-linux-gnu/./gcc/xgcc --save-temps -shared-libgcc
-B/tools/gcc/obj-x86_64-pc-linux-gnu/./gcc -nostdinc++
-L/tools/gcc/obj-x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/libstdc++-v3/src
-L/tools/gcc/obj-x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
-L/tools/gcc/obj-x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs
-B/usr/lsd/Linux/x86_64-pc-linux-gnu/bin/
-B/usr/lsd/Linux/x86_64-pc-linux-gnu/lib/ -isystem
/usr/lsd/Linux/x86_64-pc-linux-gnu/include -isystem
/usr/lsd/Linux/x86_64-pc-linux-gnu/sys-include -D_GNU_SOURCE -D_DEBUG
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-DCAN_SANITIZE_UB=0 -I. -I../../../../gcc/libsanitizer/tsan -I.. -I
../../../../gcc/libsanitizer -I ../../../../gcc/libsanitizer/include -Wall -W
-Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC
-fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables
-fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include
-I../../libstdc++-v3/include/x86_64-pc-linux-gnu
-I../../../../gcc/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -g -O2
-D_GNU_SOURCE -MT tsan_platform_linux.lo -MD -MP -MF
.deps/tsan_platform_linux.Tpo -c
../../../../gcc/libsanitizer/tsan/tsan_platform_linux.cc  -fPIC -DPIC -o
.libs/tsan_platform_linux.o
../../../../gcc/libsanitizer/tsan/tsan_platform_linux.cc: In function ‘int
__tsan::ExtractResolvFDs(void*, int*, int)’:
../../../../gcc/libsanitizer/tsan/tsan_platform_linux.cc:290:16: error: ‘statp’
was not declared in this scope
   __res_state *statp = (__res_state*)state;
^
../../../../gcc/libsanitizer/tsan/tsan_platform_linux.cc:290:16: note:
suggested alternative: ‘state’
   __res_state *statp = (__res_state*)state;
^
state
../../../../gcc/libsanitizer/tsan/tsan_platform_linux.cc:290:37: error:
expected primary-expression before ‘)’ token
   __res_state *statp = (__res_state*)state;
 ^


glibc-2.25.90-21.fc27.x86_64

gcc-7.1.1-2.fc27.x86_64

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-07-09 Thread fw at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #8 from Florian Weimer  ---
(In reply to Khem Raj from comment #7)
> (In reply to Florian Weimer from comment #6)
> > (In reply to Khem Raj from comment #5)
> > > +#ifndef __stack_t_defined
> > > +struct stack_t;
> > > +#endif
> > 
> > Where does __stack_t_defined come from?  If this is the definition from the
> > glibc headers, that's really brittle because it's totally internal.
> 
> infact it is from bits/types/stack_t.h so you are right. sanitizers redefine
> a lot
> of stuff from libc. So we can not include signal.h without such quirks

I think you should change the signature of internal_sigaltstack.  Something
like

  void internal_sigaltstack(void *, size_t);

should work, due to the way the function is used.  Then you'll need to
reference the stack_t type only within its implementation (at which point, I
assume, it is safe to include glibc's ).

As far as I understand the interface, there is no need to keep the actual
stack_t object around while the alternative signal stack is in use.

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-06-13 Thread raj.khem at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #7 from Khem Raj  ---
(In reply to Florian Weimer from comment #6)
> (In reply to Khem Raj from comment #5)
> > +#ifndef __stack_t_defined
> > +struct stack_t;
> > +#endif
> 
> Where does __stack_t_defined come from?  If this is the definition from the
> glibc headers, that's really brittle because it's totally internal.

infact it is from bits/types/stack_t.h so you are right. sanitizers redefine a
lot
of stuff from libc. So we can not include signal.h without such quirks

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-06-13 Thread fw at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #6 from Florian Weimer  ---
(In reply to Khem Raj from comment #5)
> +#ifndef __stack_t_defined
> +struct stack_t;
> +#endif

Where does __stack_t_defined come from?  If this is the definition from the
glibc headers, that's really brittle because it's totally internal.

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-06-13 Thread raj.khem at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

Khem Raj  changed:

   What|Removed |Added

 CC||raj.khem at gmail dot com

--- Comment #5 from Khem Raj  ---
Here is another patch that is working

Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.cc
===
--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -14,6 +14,10 @@

 #if SANITIZER_FREEBSD || SANITIZER_LINUX

+#if !SANITIZER_ANDROID
+#include 
+#endif
+
 #include "sanitizer_common.h"
 #include "sanitizer_flags.h"
 #include "sanitizer_internal_defs.h"
@@ -71,10 +75,6 @@ extern "C" {
 extern char **environ;  // provided by crt1
 #endif  // SANITIZER_FREEBSD

-#if !SANITIZER_ANDROID
-#include 
-#endif
-
 #if SANITIZER_LINUX
 // 
 struct kernel_timeval {
@@ -605,8 +605,8 @@ uptr internal_prctl(int option, uptr arg
 }
 #endif

-uptr internal_sigaltstack(const struct sigaltstack *ss,
- struct sigaltstack *oss) {
+uptr internal_sigaltstack(const stack_t *ss,
+ stack_t *oss) {
   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
 }

Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.h
===
--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux.h
+++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.h
@@ -19,7 +19,10 @@
 #include "sanitizer_platform_limits_posix.h"

 struct link_map;  // Opaque type returned by dlopen().
-struct sigaltstack;
+
+#ifndef __stack_t_defined
+struct stack_t;
+#endif

 namespace __sanitizer {
 // Dirent structure for getdents(). Note that this structure is different from
@@ -28,8 +31,8 @@ struct linux_dirent;

 // Syscall wrappers.
 uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int
count);
-uptr internal_sigaltstack(const struct sigaltstack* ss,
-  struct sigaltstack* oss);
+uptr internal_sigaltstack(const stack_t* ss,
+  stack_t* oss);
 uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
 __sanitizer_sigset_t *oldset);

Index:
gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
===
---
gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++
gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -16,6 +16,7 @@
 defined(__aarch64__) || defined(__powerpc64__) || \
 defined(__s390__))

+#include 
 #include "sanitizer_stoptheworld.h"

 #include "sanitizer_platform_limits_posix.h"
@@ -273,7 +274,7 @@ static int TracerThread(void* argument)

   // Alternate stack for signal handling.
   InternalScopedBuffer handler_stack_memory(kHandlerStackSize);
-  struct sigaltstack handler_stack;
+  stack_t handler_stack;
   internal_memset(_stack, 0, sizeof(handler_stack));
   handler_stack.ss_sp = handler_stack_memory.data();
   handler_stack.ss_size = kHandlerStackSize;
Index: gcc-7.1.0/libsanitizer/tsan/tsan_platform_linux.cc
===
--- gcc-7.1.0.orig/libsanitizer/tsan/tsan_platform_linux.cc
+++ gcc-7.1.0/libsanitizer/tsan/tsan_platform_linux.cc
@@ -14,6 +14,7 @@
 #include "sanitizer_common/sanitizer_platform.h"
 #if SANITIZER_LINUX || SANITIZER_FREEBSD

+#include 
 #include "sanitizer_common/sanitizer_common.h"
 #include "sanitizer_common/sanitizer_libc.h"
 #include "sanitizer_common/sanitizer_linux.h"
@@ -28,7 +29,6 @@

 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -287,7 +287,7 @@ void InitializePlatform() {
 int ExtractResolvFDs(void *state, int *fds, int nfd) {
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
   int cnt = 0;
-  __res_state *statp = (__res_state*)state;
+  res_state statp = (res_state)state;
   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
 if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
   fds[cnt++] = statp->_u._ext.nssocks[i];
Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
===
--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
+++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
@@ -14,6 +14,7 @@

 #if SANITIZER_FREEBSD || SANITIZER_LINUX

+#include 
 #include "sanitizer_allocator_internal.h"
 #include "sanitizer_atomic.h"
 #include "sanitizer_common.h"
@@ -30,7 +31,6 @@

 #include 
 #include 
-#include 
 #include 
 #include 

Index:
gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-06-12 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #4 from joseph at codesourcery dot com  ---
Using stack_t instead of struct sigaltstack is correct.  However, the type 
declaration should be obtained from .  Nothing outside of glibc 
should ever include  headers or define glibc's __need_* macros; 
those are purely implementation details, not public interfaces, and are 
liable to change incompatibly at any time.

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-06-12 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-06-12
 Ever confirmed|0   |1

--- Comment #3 from Markus Trippelsdorf  ---
The following hack works, but is of course no proper solution.

diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc
b/libsanitizer/sanitizer_common/sanitizer_linux.cc
index 806fcd5e2847..a9de6fc237f4 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -605,8 +605,8 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr
arg4, uptr arg5) {
 }
 #endif

-uptr internal_sigaltstack(const struct sigaltstack *ss,
- struct sigaltstack *oss) {
+uptr internal_sigaltstack(const stack_t *ss,
+ stack_t *oss) {
   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
 }

diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h
b/libsanitizer/sanitizer_common/sanitizer_linux.h
index 895bfc18195c..32d6baa092bd 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.h
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.h
@@ -17,6 +17,7 @@
 #include "sanitizer_internal_defs.h"
 #include "sanitizer_posix.h"
 #include "sanitizer_platform_limits_posix.h"
+#include "bits/types/stack_t.h"

 struct link_map;  // Opaque type returned by dlopen().
 struct sigaltstack;
@@ -28,8 +29,8 @@ struct linux_dirent;

 // Syscall wrappers.
 uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int
count);
-uptr internal_sigaltstack(const struct sigaltstack* ss,
-  struct sigaltstack* oss);
+uptr internal_sigaltstack(const stack_t* ss,
+  stack_t* oss);
 uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
 __sanitizer_sigset_t *oldset);

diff --git
a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
index 891386dc0ba7..234e8c652c67 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -273,7 +273,7 @@ static int TracerThread(void* argument) {

   // Alternate stack for signal handling.
   InternalScopedBuffer handler_stack_memory(kHandlerStackSize);
-  struct sigaltstack handler_stack;
+  stack_t handler_stack;
   internal_memset(_stack, 0, sizeof(handler_stack));
   handler_stack.ss_sp = handler_stack_memory.data();
   handler_stack.ss_size = kHandlerStackSize;
diff --git a/libsanitizer/tsan/tsan_platform_linux.cc
b/libsanitizer/tsan/tsan_platform_linux.cc
index 2ed5718a12e3..0045051f1d20 100644
--- a/libsanitizer/tsan/tsan_platform_linux.cc
+++ b/libsanitizer/tsan/tsan_platform_linux.cc
@@ -50,7 +50,7 @@
 #include 
 #if SANITIZER_LINUX
 #define __need_res_state
-#include 
+#include "bits/types/res_state.h"
 #endif

 #ifdef sa_handler

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-06-12 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #2 from Markus Trippelsdorf  ---
Another issue with glibc trunk: The definition of __res_state moved from
resolv.h to bits/types/res_state.h:

/home/markus/llvm/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc: In function
‘int __tsan::ExtractResolvFDs(void*, int*, int)’:   
/home/markus/llvm/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc:292:16:
error: ‘statp’ was not declared in this scope   
   __res_state *statp = (__res_state*)state;
^   
/home/markus/llvm/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc:292:16: note:
suggested alternative: ‘state’  
   __res_state *statp = (__res_state*)state;
^   
state   
/home/markus/llvm/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc:292:37:
error: expected primary-expression before ‘)’ token 
   __res_state *statp = (__res_state*)state;
 ^

[Bug sanitizer/81066] sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined

2017-06-11 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066

--- Comment #1 from Andrew Pinski  ---
This should most likely be filed to sanitizer's upstream bugzilla.