pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
compiler-rt-netbsd: Rebase and improve local patches
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Fri Aug 31 22:37:30 2018 +0200
Changeset: d6374ee358d04e74f8dfebda87245d2992416ff3
Modified Files:
compiler-rt-netbsd/distinfo
compiler-rt-netbsd/patches/patch-CMakeLists.txt
compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerLoop.cpp
compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc
Removed Files:
compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__openbsd.cc
compiler-rt-netbsd/patches/patch-lib_xray_xray__flags.h
compiler-rt-netbsd/patches/patch-lib_xray_xray__profiling.cc
Log Message:
compiler-rt-netbsd: Rebase and improve local patches
Improve the calls to libc functions, replacing syscall(2)/__syscall(2).
Drop local draft code in xray.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=d6374ee358d04e74f8dfebda87245d2992416ff3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
compiler-rt-netbsd/distinfo | 18 +-
compiler-rt-netbsd/patches/patch-CMakeLists.txt | 6 +-
.../patches/patch-cmake_config-ix.cmake | 2 +-
.../patches/patch-lib_fuzzer_FuzzerLoop.cpp | 4 +-
.../patches/patch-lib_fuzzer_tests_CMakeLists.txt | 2 +-
...zer__common_sanitizer__common__interceptors.inc | 2 +-
...patch-lib_sanitizer__common_sanitizer__linux.cc | 314 +++++++++------------
..._sanitizer__common_sanitizer__linux__libcdep.cc | 2 +-
...tch-lib_sanitizer__common_sanitizer__openbsd.cc | 0
.../patches/patch-lib_xray_xray__flags.h | 14 -
.../patches/patch-lib_xray_xray__profiling.cc | 19 --
11 files changed, 153 insertions(+), 230 deletions(-)
diffs:
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index 5b4c3348bc..5af126442c 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -1,19 +1,19 @@
$NetBSD: distinfo,v 1.35 2015/09/11 01:21:57 tnn Exp $
-SHA1 (patch-CMakeLists.txt) = bce32bd256b9e57e9cadc51cf6adcf269445bcb3
+SHA1 (patch-CMakeLists.txt) = 41a98b874a62c46fb83b899d547c72c817be8127
SHA1 (patch-cmake_Modules_HandleCompilerRT.cmake) = fde0a4b440a257dec40c4f106c2352d5efecceef
-SHA1 (patch-cmake_config-ix.cmake) = 1456a6d244727885d51b68d333de7119523d1d6d
+SHA1 (patch-cmake_config-ix.cmake) = 9edb16aff65429d088082d1869b6034019abed33
SHA1 (patch-lib_asan_asan__posix.cc) = be7e47c252e30184639f7ed1c98c75a8667fd261
-SHA1 (patch-lib_fuzzer_FuzzerLoop.cpp) = 18ec3311ab74dc12321579a3b01adc900af2a3a9
-SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = 8f3afca11a9f45a7e843db7c65eeee292292b8bf
+SHA1 (patch-lib_fuzzer_FuzzerLoop.cpp) = b2e226a0d7b230cc8598a0591ae6f688527c6b2d
+SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = c3d8a78f96566e5b8d2d8a5cbaba60990bfd6efe
SHA1 (patch-lib_msan_msan__interceptors.cc) = 7af07c88b0ddf650f3df5dea4f6664ff9393d963
SHA1 (patch-lib_msan_msan__linux.cc) = b5df0f4f5930d7c1681b1ad867c893d01d6e5cf7
-SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = 92f45b328972b6459b90d4d53c44943d43910312
+SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = d48fd71509c2adfb5fc5aacfec1dc8fd07640414
SHA1 (patch-lib_sanitizer__common_sanitizer__interceptors__ioctl__netbsd.inc) = 1c6e8c4a755af57d523d06b12f08a1946f1aef25
SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = e231d87d8e04d528f73275f5de7000c2b395a9c4
-SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = 80e1809e4c394b3cc1b790fffc8159e2deb4cee2
-SHA1 (patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc) = 175a6c188beda1d3933dd326692ea54fe5ce5139
-SHA1 (patch-lib_sanitizer__common_sanitizer__openbsd.cc) = da39a3ee5e6b4b0d3255bfef95601890afd80709
+SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = 858b68b4e472cc0fc90f88406c3d159ae107e38c
+SHA1 (patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc) = 8d156e4b51961bab6bae3ee30df8e18aea632b5d
+SHA1 (patch-lib_sanitizer__common_sanitizer__mac.cc) = 6f1b9ae0ee35166f32b0865c82cfdd6eca5c1047
SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = 87684ad05a8e3a5ab2f1c9cf00cbecab4823eeb3
SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc) = b52e02792201d54d1f9e9336a8cf74ff8c9eca68
SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h) = e8a0d9389f3ddd41f911e00f8ff62e214441296d
@@ -23,8 +23,6 @@ SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc) = c4ef1f0bd0f297c
SHA1 (patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc) = 86d53010debaf2cc5c9793d83186db2db76b280f
SHA1 (patch-lib_scudo_scudo__platform.h) = 68f33b18d913984c3a459597ef62f63d36184ca9
SHA1 (patch-lib_tsan_CMakeLists.txt) = 11fda934da12d046350463076bed2c209ec682e9
-SHA1 (patch-lib_xray_xray__flags.h) = b5abd9ee12c7c96514564dd17225f864c9489c8e
-SHA1 (patch-lib_xray_xray__profiling.cc) = c8653c7bd11b535f9066a3d7f4f975a6a2e5bfa0
SHA1 (patch-test_asan_TestCases_Posix_stack-use-after-return.cc) = 474bfca0e8891bb777a81ae926c89c3d56f7cdb9
SHA1 (patch-test_asan_TestCases_heavy__uar__test.cc) = fce8bfec44d93bb606920dba9ddd7165f127d23a
SHA1 (patch-test_asan_TestCases_interception__failure__test.cc) = 0a359141e3c30b672842904b32d1542170b03ab1
diff --git a/compiler-rt-netbsd/patches/patch-CMakeLists.txt b/compiler-rt-netbsd/patches/patch-CMakeLists.txt
index 00915e381f..0329f1a781 100644
--- a/compiler-rt-netbsd/patches/patch-CMakeLists.txt
+++ b/compiler-rt-netbsd/patches/patch-CMakeLists.txt
@@ -1,8 +1,8 @@
$NetBSD$
---- CMakeLists.txt.orig 2018-08-21 21:25:22.000000000 +0000
+--- CMakeLists.txt.orig 2018-08-31 08:13:43.000000000 +0000
+++ CMakeLists.txt
-@@ -338,6 +338,10 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuch
+@@ -341,6 +341,10 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuch
list(APPEND SANITIZER_COMMON_LINK_LIBS zircon)
endif()
@@ -13,7 +13,7 @@ $NetBSD$
if (SANITIZER_CXX_ABI_LIBNAME STREQUAL "libc++")
if (SANITIZER_CXX_ABI_INTREE)
if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
-@@ -380,7 +384,7 @@ foreach(path IN ITEMS ${LLVM_MAIN_SRC_DI
+@@ -383,7 +387,7 @@ foreach(path IN ITEMS ${LLVM_MAIN_SRC_DI
${LLVM_MAIN_SRC_DIR}/../libcxx
${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR})
if(IS_DIRECTORY ${path})
diff --git a/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake b/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
index 393846d8d1..e5d6ab65c0 100644
--- a/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
+++ b/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
@@ -1,6 +1,6 @@
$NetBSD$
---- cmake/config-ix.cmake.orig 2018-08-21 21:25:36.000000000 +0000
+--- cmake/config-ix.cmake.orig 2018-08-31 08:13:42.000000000 +0000
+++ cmake/config-ix.cmake
@@ -557,7 +557,7 @@ else()
endif()
diff --git a/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerLoop.cpp b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerLoop.cpp
index 61a85cd43c..0d2d810ed8 100644
--- a/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerLoop.cpp
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerLoop.cpp
@@ -1,8 +1,8 @@
$NetBSD$
---- lib/fuzzer/FuzzerLoop.cpp.orig 2018-08-21 21:25:41.000000000 +0000
+--- lib/fuzzer/FuzzerLoop.cpp.orig 2018-08-31 08:13:42.000000000 +0000
+++ lib/fuzzer/FuzzerLoop.cpp
-@@ -276,7 +276,7 @@ NO_SANITIZE_MEMORY
+@@ -275,7 +275,7 @@ NO_SANITIZE_MEMORY
void Fuzzer::AlarmCallback() {
assert(Options.UnitTimeoutSec > 0);
// In Windows Alarm callback is executed by a different thread.
diff --git a/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt b/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
index 7df9c787cb..8d31721ed1 100644
--- a/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
@@ -1,6 +1,6 @@
$NetBSD$
---- lib/fuzzer/tests/CMakeLists.txt.orig 2018-08-21 21:25:41.000000000 +0000
+--- lib/fuzzer/tests/CMakeLists.txt.orig 2018-08-31 08:13:43.000000000 +0000
+++ lib/fuzzer/tests/CMakeLists.txt
@@ -13,6 +13,9 @@ add_custom_target(FuzzerUnitTests)
set_target_properties(FuzzerUnitTests PROPERTIES FOLDER "Compiler-RT Tests")
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
index c63c95c6fb..91119eddc3 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
@@ -1,6 +1,6 @@
$NetBSD$
---- lib/sanitizer_common/sanitizer_common_interceptors.inc.orig 2018-08-31 08:13:42.913618270 +0000
+--- lib/sanitizer_common/sanitizer_common_interceptors.inc.orig 2018-08-31 08:13:42.000000000 +0000
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -77,6 +77,11 @@
#define ctime __ctime50
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
index b7e526d596..cc8d4d061c 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
@@ -1,30 +1,41 @@
$NetBSD$
---- lib/sanitizer_common/sanitizer_linux.cc.orig 2018-08-31 08:13:43.281423466 +0000
+--- lib/sanitizer_common/sanitizer_linux.cc.orig 2018-08-31 08:32:18.000000000 +0000
+++ lib/sanitizer_common/sanitizer_linux.cc
-@@ -158,7 +158,20 @@ extern void internal_sigreturn();
- # else
- # define SANITIZER_USE_GETENTROPY 0
+@@ -160,6 +160,32 @@ extern void internal_sigreturn();
# endif
--#endif // SANITIZER_USE_GETENTROPY
-+#endif // SANITIZER_USE_GETENTROP
-+
+ #endif // SANITIZER_USE_GETENTROPY
+
+#if SANITIZER_NETBSD
-+//#include "interception/interception.h"
-+#if 0
-+DECLARE_REAL(void *, __mmap, void *addr, size_t length, int prot, \
-+int flags, int fd, int pad, off_t offset);
-+#endif
-+#if 0
-+extern "C" void *__mmap(void *, size_t, int, int, int, int, off_t);
-+DEFINE_REAL(void *, __mmap, void *addr, size_t length, int prot, \
-+int flags, int fd, int pad, off_t offset)
++extern "C" void *__mmap(void *, size_t, int, int, int, int,
++ off_t) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" int __sysctl(const int *, unsigned int, void *, size_t *,
++ const void *, size_t) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" int _sys_close(int) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" int _sys_open(const char *, int, ...) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" ssize_t _sys_read(int, void *, size_t) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" ssize_t _sys_write(int, const void *,
++ size_t) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" int __ftruncate(int, int, off_t) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" ssize_t _sys_readlink(const char *, char *,
++ size_t) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" int _sys_sched_yield() SANITIZER_WEAK_ATTRIBUTE;
++extern "C" int _sys___nanosleep50(const void *,
++ void *) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" int _sys_execve(const char *, char *const[],
++ char *const[]) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" off_t __lseek(int, int, off_t, int) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" int __fork() SANITIZER_WEAK_ATTRIBUTE;
++extern "C" int _sys___sigprocmask14(int, const void *,
++ void *) SANITIZER_WEAK_ATTRIBUTE;
++extern "C" int _sys___wait450(int wpid, int *, int,
++ void *) SANITIZER_WEAK_ATTRIBUTE;
+#endif
-+#endif
-
++
namespace __sanitizer {
-@@ -172,12 +185,37 @@ namespace __sanitizer {
+ #if SANITIZER_LINUX && defined(__x86_64__)
+@@ -172,14 +198,27 @@ namespace __sanitizer {
#include "sanitizer_syscall_generic.inc"
#endif
@@ -46,31 +57,22 @@ $NetBSD$
#if !SANITIZER_S390 && !SANITIZER_OPENBSD
uptr internal_mmap(void *addr, uptr length, int prot, int flags, int fd,
OFF_T offset) {
--#if SANITIZER_NETBSD
-+#if SANITIZER_NETBSDxx
-+ GetRealFunctionAddress();
-+ return (uptr)REAL(__mmap)(addr, length, prot, flags, fd, 0, offset);
-+#elif SANITIZER_NETBSD
-+ static uptr (*real___mmap)(void *a, uptr b, int c, int d, int e, int f,
-+ OFF_T g) = NULL;
-+ if (!real___mmap) {
-+ real___mmap = (uptr(*)(void *a, uptr b, int c, int d, int e, int f,
-+ OFF_T g))GetRealLibcAddress("__mmap");
-+ }
-+ CHECK(real___mmap);
-+ return (*real___mmap)(addr, length, prot, flags, fd, 0, offset);
-+#elif SANITIZER_NETBSDxxx
- return internal_syscall64(SYSCALL(mmap), addr, length, prot, flags, fd,
- (long)0, offset);
+ #if SANITIZER_NETBSD
+- return internal_syscall64(SYSCALL(mmap), addr, length, prot, flags, fd,
+- (long)0, offset);
++ CHECK(&__mmap);
++ return (uptr)__mmap(addr, length, prot, flags, fd, 0, offset);
#elif SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS
-@@ -194,20 +232,52 @@ uptr internal_mmap(void *addr, uptr leng
+ return internal_syscall(SYSCALL(mmap), (uptr)addr, length, prot, flags, fd,
+ offset);
+@@ -194,20 +233,46 @@ uptr internal_mmap(void *addr, uptr leng
#if !SANITIZER_OPENBSD
uptr internal_munmap(void *addr, uptr length) {
+#if SANITIZER_NETBSD
+ static int (*real_munmap)(void *a, uptr b) = NULL;
+ if (!real_munmap) {
-+ real_munmap = (int(*)(void *a, uptr b))GetRealLibcAddress("munmap");
++ real_munmap = (int (*)(void *a, uptr b))GetRealLibcAddress("munmap");
+ }
+ CHECK(real_munmap);
+ return (*real_munmap)(addr, length);
@@ -83,8 +85,8 @@ $NetBSD$
+#if SANITIZER_NETBSD
+ static int (*real_mprotect)(void *a, uptr b, int c) = NULL;
+ if (!real_mprotect) {
-+ real_mprotect = (int(*)(void *a, uptr b, int c))
-+ GetRealLibcAddress("mprotect");
++ real_mprotect =
++ (int (*)(void *a, uptr b, int c))GetRealLibcAddress("mprotect");
+ }
+ return (*real_mprotect)(addr, length, prot);
+#else
@@ -95,11 +97,8 @@ $NetBSD$
uptr internal_close(fd_t fd) {
+#if SANITIZER_NETBSD
-+ static int (*real_close)(int a) = NULL;
-+ if (!real_close) {
-+ real_close = (int(*)(int a))GetRealLibcAddress("close");
-+ }
-+ return (*real_close)(fd);
++ CHECK(&_sys_close);
++ return _sys_close(fd);
+#else
return internal_syscall(SYSCALL(close), fd);
+#endif
@@ -108,41 +107,31 @@ $NetBSD$
uptr internal_open(const char *filename, int flags) {
-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+#if SANITIZER_NETBSD
-+ static int (*real_open)(const char *a, int b) = NULL;
-+ if (!real_open) {
-+ real_open = (int(*)(const char *a, int b))GetRealLibcAddress("open");
-+ }
-+ return (*real_open)(filename, flags);
++ CHECK(&_sys_open);
++ return _sys_open(filename, flags);
+#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
return internal_syscall(SYSCALL(openat), AT_FDCWD, (uptr)filename, flags);
#else
return internal_syscall_ptr(SYSCALL(open), (uptr)filename, flags);
-@@ -215,7 +285,13 @@ uptr internal_open(const char *filename,
+@@ -215,7 +280,10 @@ uptr internal_open(const char *filename,
}
uptr internal_open(const char *filename, int flags, u32 mode) {
-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+#if SANITIZER_NETBSD
-+ static int (*real_open)(const char *a, int b, u32 c) = NULL;
-+ if (!real_open) {
-+ real_open = (int(*)(const char *a, int b, u32 c))GetRealLibcAddress("open");
-+ }
-+ return (*real_open)(filename, flags, mode);
++ CHECK(&_sys_open);
++ return _sys_open(filename, flags, mode);
+#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
return internal_syscall(SYSCALL(openat), AT_FDCWD, (uptr)filename, flags,
mode);
#else
-@@ -225,21 +301,45 @@ uptr internal_open(const char *filename,
+@@ -225,22 +293,33 @@ uptr internal_open(const char *filename,
uptr internal_read(fd_t fd, void *buf, uptr count) {
sptr res;
+#if SANITIZER_NETBSD
-+ static int (*real_read)(int a, void *b, uptr c) = NULL;
-+ if (!real_read) {
-+ real_read = (int(*)(int a, void *b, uptr c))GetRealLibcAddress("read");
-+ }
-+ CHECK(real_read);
-+ HANDLE_EINTR(res, (sptr)(*real_read)(fd, buf, count));
++ CHECK(&_sys_read);
++ HANDLE_EINTR(res, (sptr)_sys_read(fd, buf, (size_t)count));
+#else
HANDLE_EINTR(res, (sptr)internal_syscall_ptr(SYSCALL(read), fd, (uptr)buf,
count));
@@ -153,12 +142,8 @@ $NetBSD$
uptr internal_write(fd_t fd, const void *buf, uptr count) {
sptr res;
+#if SANITIZER_NETBSD
-+ static int (*real_write)(int a, const void *b, uptr c) = NULL;
-+ if (!real_write) {
-+ real_write = (int(*)(int a, const void *b, uptr c))
-+ GetRealLibcAddress("write");
-+ }
-+ HANDLE_EINTR(res, (sptr)(*real_write)(fd, buf, count));
++ CHECK(&_sys_write);
++ HANDLE_EINTR(res, (sptr)_sys_write(fd, buf, count));
+#else
HANDLE_EINTR(res, (sptr)internal_syscall_ptr(SYSCALL(write), fd, (uptr)buf,
count));
@@ -169,16 +154,13 @@ $NetBSD$
uptr internal_ftruncate(fd_t fd, uptr size) {
sptr res;
#if SANITIZER_NETBSD
-+ static int (*real_ftruncate)(int a, s64 b) = NULL;
-+ if (!real_ftruncate) {
-+ real_ftruncate = (int(*)(int a, s64 b))GetRealLibcAddress("ftruncate");
-+ }
-+ HANDLE_EINTR(res, (uptr)(*real_ftruncate)(fd, size));
-+#elif SANITIZER_NETBSDxx
- HANDLE_EINTR(res, internal_syscall64(SYSCALL(ftruncate), fd, 0, (s64)size));
+- HANDLE_EINTR(res, internal_syscall64(SYSCALL(ftruncate), fd, 0, (s64)size));
++ CHECK(&__ftruncate);
++ HANDLE_EINTR(res, __ftruncate(fd, 0, (s64)size));
#else
HANDLE_EINTR(res, (sptr)internal_syscall(SYSCALL(ftruncate), fd,
-@@ -316,7 +416,14 @@ static void kernel_stat_to_stat(struct k
+ (OFF_T)size));
+@@ -316,7 +395,14 @@ static void kernel_stat_to_stat(struct k
#endif
uptr internal_stat(const char *path, void *buf) {
@@ -186,30 +168,30 @@ $NetBSD$
+#if SANITIZER_NETBSD
+ static int (*real_stat)(const char *a, void *b) = NULL;
+ if (!real_stat) {
-+ real_stat = (int(*)(const char *a, void *b))GetRealLibcAddress("__stat50");
++ real_stat = (int (*)(const char *a, void *b))GetRealLibcAddress("__stat50");
+ }
+ CHECK(real_stat);
+ return (*real_stat)(path, buf);
-+#elif SANITIZER_FREEBSD || SANITIZER_NETBSDxx || SANITIZER_OPENBSD
++#elif SANITIZER_FREEBSD || SANITIZER_OPENBSD
return internal_syscall_ptr(SYSCALL(fstatat), AT_FDCWD, (uptr)path, (uptr)buf,
0);
#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-@@ -342,6 +449,14 @@ uptr internal_stat(const char *path, voi
+@@ -342,7 +428,13 @@ uptr internal_stat(const char *path, voi
uptr internal_lstat(const char *path, void *buf) {
#if SANITIZER_NETBSD
+- return internal_syscall_ptr(SYSCALL(lstat), path, buf);
+ static int (*real_lstat)(const char *a, void *b) = NULL;
+ if (!real_lstat) {
-+ real_lstat = (int(*)(const char *a, void *b))
-+ GetRealLibcAddress("__lstat50");
++ real_lstat =
++ (int (*)(const char *a, void *b))GetRealLibcAddress("__lstat50");
+ }
+ CHECK(real_lstat);
+ return (*real_lstat)(path, buf);
-+#elif SANITIZER_NETBSDxxx
- return internal_syscall_ptr(SYSCALL(lstat), path, buf);
#elif SANITIZER_FREEBSD || SANITIZER_OPENBSD
return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path, (uptr)buf,
-@@ -368,7 +483,14 @@ uptr internal_lstat(const char *path, vo
+ AT_SYMLINK_NOFOLLOW);
+@@ -368,9 +460,16 @@ uptr internal_lstat(const char *path, vo
}
uptr internal_fstat(fd_t fd, void *buf) {
@@ -217,15 +199,18 @@ $NetBSD$
+#if SANITIZER_NETBSD
+ static int (*real_fstat)(int a, void *b) = NULL;
+ if (!real_fstat) {
-+ real_fstat = (int(*)(int a, void *b))GetRealLibcAddress("__fstat50");
++ real_fstat = (int (*)(int a, void *b))GetRealLibcAddress("__fstat50");
+ }
+ CHECK(real_fstat);
+ return (*real_fstat)(fd, buf);
-+#elif SANITIZER_FREEBSD || SANITIZER_NETBSDxx || SANITIZER_OPENBSD || \
++#elif SANITIZER_FREEBSD || SANITIZER_OPENBSD || \
SANITIZER_LINUX_USES_64BIT_SYSCALLS
- #if SANITIZER_MIPS64 && !SANITIZER_NETBSD && !SANITIZER_OPENBSD
+-#if SANITIZER_MIPS64 && !SANITIZER_NETBSD && !SANITIZER_OPENBSD
++#if SANITIZER_MIPS64 && !SANITIZER_OPENBSD
// For mips64, fstat syscall fills buffer in the format of kernel_stat
-@@ -395,7 +517,14 @@ uptr internal_filesize(fd_t fd) {
+ struct kernel_stat kbuf;
+ int res = internal_syscall(SYSCALL(fstat), fd, &kbuf);
+@@ -395,7 +494,14 @@ uptr internal_filesize(fd_t fd) {
}
uptr internal_dup2(int oldfd, int newfd) {
@@ -233,7 +218,7 @@ $NetBSD$
+#if SANITIZER_NETBSD
+ static int (*real_dup2)(int a, int b) = NULL;
+ if (!real_dup2) {
-+ real_dup2 = (int(*)(int a, int b))GetRealLibcAddress("dup2");
++ real_dup2 = (int (*)(int a, int b))GetRealLibcAddress("dup2");
+ }
+ CHECK(real_dup2);
+ return (*real_dup2)(oldfd, newfd);
@@ -241,24 +226,18 @@ $NetBSD$
return internal_syscall(SYSCALL(dup3), oldfd, newfd, 0);
#else
return internal_syscall(SYSCALL(dup2), oldfd, newfd);
-@@ -403,7 +532,15 @@ uptr internal_dup2(int oldfd, int newfd)
+@@ -403,7 +509,9 @@ uptr internal_dup2(int oldfd, int newfd)
}
uptr internal_readlink(const char *path, char *buf, uptr bufsize) {
-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+#if SANITIZER_NETBSD
-+ static ssize_t (*real_readlink)(const char *a, char *b, size_t c) = NULL;
-+ if (!real_readlink) {
-+ real_readlink = (ssize_t(*)(const char *a, char *b, size_t c))
-+ GetRealLibcAddress("readlink");
-+ }
-+ CHECK(real_readlink);
-+ return (*real_readlink)(path, buf, bufsize);
++ return (uptr)_sys_readlink(path, buf, bufsize);
+#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
return internal_syscall(SYSCALL(readlinkat), AT_FDCWD, (uptr)path, (uptr)buf,
bufsize);
#elif SANITIZER_OPENBSD
-@@ -415,7 +552,14 @@ uptr internal_readlink(const char *path,
+@@ -415,7 +523,14 @@ uptr internal_readlink(const char *path,
}
uptr internal_unlink(const char *path) {
@@ -266,7 +245,7 @@ $NetBSD$
+#if SANITIZER_NETBSD
+ static int (*real_unlink)(const char *a) = NULL;
+ if (!real_unlink) {
-+ real_unlink = (int(*)(const char *a))GetRealLibcAddress("unlink");
++ real_unlink = (int (*)(const char *a))GetRealLibcAddress("unlink");
+ }
+ CHECK(real_unlink);
+ return (*real_unlink)(path);
@@ -274,7 +253,7 @@ $NetBSD$
return internal_syscall(SYSCALL(unlinkat), AT_FDCWD, (uptr)path, 0);
#else
return internal_syscall_ptr(SYSCALL(unlink), (uptr)path);
-@@ -423,7 +567,15 @@ uptr internal_unlink(const char *path) {
+@@ -423,7 +538,15 @@ uptr internal_unlink(const char *path) {
}
uptr internal_rename(const char *oldpath, const char *newpath) {
@@ -282,8 +261,8 @@ $NetBSD$
+#if SANITIZER_NETBSD
+ static int (*real_rename)(const char *a, const char *b) = NULL;
+ if (!real_rename) {
-+ real_rename = (int(*)(const char *a, const char *b))
-+ GetRealLibcAddress("rename");
++ real_rename =
++ (int (*)(const char *a, const char *b))GetRealLibcAddress("rename");
+ }
+ CHECK(real_rename);
+ return (*real_rename)(oldpath, newpath);
@@ -291,17 +270,13 @@ $NetBSD$
return internal_syscall(SYSCALL(renameat), AT_FDCWD, (uptr)oldpath, AT_FDCWD,
(uptr)newpath);
#else
-@@ -432,11 +584,27 @@ uptr internal_rename(const char *oldpath
+@@ -432,11 +555,23 @@ uptr internal_rename(const char *oldpath
}
uptr internal_sched_yield() {
+#if !SANITIZER_NETBSD
-+ static int (*real_sched_yield)() = NULL;
-+ if (!real_sched_yield) {
-+ real_sched_yield = (int(*)())GetRealLibcAddress("sched_yield");
-+ }
-+ CHECK(real_sched_yield);
-+ return (*real_sched_yield)();
++ CHECK(&_sys_sched_yield);
++ return _sys_sched_yield();
+#else
return internal_syscall(SYSCALL(sched_yield));
+#endif
@@ -312,46 +287,33 @@ $NetBSD$
+#if SANITIZER_NETBSD
+ static void (*real__exit)(int a) = NULL;
+ if (!real__exit) {
-+ real__exit = (void(*)(int a))GetRealLibcAddress("_exit");
++ real__exit = (void (*)(int a))GetRealLibcAddress("_exit");
+ }
+ CHECK(real__exit);
+ (*real__exit)(exitcode);
-+#elif SANITIZER_FREEBSD || SANITIZER_NETBSDxxx || SANITIZER_OPENBSD
++#elif SANITIZER_FREEBSD || SANITIZER_OPENBSD
internal_syscall(SYSCALL(exit), exitcode);
#else
internal_syscall(SYSCALL(exit_group), exitcode);
-@@ -445,18 +613,38 @@ void internal__exit(int exitcode) {
- }
-
- unsigned int internal_sleep(unsigned int seconds) {
-+#if SANITIZER_NETBSD
-+ static unsigned int (*real_sleep)(unsigned int a) = NULL;
-+ if (!real_sleep) {
-+ real_sleep = (unsigned int(*)(unsigned int a))GetRealLibcAddress("sleep");
-+ }
-+ CHECK(real_sleep);
-+ return (*real_sleep)(seconds);
-+#else
+@@ -448,15 +583,25 @@ unsigned int internal_sleep(unsigned int
struct timespec ts;
ts.tv_sec = 1;
ts.tv_nsec = 0;
++#if SANITIZER_NETBSD
++ CHECK(&_sys___nanosleep50);
++ int res = _sys___nanosleep50(&ts, &ts);
++#else
int res = internal_syscall_ptr(SYSCALL(nanosleep), &ts, &ts);
++#endif
if (res) return ts.tv_sec;
return 0;
-+#endif
}
uptr internal_execve(const char *filename, char *const argv[],
char *const envp[]) {
+#if SANITIZER_NETBSD
-+ static int (*real_execve)(const char *a, char *const b[], char *const c[])
-+ = NULL;
-+ if (!real_execve) {
-+ real_execve = (int(*)(const char *a, char *const b[], char *const c[]))
-+ GetRealLibcAddress("execve");
-+ }
-+ CHECK(real_execve);
-+ return (*real_execve)(filename, argv, envp);
++ CHECK(&_sys_execve);
++ return _sys_execve(filename, argv, envp);
+#else
return internal_syscall_ptr(SYSCALL(execve), (uptr)filename, (uptr)argv,
(uptr)envp);
@@ -359,15 +321,15 @@ $NetBSD$
}
#endif // !SANITIZER_SOLARIS
-@@ -514,12 +702,32 @@ u64 NanoTime() {
+@@ -514,12 +659,33 @@ u64 NanoTime() {
kernel_timeval tv;
#endif
internal_memset(&tv, 0, sizeof(tv));
+#if SANITIZER_NETBSD
+ static int (*real_gettimeofday)(void *a, void *b) = NULL;
+ if (!real_gettimeofday) {
-+ real_gettimeofday = (int(*)(void *a, void *b))
-+ GetRealLibcAddress("__gettimeofday50");
++ real_gettimeofday =
++ (int (*)(void *a, void *b))GetRealLibcAddress("__gettimeofday50");
+ }
+ CHECK(real_gettimeofday);
+ (*real_gettimeofday)(&tv, 0);
@@ -381,8 +343,9 @@ $NetBSD$
+#if SANITIZER_NETBSD
+ static int (*real_clock_gettime)(__sanitizer_clockid_t a, void *b) = NULL;
+ if (!real_clock_gettime) {
-+ real_clock_gettime = (int(*)(__sanitizer_clockid_t a, void *b))
-+ GetRealLibcAddress("__clock_gettime50");
++ real_clock_gettime =
++ (int (*)(__sanitizer_clockid_t a, void *b))GetRealLibcAddress(
++ "__clock_gettime50");
+ }
+ CHECK(real_clock_gettime);
+ return (*real_clock_gettime)(clk_id, tp);
@@ -392,26 +355,22 @@ $NetBSD$
}
#endif // !SANITIZER_SOLARIS
-@@ -527,7 +735,7 @@ uptr internal_clock_gettime(__sanitizer_
+@@ -527,7 +693,7 @@ uptr internal_clock_gettime(__sanitizer_
// 'environ' array (on some others) and does not use libc. This function
// should be called first inside __asan_init.
const char *GetEnv(const char *name) {
-#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD || \
-+#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD || \
++#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD || \
SANITIZER_SOLARIS
if (::environ != 0) {
uptr NameLen = internal_strlen(name);
-@@ -767,20 +975,55 @@ uptr internal_ptrace(int request, int pi
+@@ -767,20 +933,51 @@ uptr internal_ptrace(int request, int pi
}
uptr internal_waitpid(int pid, int *status, int options) {
+#if SANITIZER_NETBSD
-+ static int (*real_waitpid)(int a, int *b, int c) = NULL;
-+ if (!real_waitpid) {
-+ real_waitpid = (int(*)(int a, int *b, int c))GetRealLibcAddress("waitpid");
-+ }
-+ CHECK(real_waitpid);
-+ return (*real_waitpid)(pid, status, options);
++ CHECK(&_sys___wait450);
++ return _sys___wait450(pid, status, options, 0 /* rusage */);
+#else
return internal_syscall_ptr(SYSCALL(wait4), pid, (uptr)status, options,
0 /* rusage */);
@@ -422,7 +381,7 @@ $NetBSD$
+#if SANITIZER_NETBSD
+ static int (*real_getpid)() = NULL;
+ if (!real_getpid) {
-+ real_getpid = (int(*)())GetRealLibcAddress("getpid");
++ real_getpid = (int (*)())GetRealLibcAddress("getpid");
+ }
+ CHECK(real_getpid);
+ return (*real_getpid)();
@@ -435,7 +394,7 @@ $NetBSD$
+#if SANITIZER_NETBSD
+ static int (*real_getppid)() = NULL;
+ if (!real_getppid) {
-+ real_getppid = (int(*)())GetRealLibcAddress("getppid");
++ real_getppid = (int (*)())GetRealLibcAddress("getppid");
+ }
+ CHECK(real_getppid);
+ return (*real_getppid)();
@@ -449,8 +408,8 @@ $NetBSD$
+#if SANITIZER_NETBSD
+ static int (*real_getdents)(int a, void *b, size_t c) = NULL;
+ if (!real_getdents) {
-+ real_getdents = (int(*)(int a, void *b, size_t c))
-+ GetRealLibcAddress("__getdents30");
++ real_getdents =
++ (int (*)(int a, void *b, size_t c))GetRealLibcAddress("__getdents30");
+ }
+ CHECK(real_getdents);
+ return (*real_getdents)(fd, dirp, count);
@@ -458,30 +417,25 @@ $NetBSD$
return internal_syscall(SYSCALL(getdirentries), fd, (uptr)dirp, count, NULL);
#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
return internal_syscall(SYSCALL(getdents64), fd, (uptr)dirp, count);
-@@ -791,6 +1034,14 @@ uptr internal_getdents(fd_t fd, struct l
+@@ -791,7 +988,8 @@ uptr internal_getdents(fd_t fd, struct l
uptr internal_lseek(fd_t fd, OFF_T offset, int whence) {
#if SANITIZER_NETBSD
-+ static OFF_T (*real___lseek)(int a, int b, OFF_T c, int d) = NULL;
-+ if (!real___lseek) {
-+ real___lseek = (OFF_T(*)(int a, int b, OFF_T c, int d))
-+ GetRealLibcAddress("__lseek");
-+ }
-+ CHECK(real___lseek);
-+ return (*real___lseek)(fd, 0, offset, whence);
-+#elif SANITIZER_NETBSDxxx
- return internal_syscall64(SYSCALL(lseek), fd, 0, offset, whence);
+- return internal_syscall64(SYSCALL(lseek), fd, 0, offset, whence);
++ CHECK(&__lseek);
++ return __lseek(fd, 0, offset, whence);
#else
return internal_syscall(SYSCALL(lseek), fd, offset, whence);
-@@ -804,11 +1055,28 @@ uptr internal_prctl(int option, uptr arg
+ #endif
+@@ -804,11 +1002,24 @@ uptr internal_prctl(int option, uptr arg
#endif
uptr internal_sigaltstack(const void *ss, void *oss) {
+#if SANITIZER_NETBSD
+ static int (*real_sigaltstack)(const void *a, void *b) = NULL;
+ if (!real_sigaltstack) {
-+ real_sigaltstack = (int(*)(const void *a, void *b))
-+ GetRealLibcAddress("__sigaltstack14");
++ real_sigaltstack =
++ (int (*)(const void *a, void *b))GetRealLibcAddress("__sigaltstack14");
+ }
+ CHECK(real_sigaltstack);
+ return (*real_sigaltstack)(ss, oss);
@@ -493,30 +447,34 @@ $NetBSD$
int internal_fork() {
-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+#if SANITIZER_NETBSD
-+ static int (*real_fork)() = NULL;
-+ if (!real_fork) {
-+ real_fork = (int(*)())GetRealLibcAddress("fork");
-+ }
-+ CHECK(real_fork);
-+ return (*real_fork)();
++ CHECK(&__fork);
++ return __fork();
+#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
return internal_syscall(SYSCALL(clone), SIGCHLD, 0);
#else
return internal_syscall(SYSCALL(fork));
-@@ -891,7 +1159,15 @@ int internal_sigaction_syscall(int signu
+@@ -818,7 +1029,12 @@ int internal_fork() {
+ #if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD
+ int internal_sysctl(const int *name, unsigned int namelen, void *oldp,
+ uptr *oldlenp, const void *newp, uptr newlen) {
++#if SANITIZER_NETBSD
++ CHECK(&__sysctl);
++ return __sysctl(name, namelen, oldp, (size_t *)oldlenp, newp, (size_t)newlen);
++#else
+ return sysctl(name, namelen, oldp, (size_t *)oldlenp, newp, (size_t)newlen);
++#endif
+ }
+ #endif
+
+@@ -891,7 +1107,10 @@ int internal_sigaction_syscall(int signu
uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
__sanitizer_sigset_t *oldset) {
-#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD
+#if SANITIZER_NETBSD
-+ static int (*real_sigprocmask)(int a, void *b, void *c) = NULL;
-+ if (!real_sigprocmask) {
-+ real_sigprocmask = (int(*)(int a, void *b, void *c))
-+ GetRealLibcAddress("__sigprocmask14");
-+ }
-+ CHECK(real_sigprocmask);
-+ return (*real_sigprocmask)(how, set, oldset);
-+#elif SANITIZER_FREEBSD || SANITIZER_NETBSDxx || SANITIZER_OPENBSD
++ CHECK(&_sys___sigprocmask14);
++ return _sys___sigprocmask14(how, set, oldset);
++#elif SANITIZER_FREEBSD || SANITIZER_OPENBSD
return internal_syscall_ptr(SYSCALL(sigprocmask), how, set, oldset);
#else
__sanitizer_kernel_sigset_t *k_set = (__sanitizer_kernel_sigset_t *)set;
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc
index 5d521c859b..2ec2ba2474 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc
@@ -1,6 +1,6 @@
$NetBSD$
---- lib/sanitizer_common/sanitizer_linux_libcdep.cc.orig 2018-08-31 08:13:43.283495237 +0000
+--- lib/sanitizer_common/sanitizer_linux_libcdep.cc.orig 2018-08-31 08:13:43.000000000 +0000
+++ lib/sanitizer_common/sanitizer_linux_libcdep.cc
@@ -25,6 +25,7 @@
#include "sanitizer_freebsd.h"
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__openbsd.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__openbsd.cc
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/compiler-rt-netbsd/patches/patch-lib_xray_xray__flags.h b/compiler-rt-netbsd/patches/patch-lib_xray_xray__flags.h
deleted file mode 100644
index 6b2abf40af..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_xray_xray__flags.h
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
---- lib/xray/xray_flags.h.orig 2018-08-21 21:25:41.000000000 +0000
-+++ lib/xray/xray_flags.h
-@@ -31,7 +31,8 @@ struct Flags {
- extern Flags xray_flags_dont_use_directly;
- extern void registerXRayFlags(FlagParser *P, Flags *F);
- const char *useCompilerDefinedFlags();
--inline Flags *flags() { return &xray_flags_dont_use_directly; }
-+inline Flags *flags() {
-+ return &xray_flags_dont_use_directly; }
-
- void initializeFlags();
-
diff --git a/compiler-rt-netbsd/patches/patch-lib_xray_xray__profiling.cc b/compiler-rt-netbsd/patches/patch-lib_xray_xray__profiling.cc
deleted file mode 100644
index 8264464611..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_xray_xray__profiling.cc
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD$
-
---- lib/xray/xray_profiling.cc.orig 2018-08-21 21:25:41.000000000 +0000
-+++ lib/xray/xray_profiling.cc
-@@ -345,8 +345,12 @@ bool profilingDynamicInitializer() XRAY_
- return false;
- }
-
-- if (!internal_strcmp(flags()->xray_mode, "xray-profiling"))
-- __xray_log_select_mode("xray_profiling");
-+ Printf("flags()=%p\n", flags());
-+ Printf("flags()->xray_mode=%s\n", flags()->xray_mode);
-+ Printf("flags()->xray_logfile_base=%s\n", flags()->xray_logfile_base);
-+
-+// if (!internal_strcmp(flags()->xray_mode, "xray-profiling"))
-+// __xray_log_select_mode("xray_profiling");
- return true;
- }
-
Home |
Main Index |
Thread Index |
Old Index