wok-current view gcc49/stuff/fix_sanitizer.patch @ rev 25728

Merge wok for both arch and few updates
author Stanislas Leduc <shann@slitaz.org>
date Thu Dec 05 08:39:45 2024 +0000 (9 months ago)
parents
children
line source
1 From 4c07606bb77bbd30f02adb947d480516da3fa3f7 Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@...>
3 Date: Sun, 11 Jun 2017 10:09:13 -0700
4 Subject: [PATCH] libsanitizer: Use stack_t instead of struct sigaltstack
6 Upstream-Status: Submitted
8 Signed-off-by: Khem Raj <raj.khem@...>
9 ---
10 libsanitizer/sanitizer_common/sanitizer_linux.cc | 4 ++--
11 libsanitizer/sanitizer_common/sanitizer_linux.h | 6 +++---
12 .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | 3 ++-
13 3 files changed, 7 insertions(+), 6 deletions(-)
15 Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.cc
16 ===================================================================
17 --- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux.cc
18 +++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.cc
19 @@ -14,6 +14,10 @@
21 #if SANITIZER_FREEBSD || SANITIZER_LINUX
23 +#if !SANITIZER_ANDROID
24 +#include <sys/signal.h>
25 +#endif
26 +
27 #include "sanitizer_common.h"
28 #include "sanitizer_flags.h"
29 #include "sanitizer_internal_defs.h"
30 @@ -71,10 +75,6 @@ extern "C" {
31 extern char **environ; // provided by crt1
32 #endif // SANITIZER_FREEBSD
34 -#if !SANITIZER_ANDROID
35 -#include <sys/signal.h>
36 -#endif
37 -
38 #if SANITIZER_LINUX
39 // <linux/time.h>
40 struct kernel_timeval {
41 @@ -605,8 +605,8 @@ uptr internal_prctl(int option, uptr arg
42 }
43 #endif
45 -uptr internal_sigaltstack(const struct sigaltstack *ss,
46 - struct sigaltstack *oss) {
47 +uptr internal_sigaltstack(const stack_t *ss,
48 + stack_t *oss) {
49 return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
50 }
52 Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.h
53 ===================================================================
54 --- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux.h
55 +++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.h
56 @@ -19,7 +19,10 @@
57 #include "sanitizer_platform_limits_posix.h"
59 struct link_map; // Opaque type returned by dlopen().
60 -struct sigaltstack;
61 +
62 +#ifndef __stack_t_defined
63 +struct stack_t;
64 +#endif
66 namespace __sanitizer {
67 // Dirent structure for getdents(). Note that this structure is different from
68 @@ -28,8 +31,8 @@ struct linux_dirent;
70 // Syscall wrappers.
71 uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
72 -uptr internal_sigaltstack(const struct sigaltstack* ss,
73 - struct sigaltstack* oss);
74 +uptr internal_sigaltstack(const stack_t* ss,
75 + stack_t* oss);
76 uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
77 __sanitizer_sigset_t *oldset);
79 Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
80 ===================================================================
81 --- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
82 +++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
83 @@ -16,6 +16,7 @@
84 defined(__aarch64__) || defined(__powerpc64__) || \
85 defined(__s390__))
87 +#include <signal.h>
88 #include "sanitizer_stoptheworld.h"
90 #include "sanitizer_platform_limits_posix.h"
91 @@ -273,7 +274,7 @@ static int TracerThread(void* argument)
93 // Alternate stack for signal handling.
94 InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
95 - struct sigaltstack handler_stack;
96 + stack_t handler_stack;
97 internal_memset(&handler_stack, 0, sizeof(handler_stack));
98 handler_stack.ss_sp = handler_stack_memory.data();
99 handler_stack.ss_size = kHandlerStackSize;
100 Index: gcc-7.1.0/libsanitizer/tsan/tsan_platform_linux.cc
101 ===================================================================
102 --- gcc-7.1.0.orig/libsanitizer/tsan/tsan_platform_linux.cc
103 +++ gcc-7.1.0/libsanitizer/tsan/tsan_platform_linux.cc
104 @@ -14,6 +14,7 @@
105 #include "sanitizer_common/sanitizer_platform.h"
106 #if SANITIZER_LINUX || SANITIZER_FREEBSD
108 +#include <signal.h>
109 #include "sanitizer_common/sanitizer_common.h"
110 #include "sanitizer_common/sanitizer_libc.h"
111 #include "sanitizer_common/sanitizer_linux.h"
112 @@ -28,7 +29,6 @@
114 #include <fcntl.h>
115 #include <pthread.h>
116 -#include <signal.h>
117 #include <stdio.h>
118 #include <stdlib.h>
119 #include <string.h>
120 @@ -287,7 +287,7 @@ void InitializePlatform() {
121 int ExtractResolvFDs(void *state, int *fds, int nfd) {
122 #if SANITIZER_LINUX && !SANITIZER_ANDROID
123 int cnt = 0;
124 - __res_state *statp = (__res_state*)state;
125 + res_state statp = (res_state)state;
126 for (int i = 0; i < MAXNS && cnt < nfd; i++) {
127 if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
128 fds[cnt++] = statp->_u._ext.nssocks[i];
129 Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
130 ===================================================================
131 --- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
132 +++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
133 @@ -14,6 +14,7 @@
135 #if SANITIZER_FREEBSD || SANITIZER_LINUX
137 +#include <signal.h>
138 #include "sanitizer_allocator_internal.h"
139 #include "sanitizer_atomic.h"
140 #include "sanitizer_common.h"
141 @@ -30,7 +31,6 @@
143 #include <link.h>
144 #include <pthread.h>
145 -#include <signal.h>
146 #include <sys/resource.h>
147 #include <syslog.h>
149 Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
150 ===================================================================
151 --- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
152 +++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
153 @@ -12,6 +12,7 @@
155 #include "sanitizer_platform.h"
156 #if SANITIZER_POSIX
157 +#include <signal.h>
158 #include "sanitizer_allocator_internal.h"
159 #include "sanitizer_common.h"
160 #include "sanitizer_flags.h"