-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[compiler-rt][rtsan] page regions api interception update. #123601
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -808,6 +808,35 @@ INTERCEPTOR(int, munmap, void *addr, size_t length) { | |
return REAL(munmap)(addr, length); | ||
} | ||
|
||
INTERCEPTOR(int, madvise, void *addr, size_t length, int flag) { | ||
__rtsan_notify_intercepted_call("madvise"); | ||
return REAL(madvise)(addr, length, flag); | ||
} | ||
|
||
INTERCEPTOR(int, posix_madvise, void *addr, size_t length, int flag) { | ||
__rtsan_notify_intercepted_call("posix_madvise"); | ||
return REAL(posix_madvise)(addr, length, flag); | ||
} | ||
|
||
INTERCEPTOR(int, mprotect, void *addr, size_t length, int prot) { | ||
__rtsan_notify_intercepted_call("mprotect"); | ||
return REAL(mprotect)(addr, length, prot); | ||
} | ||
|
||
INTERCEPTOR(int, msync, void *addr, size_t length, int flag) { | ||
__rtsan_notify_intercepted_call("msync"); | ||
return REAL(msync)(addr, length, flag); | ||
} | ||
|
||
#if SANITIZER_APPLE | ||
INTERCEPTOR(int, mincore, const void *addr, size_t length, char *vec) { | ||
#else | ||
INTERCEPTOR(int, mincore, void *addr, size_t length, unsigned char *vec) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like this may be in other BSD flavors as well, if you want to perhaps add a SANITIZER_INTERCEPT macro in the big header
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And it shows up on gentoo linux as well when I just looked |
||
#endif | ||
__rtsan_notify_intercepted_call("mincore"); | ||
return REAL(mincore)(addr, length, vec); | ||
} | ||
|
||
INTERCEPTOR(int, shm_open, const char *name, int oflag, mode_t mode) { | ||
__rtsan_notify_intercepted_call("shm_open"); | ||
return REAL(shm_open)(name, oflag, mode); | ||
|
@@ -1148,6 +1177,11 @@ void __rtsan::InitializeInterceptors() { | |
INTERCEPT_FUNCTION(mmap); | ||
RTSAN_MAYBE_INTERCEPT_MMAP64; | ||
INTERCEPT_FUNCTION(munmap); | ||
INTERCEPT_FUNCTION(madvise); | ||
INTERCEPT_FUNCTION(posix_madvise); | ||
INTERCEPT_FUNCTION(mprotect); | ||
INTERCEPT_FUNCTION(msync); | ||
INTERCEPT_FUNCTION(mincore); | ||
INTERCEPT_FUNCTION(shm_open); | ||
INTERCEPT_FUNCTION(shm_unlink); | ||
RTSAN_MAYBE_INTERCEPT_MEMALIGN; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could consider posix_madvise as well while you're in the neighborhood.