Skip to content

[sanitizer] Fix pthread_exit interceptor's return type #71253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

aheejin
Copy link
Member

@aheejin aheejin commented Nov 3, 2023

pthread_exit's return type is void.

`pthread_exit`'s return type is void.
@llvmbot
Copy link
Member

llvmbot commented Nov 3, 2023

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Heejin Ahn (aheejin)

Changes

pthread_exit's return type is void.


Full diff: https://github.com/llvm/llvm-project/pull/71253.diff

3 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_interceptors.cpp (+2-2)
  • (modified) compiler-rt/lib/hwasan/hwasan_interceptors.cpp (+2-2)
  • (modified) compiler-rt/lib/lsan/lsan_interceptors.cpp (+2-2)
diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp
index 876682c3b6b3a35..0ee8e0ea786edeb 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -300,9 +300,9 @@ INTERCEPTOR(int, pthread_detach, void *thread) {
   return result;
 }
 
-INTERCEPTOR(int, pthread_exit, void *retval) {
+INTERCEPTOR(void, pthread_exit, void *retval) {
   asanThreadArgRetval().Finish(GetThreadSelf(), retval);
-  return REAL(pthread_exit)(retval);
+  REAL(pthread_exit)(retval);
 }
 
 #    if ASAN_INTERCEPT_TRYJOIN
diff --git a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
index 0889831373a8039..d7405b06752f421 100644
--- a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
@@ -322,9 +322,9 @@ INTERCEPTOR(int, pthread_detach, void *thread) {
   return result;
 }
 
-INTERCEPTOR(int, pthread_exit, void *retval) {
+INTERCEPTOR(void, pthread_exit, void *retval) {
   hwasanThreadArgRetval().Finish(GetThreadSelf(), retval);
-  return REAL(pthread_exit)(retval);
+  REAL(pthread_exit)(retval);
 }
 
 #    if SANITIZER_GLIBC
diff --git a/compiler-rt/lib/lsan/lsan_interceptors.cpp b/compiler-rt/lib/lsan/lsan_interceptors.cpp
index fac6133ddf21b26..885f7ad5ddba961 100644
--- a/compiler-rt/lib/lsan/lsan_interceptors.cpp
+++ b/compiler-rt/lib/lsan/lsan_interceptors.cpp
@@ -490,9 +490,9 @@ INTERCEPTOR(int, pthread_detach, void *thread) {
   return result;
 }
 
-INTERCEPTOR(int, pthread_exit, void *retval) {
+INTERCEPTOR(void, pthread_exit, void *retval) {
   GetThreadArgRetval().Finish(GetThreadSelf(), retval);
-  return REAL(pthread_exit)(retval);
+  REAL(pthread_exit)(retval);
 }
 
 #  if SANITIZER_INTERCEPT_TRYJOIN

aheejin added a commit to aheejin/emscripten that referenced this pull request Nov 3, 2023
These interceptors was added in LLVM 17, but it looks they have a wrong
return type. I submitted llvm/llvm-project#71253
to fix that upstream, but in the meantime we should fix this to pass our
tests.
Copy link
Collaborator

@vitalybuka vitalybuka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@vitalybuka vitalybuka merged commit d859403 into llvm:main Nov 6, 2023
@aheejin aheejin deleted the pthread_exit_void branch November 6, 2023 19:18
aheejin added a commit to aheejin/emscripten that referenced this pull request Nov 14, 2023
These interceptors was added in LLVM 17, but it looks they have a wrong
return type. I submitted llvm/llvm-project#71253
to fix that upstream, but in the meantime we should fix this to pass our
tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants