944-sanitizer-linux.patch 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. From f9a35ba5c150da2e381c4cab01f8f12bcd6af5d2 Mon Sep 17 00:00:00 2001
  2. From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
  3. Date: Mon, 17 Jul 2017 19:41:08 +0000
  4. Subject: [PATCH] Backported from mainline 2017-07-14 Jakub
  5. Jelinek <jakub@redhat.com>
  6. PR sanitizer/81066
  7. * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
  8. * sanitizer_common/sanitizer_linux.cc: Likewise.
  9. * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
  10. * tsan/tsan_platform_linux.cc: Likewise.
  11. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250287 138bc75d-0d04-0410-961f-82ee72b054a4
  12. (cherry picked from commit 72edc2c02f8b4768ad660f46a1c7e2400c0a8e06)
  13. [Romain backport to 4.9.4]
  14. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  15. ---
  16. libsanitizer/sanitizer_common/sanitizer_linux.cc | 3 +--
  17. libsanitizer/sanitizer_common/sanitizer_linux.h | 4 +---
  18. libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | 2 +-
  19. libsanitizer/tsan/tsan_platform_linux.cc | 2 +-
  20. 4 files changed, 4 insertions(+), 7 deletions(-)
  21. diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
  22. index 69c9c10..8e53673 100644
  23. --- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
  24. +++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
  25. @@ -599,8 +599,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
  26. return internal_syscall(__NR_prctl, option, arg2, arg3, arg4, arg5);
  27. }
  28. -uptr internal_sigaltstack(const struct sigaltstack *ss,
  29. - struct sigaltstack *oss) {
  30. +uptr internal_sigaltstack(const void *ss, void *oss) {
  31. return internal_syscall(__NR_sigaltstack, (uptr)ss, (uptr)oss);
  32. }
  33. diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h
  34. index 6422df1..8e111d1 100644
  35. --- a/libsanitizer/sanitizer_common/sanitizer_linux.h
  36. +++ b/libsanitizer/sanitizer_common/sanitizer_linux.h
  37. @@ -18,7 +18,6 @@
  38. #include "sanitizer_platform_limits_posix.h"
  39. struct link_map; // Opaque type returned by dlopen().
  40. -struct sigaltstack;
  41. namespace __sanitizer {
  42. // Dirent structure for getdents(). Note that this structure is different from
  43. @@ -28,8 +27,7 @@ struct linux_dirent;
  44. // Syscall wrappers.
  45. uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
  46. uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5);
  47. -uptr internal_sigaltstack(const struct sigaltstack* ss,
  48. - struct sigaltstack* oss);
  49. +uptr internal_sigaltstack(const void* ss, void* oss);
  50. uptr internal_sigaction(int signum, const __sanitizer_kernel_sigaction_t *act,
  51. __sanitizer_kernel_sigaction_t *oldact);
  52. uptr internal_sigprocmask(int how, __sanitizer_kernel_sigset_t *set,
  53. diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
  54. index 6ee63ec..50c21a3 100644
  55. --- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
  56. +++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
  57. @@ -238,7 +238,7 @@ static int TracerThread(void* argument) {
  58. // Alternate stack for signal handling.
  59. InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
  60. - struct sigaltstack handler_stack;
  61. + stack_t handler_stack;
  62. internal_memset(&handler_stack, 0, sizeof(handler_stack));
  63. handler_stack.ss_sp = handler_stack_memory.data();
  64. handler_stack.ss_size = kHandlerStackSize;
  65. diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc
  66. index fe69430..49f5270 100644
  67. --- a/libsanitizer/tsan/tsan_platform_linux.cc
  68. +++ b/libsanitizer/tsan/tsan_platform_linux.cc
  69. @@ -351,7 +351,7 @@ bool IsGlobalVar(uptr addr) {
  70. // closes within glibc. The code is a pure hack.
  71. int ExtractResolvFDs(void *state, int *fds, int nfd) {
  72. int cnt = 0;
  73. - __res_state *statp = (__res_state*)state;
  74. + struct __res_state *statp = (struct __res_state*)state;
  75. for (int i = 0; i < MAXNS && cnt < nfd; i++) {
  76. if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
  77. fds[cnt++] = statp->_u._ext.nssocks[i];
  78. --
  79. 2.9.5