| author | |
| committer | |
| log | fe783d9ff39a31a3b39a7b7bb2c3ffed08b99bf4 |
| tree | 289e9108235defc4e80a1bd3675846e64982a149 |
| parent | 67c9d57e2735d4ad9846127d2fa140e61b945ee4 |
| signature |
This patch can hopefully be dropped in the future; see #24989.
closes #24885
closes #24896
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>2 files changed, 10 insertions(+), 17 deletions(-)
lib/libtsan/sanitizer_common/sanitizer_linux.cpp+7-5| ... | ... | @@ -174,8 +174,6 @@ const int FUTEX_WAKE_PRIVATE = FUTEX_WAKE | FUTEX_PRIVATE_FLAG; |
| 174 | 174 | |
| 175 | 175 | # if SANITIZER_FREEBSD |
| 176 | 176 | # define SANITIZER_USE_GETENTROPY 1 |
| 177 | extern "C" void *__sys_mmap(void *addr, size_t len, int prot, int flags, int fd, | |
| 178 | off_t offset); | |
| 179 | 177 | # endif |
| 180 | 178 | |
| 181 | 179 | namespace __sanitizer { |
| ... | ... | @@ -265,9 +263,8 @@ ScopedBlockSignals::~ScopedBlockSignals() { SetSigProcMask(&saved_, nullptr); } |
| 265 | 263 | # if !SANITIZER_S390 |
| 266 | 264 | uptr internal_mmap(void *addr, uptr length, int prot, int flags, int fd, |
| 267 | 265 | u64 offset) { |
| 268 | # if SANITIZER_FREEBSD | |
| 269 | return (uptr)__sys_mmap(addr, length, prot, flags, fd, offset); | |
| 270 | # elif SANITIZER_LINUX_USES_64BIT_SYSCALLS | |
| 266 | /* zig patch: use direct syscall for freebsd mmap */ | |
| 267 | # if SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS | |
| 271 | 268 | return internal_syscall(SYSCALL(mmap), (uptr)addr, length, prot, flags, fd, |
| 272 | 269 | offset); |
| 273 | 270 | # else |
| ... | ... | @@ -942,6 +939,11 @@ int internal_fork() { |
| 942 | 939 | } |
| 943 | 940 | |
| 944 | 941 | # if SANITIZER_FREEBSD |
| 942 | int internal_sigaction(int signum, const void *act, void *oldact) { | |
| 943 | /* zig patch: use direct syscall for freebsd mmap */ | |
| 944 | return internal_syscall(SYSCALL(sigaction), signum, (uptr)act, (uptr)oldact); | |
| 945 | } | |
| 946 | ||
| 945 | 947 | int internal_sysctl(const int *name, unsigned int namelen, void *oldp, |
| 946 | 948 | uptr *oldlenp, const void *newp, uptr newlen) { |
| 947 | 949 | return internal_syscall(SYSCALL(__sysctl), name, namelen, oldp, |
lib/libtsan/sanitizer_common/sanitizer_linux_libcdep.cpp+3-12| ... | ... | @@ -69,8 +69,6 @@ |
| 69 | 69 | # undef MAP_NORESERVE |
| 70 | 70 | # define MAP_NORESERVE 0 |
| 71 | 71 | extern const Elf_Auxinfo *__elf_aux_vector __attribute__((weak)); |
| 72 | extern "C" int __sys_sigaction(int signum, const struct sigaction *act, | |
| 73 | struct sigaction *oldact); | |
| 74 | 72 | # endif |
| 75 | 73 | |
| 76 | 74 | # if SANITIZER_NETBSD |
| ... | ... | @@ -100,24 +98,17 @@ namespace __sanitizer { |
| 100 | 98 | SANITIZER_WEAK_ATTRIBUTE int real_sigaction(int signum, const void *act, |
| 101 | 99 | void *oldact); |
| 102 | 100 | |
| 101 | /* zig patch: use direct syscall for freebsd sigaction (sanitizer_linux.cpp) */ | |
| 102 | # if !SANITIZER_FREEBSD | |
| 103 | 103 | int internal_sigaction(int signum, const void *act, void *oldact) { |
| 104 | # if SANITIZER_FREEBSD | |
| 105 | // On FreeBSD, call the sigaction syscall directly (part of libsys in FreeBSD | |
| 106 | // 15) since the libc version goes via a global interposing table. Due to | |
| 107 | // library initialization order the table can be relocated after the call to | |
| 108 | // InitializeDeadlySignals() which then crashes when dereferencing the | |
| 109 | // uninitialized pointer in libc. | |
| 110 | return __sys_sigaction(signum, (const struct sigaction *)act, | |
| 111 | (struct sigaction *)oldact); | |
| 112 | # else | |
| 113 | 104 | # if !SANITIZER_GO |
| 114 | 105 | if (&real_sigaction) |
| 115 | 106 | return real_sigaction(signum, act, oldact); |
| 116 | 107 | # endif |
| 117 | 108 | return sigaction(signum, (const struct sigaction *)act, |
| 118 | 109 | (struct sigaction *)oldact); |
| 119 | # endif | |
| 120 | 110 | } |
| 111 | # endif | |
| 121 | 112 | |
| 122 | 113 | void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top, |
| 123 | 114 | uptr *stack_bottom) { |