[compiler-rt] 82ddf1b - [NFC][HWASAN] Move HwasanThreadStartFunc
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Mon May 8 16:26:49 PDT 2023
Author: Vitaly Buka
Date: 2023-05-08T16:26:29-07:00
New Revision: 82ddf1b8ec6c2e7ab81a8ca6f078a878e1688b0e
URL: https://github.com/llvm/llvm-project/commit/82ddf1b8ec6c2e7ab81a8ca6f078a878e1688b0e
DIFF: https://github.com/llvm/llvm-project/commit/82ddf1b8ec6c2e7ab81a8ca6f078a878e1688b0e.diff
LOG: [NFC][HWASAN] Move HwasanThreadStartFunc
Added:
Modified:
compiler-rt/lib/hwasan/hwasan_interceptors.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
index f07c24e34a08..3854ad62f41a 100644
--- a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
@@ -27,20 +27,6 @@ using namespace __hwasan;
# if HWASAN_WITH_INTERCEPTORS
-struct ThreadStartArg {
- thread_callback_t callback;
- void *param;
- __sanitizer_sigset_t starting_sigset_;
-};
-
-static void *HwasanThreadStartFunc(void *arg) {
- __hwasan_thread_enter();
- ThreadStartArg A = *reinterpret_cast<ThreadStartArg *>(arg);
- SetSigProcMask(&A.starting_sigset_, nullptr);
- UnmapOrDie(arg, GetPageSizeCached());
- return A.callback(A.param);
-}
-
# define COMMON_SYSCALL_PRE_READ_RANGE(p, s) __hwasan_loadN((uptr)p, (uptr)s)
# define COMMON_SYSCALL_PRE_WRITE_RANGE(p, s) \
__hwasan_storeN((uptr)p, (uptr)s)
@@ -57,6 +43,20 @@ static void *HwasanThreadStartFunc(void *arg) {
# include "sanitizer_common/sanitizer_common_syscalls.inc"
# include "sanitizer_common/sanitizer_syscalls_netbsd.inc"
+struct ThreadStartArg {
+ thread_callback_t callback;
+ void *param;
+ __sanitizer_sigset_t starting_sigset_;
+};
+
+static void *HwasanThreadStartFunc(void *arg) {
+ __hwasan_thread_enter();
+ ThreadStartArg A = *reinterpret_cast<ThreadStartArg *>(arg);
+ SetSigProcMask(&A.starting_sigset_, nullptr);
+ UnmapOrDie(arg, GetPageSizeCached());
+ return A.callback(A.param);
+}
+
INTERCEPTOR(int, pthread_create, void *th, void *attr,
void *(*callback)(void *), void *param) {
EnsureMainThreadIDIsCorrect();
More information about the llvm-commits
mailing list